|
@@ 461-496 (lines=36) @@
|
| 458 |
|
|
| 459 |
|
// Check number of spaces after the type. |
| 460 |
|
$spaces = ($maxType - strlen($param['type']) + 1); |
| 461 |
|
if ($param['type_space'] !== $spaces) { |
| 462 |
|
$error = 'Expected %s spaces after parameter type; %s found'; |
| 463 |
|
$data = array( |
| 464 |
|
$spaces, |
| 465 |
|
$param['type_space'], |
| 466 |
|
); |
| 467 |
|
|
| 468 |
|
$fix = $phpcsFile->addFixableError($error, $param['tag'], 'SpacingAfterParamType', $data); |
| 469 |
|
if ($fix === true) { |
| 470 |
|
$phpcsFile->fixer->beginChangeset(); |
| 471 |
|
|
| 472 |
|
$content = $param['type']; |
| 473 |
|
$content .= str_repeat(' ', $spaces); |
| 474 |
|
$content .= $param['var']; |
| 475 |
|
$content .= str_repeat(' ', $param['var_space']); |
| 476 |
|
$content .= $param['commentLines'][0]['comment']; |
| 477 |
|
$phpcsFile->fixer->replaceToken(($param['tag'] + 2), $content); |
| 478 |
|
|
| 479 |
|
// Fix up the indent of additional comment lines. |
| 480 |
|
foreach ($param['commentLines'] as $lineNum => $line) { |
| 481 |
|
if ($lineNum === 0 |
| 482 |
|
|| $param['commentLines'][$lineNum]['indent'] === 0 |
| 483 |
|
) { |
| 484 |
|
continue; |
| 485 |
|
} |
| 486 |
|
|
| 487 |
|
$newIndent = ($param['commentLines'][$lineNum]['indent'] + $spaces - $param['type_space']); |
| 488 |
|
$phpcsFile->fixer->replaceToken( |
| 489 |
|
($param['commentLines'][$lineNum]['token'] - 1), |
| 490 |
|
str_repeat(' ', $newIndent) |
| 491 |
|
); |
| 492 |
|
} |
| 493 |
|
|
| 494 |
|
$phpcsFile->fixer->endChangeset(); |
| 495 |
|
}//end if |
| 496 |
|
}//end if |
| 497 |
|
|
| 498 |
|
// Make sure the param name is correct. |
| 499 |
|
if (isset($realParams[$pos]) === true) { |
|
@@ 530-565 (lines=36) @@
|
| 527 |
|
|
| 528 |
|
// Check number of spaces after the var name. |
| 529 |
|
$spaces = ($maxVar - strlen($param['var']) + 1); |
| 530 |
|
if ($param['var_space'] !== $spaces) { |
| 531 |
|
$error = 'Expected %s spaces after parameter name; %s found'; |
| 532 |
|
$data = array( |
| 533 |
|
$spaces, |
| 534 |
|
$param['var_space'], |
| 535 |
|
); |
| 536 |
|
|
| 537 |
|
$fix = $phpcsFile->addFixableError($error, $param['tag'], 'SpacingAfterParamName', $data); |
| 538 |
|
if ($fix === true) { |
| 539 |
|
$phpcsFile->fixer->beginChangeset(); |
| 540 |
|
|
| 541 |
|
$content = $param['type']; |
| 542 |
|
$content .= str_repeat(' ', $param['type_space']); |
| 543 |
|
$content .= $param['var']; |
| 544 |
|
$content .= str_repeat(' ', $spaces); |
| 545 |
|
$content .= $param['commentLines'][0]['comment']; |
| 546 |
|
$phpcsFile->fixer->replaceToken(($param['tag'] + 2), $content); |
| 547 |
|
|
| 548 |
|
// Fix up the indent of additional comment lines. |
| 549 |
|
foreach ($param['commentLines'] as $lineNum => $line) { |
| 550 |
|
if ($lineNum === 0 |
| 551 |
|
|| $param['commentLines'][$lineNum]['indent'] === 0 |
| 552 |
|
) { |
| 553 |
|
continue; |
| 554 |
|
} |
| 555 |
|
|
| 556 |
|
$newIndent = ($param['commentLines'][$lineNum]['indent'] + $spaces - $param['var_space']); |
| 557 |
|
$phpcsFile->fixer->replaceToken( |
| 558 |
|
($param['commentLines'][$lineNum]['token'] - 1), |
| 559 |
|
str_repeat(' ', $newIndent) |
| 560 |
|
); |
| 561 |
|
} |
| 562 |
|
|
| 563 |
|
$phpcsFile->fixer->endChangeset(); |
| 564 |
|
}//end if |
| 565 |
|
}//end if |
| 566 |
|
|
| 567 |
|
// Param comments must start with a capital letter and end with the full stop. |
| 568 |
|
if (preg_match('/^(\p{Ll}|\P{L})/u', $param['comment']) === 1) { |