Skip to content

Commit 73ad14a

Browse files
author
roettigl
committed
MC-18816: Impelement an better check for ThrowCatchSniff
1 parent be51e06 commit 73ad14a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Magento2/Sniffs/Exceptions/ThrowCatchSniff.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function process(File $phpcsFile, $stackPtr)
7878
}
7979
} while (isset($tokens[$nextToken]['scope_closer']) === true);
8080

81-
if (empty($catchClassName)) {
81+
if (empty($catchClassNames)) {
8282
return; // is not relevant no catch found
8383
}
8484

@@ -101,7 +101,9 @@ private function getFullClassName(array $tokens, int $startPos)
101101
{
102102
$fullName = "";
103103
$endOfClassName = [T_SEMICOLON => 0, T_CLOSE_PARENTHESIS => 0];
104-
for ($i = $startPos; $i <= count($tokens); $i++) {
104+
105+
$tokenCount = count($tokens);
106+
for ($i = $startPos; $i <= $tokenCount; $i++) {
105107
$type = $tokens[$i]['code'];
106108

107109
if ($type === T_STRING || $type === T_NS_SEPARATOR) {

0 commit comments

Comments
 (0)