MediaWiki-CodeSniffer
MediaWiki CodeSniffer Standards
Loading...
Searching...
No Matches
MediaWiki\Sniffs\PHPUnit\SetMethodsSniff Class Reference

Replace calls to MockBuilder::setMethods (deprecated in PHPUnit 8) with MockBuilder::onlyMethods. More...

+ Inheritance diagram for MediaWiki\Sniffs\PHPUnit\SetMethodsSniff:

Public Member Functions

 register ()
 @inheritDoc
 
 process (File $phpcsFile, $stackPtr)
 

Detailed Description

Replace calls to MockBuilder::setMethods (deprecated in PHPUnit 8) with MockBuilder::onlyMethods.

This is based on the assumption that most such calls do not intend to add new methods (which would require using addMethods). As such, this sniff only serves as a first automatic step, but manual review of replacements is necessary (which shouldn't be hard anyway, as PHPUnit will fail hard if the wrong method is used). This is also not going to trigger for setMethods() calls that don't belong to MockBuilder.

Member Function Documentation

◆ process()

MediaWiki\Sniffs\PHPUnit\SetMethodsSniff::process ( File $phpcsFile,
$stackPtr )
Parameters
File$phpcsFile
int$stackPtr
Returns
void|int

The documentation for this class was generated from the following file: