Skip to content

Commit db01b01

Browse files
committed
Add missing rule.
1 parent 82c5bd7 commit db01b01

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

PSR2R/Sniffs/Commenting/DocBlockParamSniff.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ private function getMethodSignature(File $phpcsFile, int $stackPtr): array {
144144
$i = $startIndex;
145145
while ($nextVariableIndex = $phpcsFile->findNext(T_VARIABLE, $i + 1, $endIndex)) {
146146
$typehint = $default = null;
147-
$possibleTypeHint =
148-
$phpcsFile->findPrevious([T_ARRAY, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
147+
$possibleTypeHint = $phpcsFile->findPrevious([T_ARRAY, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
149148
if ($possibleTypeHint) {
150149
$typehint = $possibleTypeHint;
151150
}
@@ -155,12 +154,11 @@ private function getMethodSignature(File $phpcsFile, int $stackPtr): array {
155154

156155
$possibleEqualIndex = $phpcsFile->findNext([T_EQUAL], $nextVariableIndex + 1, $nextVariableIndex + 2);
157156
if ($possibleEqualIndex) {
158-
$possibleDefaultValue =
159-
$phpcsFile->findNext(
160-
[T_STRING, T_TRUE, T_FALSE, T_NULL, T_ARRAY],
161-
$possibleEqualIndex + 1,
162-
$possibleEqualIndex + 2,
163-
);
157+
$possibleDefaultValue = $phpcsFile->findNext(
158+
[T_STRING, T_TRUE, T_FALSE, T_NULL, T_ARRAY],
159+
$possibleEqualIndex + 1,
160+
$possibleEqualIndex + 2,
161+
);
164162
if ($possibleDefaultValue) {
165163
$default = $possibleDefaultValue;
166164
}

PSR2R/Sniffs/Commenting/DocBlockTagTypesSniff.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,13 @@ public function process(File $phpcsFile, int $stackPtr): void {
163163
continue;
164164
}
165165

166-
$mappingTag =
167-
isset(static::$mapping[$content]) ? static::$mapping[$tokens[$i]['content']] : null;
166+
$mappingTag = isset(static::$mapping[$content]) ? static::$mapping[$tokens[$i]['content']] : null;
168167
if ($mappingTag) {
169168
$error .= ', expected `' . $mappingTag . '`';
170169
}
171170

172171
$prevAsterix = $phpcsFile->findPrevious(T_DOC_COMMENT_STAR, $i - 1, $docBlockStartIndex);
173-
$nextAsterix =
174-
$phpcsFile->findNext([T_DOC_COMMENT_STAR, T_DOC_COMMENT_CLOSE_TAG], $i + 1, $docBlockEndIndex + 1);
172+
$nextAsterix = $phpcsFile->findNext([T_DOC_COMMENT_STAR, T_DOC_COMMENT_CLOSE_TAG], $i + 1, $docBlockEndIndex + 1);
175173
if (!$prevAsterix || !$nextAsterix) {
176174
$phpcsFile->addError($error, $i, 'Invalid');
177175

PSR2R/Sniffs/WhiteSpace/DocBlockAlignmentSniff.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ public function process(File $phpcsFile, int $stackPtr): void {
7979
return;
8080
}
8181

82-
$isNotWalled =
83-
(in_array($tokens[$nextIndex]['code'], $leftWall, false) && $tokens[$stackPtr]['column'] !== 1);
82+
$isNotWalled = (in_array($tokens[$nextIndex]['code'], $leftWall, false) && $tokens[$stackPtr]['column'] !== 1);
8483
$isNotIndented = false;
8584
if ($isNotFlatFile) {
8685
$isNotIndented = (in_array($tokens[$nextIndex]['code'], $oneIndentation, false) &&
@@ -91,8 +90,7 @@ public function process(File $phpcsFile, int $stackPtr): void {
9190
return;
9291
}
9392

94-
$fix =
95-
$phpcsFile->addFixableError('Expected docblock to be aligned with code.', $stackPtr, 'NotAllowed');
93+
$fix = $phpcsFile->addFixableError('Expected docblock to be aligned with code.', $stackPtr, 'NotAllowed');
9694
if (!$fix) {
9795
return;
9896
}

PSR2R/ruleset.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@
277277

278278
<rule ref="Generic.WhiteSpace.ScopeIndent">
279279
<properties>
280+
<property name="ignoreIndentationTokens" type="array">
281+
<element value="T_COMMENT"/>
282+
<element value="T_DOC_COMMENT_OPEN_TAG"/>
283+
</property>
280284
<property name="tabIndent" value="true"/>
281285
<property name="exact" value="true"/>
282286
</properties>

0 commit comments

Comments
 (0)