Skip to content

UnpopulatedClasslikeException after 3.7.1 update #2623

@2e3s

Description

@2e3s

After updating from 3.7.0 to 3.7.1 I get an error PHP Fatal error: Uncaught Psalm\Exception\UnpopulatedClasslikeException: Cannot check inheritance - 'Enterprise\Customers\TransactionHandler' has not been populated yet. You may need to defer this check to a later phase
I run it like ./psalm ../code --threads=1 --no-cache --find-dead-code=always --show-info=false (it works with a populated cache).
It might start to appear here d5f4c24 because since this I'm getting the error (found this commit quickly by a binary search).
Unfortunately, I cannot reproduce it otherwise than on a huge private codebase.
The problem exists on master as well. I will show a stacktrace on it since it's more useful

Scanning files...
Uncaught Psalm\Exception\UnpopulatedClasslikeException: Cannot check inheritance - 'Enteprise\Customers\TransactionHandler' has not been populated yet. You may need to defer this check to a later phase. in psalm/src/Psalm/Internal/Codebase/ClassLikes.php:499
Stack trace:
#0 psalm/src/Psalm/Codebase.php(736): Psalm\Internal\Codebase\ClassLikes->classExtends('Enteprise\\Custome...', 'Enteprise\\Custome...', true)
#1 psalm/src/Psalm/Internal/Type/TypeCombination.php(1013): Psalm\Codebase->classExtends('Enteprise\\Custome...', 'Enteprise\\Custome...')
#2 psalm/src/Psalm/Internal/Type/TypeCombination.php(196): Psalm\Internal\Type\TypeCombination::scrapeTypeProperties(Object(Psalm\Type\Atomic\TNamedObject), Object(Psalm\Internal\Type\TypeCombination), Object(Psalm\Codebase), false, true, 500)
#3 psalm/src/Psalm/Internal/Type/TypeCombination.php(522): Psalm\Internal\Type\TypeCombination::combineTypes(Array, Object(Psalm\Codebase))
#4 psalm/src/Psalm/Type.php(1564): Psalm\Internal\Type\TypeCombination::combineTypes(Array, Object(Psalm\Codebase), false, true, 30)
#5 psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(1922): Psalm\Type::combineUnionTypes(Object(Psalm\Type\Union), Object(Psalm\Type\Union), Object(Psalm\Codebase), false, true, 30)
#6 psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(3356): Psalm\Internal\Analyzer\StatementsAnalyzer::getSimpleType(Object(Psalm\Codebase), Object(Psalm\Internal\Provider\NodeDataProvider), Object(PhpParser\Node\Expr\Array_), Object(Psalm\Aliases), NULL, Array, 'Enteprise\\Custome...')
#7 psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(1307): Psalm\Internal\Visitor\ReflectorVisitor->visitClassConstDeclaration(Object(PhpParser\Node\Stmt\ClassConst), Object(Psalm\Storage\ClassLikeStorage), 'Enteprise\\Custome...')
#8 psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(280): Psalm\Internal\Visitor\ReflectorVisitor->registerClassLike(Object(PhpParser\Node\Stmt\Class_))
#9 psalm/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): Psalm\Internal\Visitor\ReflectorVisitor->enterNode(Object(PhpParser\Node\Stmt\Class_))
#10 psalm/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(114): PhpParser\NodeTraverser->traverseArray(Array)
#11 psalm/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(223): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Namespace_))
#12 psalm/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(91): PhpParser\NodeTraverser->traverseArray(Array)
#13 psalm/src/Psalm/Internal/Scanner/FileScanner.php(96): PhpParser\NodeTraverser->traverse(Array)
#14 psalm/src/Psalm/Internal/Codebase/Scanner.php(606): Psalm\Internal\Scanner\FileScanner->scan(Object(Psalm\Codebase), Object(Psalm\Storage\FileStorage), false, Object(Psalm\Progress\DefaultProgress))
#15 psalm/src/Psalm/Internal/Codebase/Scanner.php(389): Psalm\Internal\Codebase\Scanner->scanFile('/home/user/Phps...', Array, true)
#16 psalm/src/Psalm/Internal/Codebase/Scanner.php(497): Psalm\Internal\Codebase\Scanner->Psalm\Internal\Codebase\{closure}(1492, '/home/user/Phps...')
#17 psalm/src/Psalm/Internal/Codebase/Scanner.php(347): Psalm\Internal\Codebase\Scanner->scanFilePaths(1)
#18 psalm/src/Psalm/Codebase.php(474): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 1)
#19 psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(1057): Psalm\Codebase->scanFiles(1)
#20 psalm/src/psalm.php(555): Psalm\Internal\Analyzer\ProjectAnalyzer->checkPaths(Array)
#21 psalm/psalm(2): require_once('/home/user/Phps...')
#22 {main}
(Psalm 3.x-dev@389af1bfc739bfdff3f9e3dc7bd6499aee51a831 crashed due to an uncaught Throwable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions