Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
$tokens = $phpcsFile->getTokens();

$commentEnd = $phpcsFile->findPrevious($this->ignoreTokens, ($stackPtr - 1), null, true);
if ($commentEnd === false

if ($commentEnd !== false && $tokens[$commentEnd]['code'] === T_STRING) {
$commentEnd = $phpcsFile->findPrevious($this->ignoreTokens, ($commentEnd - 1), null, true);
} elseif ($commentEnd === false
|| ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG
&& $tokens[$commentEnd]['code'] !== T_COMMENT)
) {
$phpcsFile->addWarning('Missing PHP DocBlock for class property.', $stackPtr, 'Missing');
return;
}

$commentStart = $tokens[$commentEnd]['comment_opener'];
$foundVar = null;
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,9 @@ class correctlyFormattedClassMemberDocBlock
* @var test
*/
protected $test;

/**
* @var string
*/
protected string $test;
}