Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3879,6 +3879,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
$throwPoints = array_merge($throwPoints, $result->getThrowPoints());
$impurePoints = array_merge($impurePoints, $result->getImpurePoints());
$isAlwaysTerminating = $isAlwaysTerminating || $result->isAlwaysTerminating();
$throwPoints[] = InternalThrowPoint::createImplicit($scope, $expr);
} else {
$this->callNodeCallback($nodeCallback, $expr->name, $scope, $storage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,4 +681,9 @@ public function testBug9146NonStrict(): void
]);
}

public function testBug13569(): void
{
$this->analyse([__DIR__ . '/data/bug-13569.php'], []);
}

}
19 changes: 19 additions & 0 deletions tests/PHPStan/Rules/Exceptions/data/bug-13569.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php // lint >= 8.1

declare(strict_types = 1);

namespace Bug13569;

enum ReactionType: string
{
case EMOJI_HEART = '❤️';

public static function tryFromName(string $name): ?self
{
try {
return ReactionType::{$name};
} catch (\Error) {
return null;
}
}
}
Loading