Skip to content

Commit b9e0fc0

Browse files
committed
TypeCastSniff: Fixed internal error
1 parent 972b73a commit b9e0fc0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

SlevomatCodingStandard/Sniffs/PHP/TypeCastSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public function process(File $phpcsFile, $pointer): void
5858

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

61+
if (!array_key_exists(1, $matches)) {
62+
return;
63+
}
64+
6165
$castName = $matches[1];
6266
$castNameLower = strtolower($castName);
6367

tests/Sniffs/PHP/data/typeCastNoErrors.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
(string ) 123;
1414
( string ) 123;
1515

16+
b"\xEF\xBB\xBF";
17+

0 commit comments

Comments
 (0)