1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix crash on aliased exception

Ref #3465
This commit is contained in:
Brown 2020-05-27 08:09:58 -04:00
parent 769ac5c052
commit ef53ee3a3b
2 changed files with 27 additions and 0 deletions

View File

@ -211,6 +211,8 @@ class TryAnalyzer
$statements_analyzer->getAliases()
);
$fq_catch_class = $codebase->classlikes->getUnAliasedName($fq_catch_class);
if ($codebase->alter_code && $fq_catch_class) {
$codebase->classlikes->handleClassLikeReferenceInMigration(
$codebase,

View File

@ -301,6 +301,31 @@ class TryCatchTest extends TestCase
} while (rand(0, 1));
}'
],
'aliasException' => [
'<?php
namespace UserException;
class UserException extends \Exception {
}
namespace Alias\UserException;
use function class_alias;
class_alias(
\UserException\UserException::class,
\Alias\UserException\UserExceptionAlias::class
);
namespace Client;
try {
throw new \Alias\UserException\UserExceptionAlias();
} catch (\Alias\UserException\UserExceptionAlias $e) {
// do nothing
}'
],
];
}