1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Don’t throw exception when ignoring trait absence

This commit is contained in:
Matthew Brown 2019-02-10 16:32:30 -05:00
parent af61e167f4
commit c6b3fc512f
2 changed files with 13 additions and 1 deletions

View File

@ -636,7 +636,12 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$this->source->getAliases()
);
try {
$trait_file_analyzer = $project_analyzer->getFileAnalyzerForClassLike($fq_trait_name);
} catch (\Exception $e) {
continue;
}
$trait_node = $codebase->classlikes->getTraitNode($fq_trait_name);
$trait_aliases = $codebase->classlikes->getTraitAliases($fq_trait_name);
$trait_analyzer = new TraitAnalyzer(

View File

@ -780,6 +780,13 @@ class TraitTest extends TestCase
}
}'
],
'noCrashOnUndefinedIgnoredTrait' => [
'<?php
/** @psalm-suppress UndefinedTrait */
class C {
use UnknownTrait;
}'
],
];
}