Skip to content

Commit

Permalink
Skip empty types
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Jun 8, 2023
1 parent c38bb12 commit 8c84123
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,12 @@ protected function processParams(File $phpcsFile, $stackPtr, $commentStart)
$suggestedTypeNames = [];

foreach ($typeNames as $typeName) {
if ($typeName === '') {
continue;
}

// Strip nullable operator.
if (isset($typeName[0]) === true && $typeName[0] === '?') {
if ($typeName[0] === '?') {
$typeName = substr($typeName, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ function throwCommentOneLine() {}
/**
* When two adjacent pipe symbols are used (by mistake), the sniff should not throw a PHP Fatal error
*
* @param stdClass||null $object While invalid, this should not throw a PHP Fatal error.
* @param stdClass|null $object While invalid, this should not throw a PHP Fatal error.
* @return void
*/
function doublePipeFatalError(?stdClass $object) {}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public function getErrorList()
1004 => 2,
1006 => 1,
1029 => 1,
1053 => 1,
];

// Scalar type hints only work from PHP 7 onwards.
Expand Down

0 comments on commit 8c84123

Please sign in to comment.