mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Don’t throw exception when ignoring trait absence
This commit is contained in:
parent
af61e167f4
commit
c6b3fc512f
@ -636,7 +636,12 @@ class ClassAnalyzer extends ClassLikeAnalyzer
|
||||
$this->source->getAliases()
|
||||
);
|
||||
|
||||
$trait_file_analyzer = $project_analyzer->getFileAnalyzerForClassLike($fq_trait_name);
|
||||
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(
|
||||
|
@ -780,6 +780,13 @@ class TraitTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'noCrashOnUndefinedIgnoredTrait' => [
|
||||
'<?php
|
||||
/** @psalm-suppress UndefinedTrait */
|
||||
class C {
|
||||
use UnknownTrait;
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user