|
@@ 237-248 (lines=12) @@
|
| 234 |
|
|
| 235 |
|
$error = 'First line of comment not aligned correctly; expected %s but found %s'; |
| 236 |
|
$fix = $phpcsFile->addFixableError($error, $commentLines[1], 'FirstLineIndent', $data); |
| 237 |
|
if ($fix === true) { |
| 238 |
|
if (isset($tokens[$commentLines[1]]['orig_content']) === true |
| 239 |
|
&& $tokens[$commentLines[1]]['orig_content'][0] === "\t" |
| 240 |
|
) { |
| 241 |
|
// Line is indented using tabs. |
| 242 |
|
$padding = str_repeat("\t", floor($starColumn / $this->_tabWidth)); |
| 243 |
|
} else { |
| 244 |
|
$padding = str_repeat(' ', $starColumn); |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
$phpcsFile->fixer->replaceToken($commentLines[1], $padding.ltrim($content)); |
| 248 |
|
} |
| 249 |
|
}//end if |
| 250 |
|
|
| 251 |
|
if (preg_match('/^\p{Ll}/u', $commentText) === 1) { |
|
@@ 288-299 (lines=12) @@
|
| 285 |
|
|
| 286 |
|
$error = 'Comment line indented incorrectly; expected at least %s but found %s'; |
| 287 |
|
$fix = $phpcsFile->addFixableError($error, $line, 'LineIndent', $data); |
| 288 |
|
if ($fix === true) { |
| 289 |
|
if (isset($tokens[$line]['orig_content']) === true |
| 290 |
|
&& $tokens[$line]['orig_content'][0] === "\t" |
| 291 |
|
) { |
| 292 |
|
// Line is indented using tabs. |
| 293 |
|
$padding = str_repeat("\t", floor($starColumn / $this->_tabWidth)); |
| 294 |
|
} else { |
| 295 |
|
$padding = str_repeat(' ', $starColumn); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
$phpcsFile->fixer->replaceToken($line, $padding.ltrim($tokens[$line]['content'])); |
| 299 |
|
} |
| 300 |
|
}//end if |
| 301 |
|
}//end foreach |
| 302 |
|
|