| Conditions | 6 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
||
| 27 | $tokens = $phpcsFile->getTokens(); |
||
| 28 | |||
| 29 | $class = $tokens[$stackPtr]; |
||
| 30 | |||
| 31 | if(!IsSet($class['scope_closer'])) { |
||
| 32 | return; |
||
| 33 | } |
||
| 34 | |||
| 35 | $scopeCloser = $class['scope_closer']; |
||
| 36 | |||
| 37 | //get the name of the class |
||
| 38 | $classNamePos = $phpcsFile->findNext(T_STRING, $stackPtr); |
||
| 39 | $className = $tokens[$classNamePos]['content']; |
||
| 40 | |||
| 41 | $nextFunc = $stackPtr; |
||
| 42 | while (($nextFunc = $phpcsFile->findNext(T_FUNCTION, ($nextFunc + 1), $scopeCloser)) !== false) { |
||
| 43 | $funcNamePos = $phpcsFile->findNext(T_STRING, $nextFunc); |
||
| 44 | |||
| 45 | if ($this->supportsAbove('7.0')) { |
||
| 46 | if ($funcNamePos !== false && $tokens[$funcNamePos]['content'] === $className) { |
||
| 47 | $phpcsFile->addError('Deprecated PHP4 style constructor are not supported since PHP7', $funcNamePos); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 |