| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 47 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
| 48 | { |
||
| 49 | $tokens = $phpcsFile->getTokens(); |
||
|
|
|||
| 50 | $whitespace = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, $stackPtr + 2); |
||
| 51 | $class = $phpcsFile->findNext(T_ANON_CLASS, $stackPtr + 2, $stackPtr + 3); |
||
| 52 | if ($whitespace == false || $class == false) { |
||
| 53 | return false; |
||
| 54 | } |
||
| 55 | |||
| 56 | if ($this->supportsAbove('7.0')) { |
||
| 57 | return false; |
||
| 58 | } else { |
||
| 59 | $phpcsFile->addError('Anonymous classes are not supported in PHP 5.6 or earlier', $stackPtr); |
||
| 60 | } |
||
| 61 | }//end process() |
||
| 62 | |||
| 65 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.