Skip to content

Commit 5c2816b

Browse files
committed
Fix docblock sniff.
1 parent 0e1efcd commit 5c2816b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

PhpCollective/Sniffs/Commenting/DocBlockVarSniff.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ public function process(File $phpCsFile, $stackPointer): void
4141

4242
$previousIndex = $phpCsFile->findPrevious(Tokens::$emptyTokens, $stackPointer - 1, null, true);
4343

44+
$type = [];
4445
while ($previousIndex && in_array($tokens[$previousIndex]['code'], [T_STRING, T_NULLABLE, T_NULL, T_TYPE_UNION], true)) {
46+
$type[] = $tokens[$previousIndex]['content'];
4547
$previousIndex = $phpCsFile->findPrevious(Tokens::$emptyTokens, $previousIndex - 1, null, true);
4648
}
4749

50+
// Skip these checks for typed ones for now
51+
if ($type) {
52+
return;
53+
}
54+
4855
if ($previousIndex && $tokens[$previousIndex]['code'] === T_STATIC) {
4956
$previousIndex = $phpCsFile->findPrevious(Tokens::$emptyTokens, $previousIndex - 1, null, true);
5057
}

PhpCollective/Sniffs/Commenting/InlineDocBlockSniff.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,6 @@ protected function findErrors(File $phpCsFile, int $contentIndex, bool $isSingle
215215
$errors['space-before-end'] = 'Expected single space before ´*/´';
216216
}
217217

218-
var_export($contentMatches);
219-
die();
220-
221218
if (!preg_match('|^\$[a-z0-9_]+$|i', $contentMatches[3])) {
222219
$errors['order'] = 'Expected `{Type} ${var}`, got `' . $contentMatches[1] . $contentMatches[2] . $contentMatches[3] . '`';
223220
}

0 commit comments

Comments
 (0)