1 | <?php |
||
2 | |||
3 | use PhpCsFixer\Config; |
||
4 | use PhpCsFixer\Finder; |
||
5 | |||
6 | $finder = Finder::create() |
||
7 | ->in(__DIR__ .DIRECTORY_SEPARATOR.'src') |
||
8 | ->in(__DIR__ .DIRECTORY_SEPARATOR.'tests') |
||
9 | ->files([ |
||
0 ignored issues
–
show
|
|||
10 | __DIR__.DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', |
||
11 | ]) |
||
12 | ->name('*.php') |
||
13 | ; |
||
14 | |||
15 | $config = new Config(); |
||
16 | $config |
||
17 | ->setFinder($finder) |
||
18 | ->setRiskyAllowed(false) |
||
19 | ->setRules([ |
||
20 | '@PSR12' => true, |
||
21 | 'phpdoc_summary' => false, |
||
22 | 'no_unused_imports' => true, |
||
23 | ]) |
||
24 | ; |
||
25 | |||
26 | return $config; |
||
27 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.