| @@ 141-156 (lines=16) @@ | ||
| 138 | $expectedLines = $hasPrevCurlyBrace ? 0 : 1; |
|
| 139 | ||
| 140 | //More than one line before comment |
|
| 141 | if (count($whitespacePtrs) > $expectedLines) { |
|
| 142 | $fixMuchLines = $this->phpcsFile->addFixableError( |
|
| 143 | self::MESSAGE_MUCH_LINES_BEFORE_COMMENT, |
|
| 144 | $this->commentStartPtr, |
|
| 145 | self::CODE_MUCH_LINES_BEFORE_COMMENT |
|
| 146 | ); |
|
| 147 | ||
| 148 | if ($fixMuchLines) { |
|
| 149 | $this->fixMuchLinesBeforeComment( |
|
| 150 | $whitespacePtrs, |
|
| 151 | $hasPrevCurlyBrace |
|
| 152 | ); |
|
| 153 | } |
|
| 154 | ||
| 155 | return; |
|
| 156 | } |
|
| 157 | ||
| 158 | //No line before comment |
|
| 159 | if (!$hasPrevCurlyBrace && count($whitespacePtrs) === 0) { |
|
| @@ 159-171 (lines=13) @@ | ||
| 156 | } |
|
| 157 | ||
| 158 | //No line before comment |
|
| 159 | if (!$hasPrevCurlyBrace && count($whitespacePtrs) === 0) { |
|
| 160 | $fixNoLine = $this->phpcsFile->addFixableError( |
|
| 161 | self::MESSAGE_NO_LINE_BEFORE_COMMENT, |
|
| 162 | $this->commentStartPtr, |
|
| 163 | self::CODE_NO_LINE_BEFORE_COMMENT |
|
| 164 | ); |
|
| 165 | ||
| 166 | if ($fixNoLine) { |
|
| 167 | $this->fixNoLineBeforeComment(); |
|
| 168 | } |
|
| 169 | ||
| 170 | return; |
|
| 171 | } |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|