-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
phpstan 0.12 latest
Code snippet that reproduces the problem
protected function propertyInUse(array $tokens, int $closeTagIndex, string $variable): bool {
/** @var string $property */
$property = substr($variable, 1);
$i = $closeTagIndex + 1;
while (isset($tokens[$i])) {
if ($tokens[$i]['code'] !== T_VARIABLE || $tokens[$i]['content'] !== '$this') {
$i++;
continue;
}
$i++;
if ($tokens[$i]['code'] !== T_OBJECT_OPERATOR) {
$i++;
continue;
}
$i++;
$token = $tokens[$i];
if ($token['code'] !== T_STRING || $token['content'] !== $property) {
$i++;
continue;
}
$i++; // 520
if ($tokens[$i]['code'] !== T_OBJECT_OPERATOR) {
$i++;
continue;
}
return true;
}
return false;
}Expected output
520 Unreachable statement - code above always terminates.
This is not true.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels