| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 54 | protected function applyFix(\SplFileInfo $file, Tokens $tokens) |
||
| 55 | { |
||
| 56 | for ($index = 2; $index < count($tokens); $index++) { |
||
| 57 | $token = $tokens[$index]; |
||
| 58 | $previousToken = $tokens[$index - 1]; |
||
| 59 | $sndPreviousToken = $tokens[$index - 2]; |
||
| 60 | if ($sndPreviousToken->getContent() !== '{' && |
||
| 61 | substr($token->getContent(), 0, 3) === '/**' |
||
| 62 | ) { |
||
| 63 | $previousToken->setContent(PHP_EOL . $previousToken->getContent()); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 | } |
||
| 68 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: