Skip to content

Commit

Permalink
TypeCastSniff: Fixed internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Sep 9, 2021
1 parent 972b73a commit b9e0fc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SlevomatCodingStandard/Sniffs/PHP/TypeCastSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public function process(File $phpcsFile, $pointer): void

preg_match('~^\(\s*(\S+)\s*\)\z~i', $cast, $matches);

if (!array_key_exists(1, $matches)) {
return;
}

$castName = $matches[1];
$castNameLower = strtolower($castName);

Expand Down
2 changes: 2 additions & 0 deletions tests/Sniffs/PHP/data/typeCastNoErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
(string ) 123;
( string ) 123;

b"\xEF\xBB\xBF";

0 comments on commit b9e0fc0

Please sign in to comment.