Conditions | 4 |
Paths | 4 |
Total Lines | 29 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
29 | { |
||
30 | if ($this->supportsAbove('7.2') === false) { |
||
31 | return; |
||
32 | } |
||
33 | |||
34 | $tokens = $phpcsFile->getTokens(); |
||
35 | |||
36 | $function = $tokens[$stackPtr]; |
||
37 | |||
38 | $funcName = $phpcsFile->getDeclarationName($function); |
||
39 | |||
40 | if ($funcName != '__autoload') { |
||
41 | return; |
||
42 | } |
||
43 | |||
44 | |||
45 | $class = $tokens[$stackPtr]; |
||
46 | |||
47 | if (isset($class['scope_closer']) === false) { |
||
48 | return; |
||
49 | } |
||
50 | |||
51 | $phpcsFile->addWarning( |
||
52 | 'Use of __autoload() function is deprecated since PHP 7.2', |
||
53 | $stackPtr, |
||
54 | 'Found' |
||
55 | ); |
||
56 | } |
||
57 | } |
||
58 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.