vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.51k stars 654 forks source link

Uncaught InvalidArgumentException: Could not get class storage for unhandledmatcherror #9306

Open cristicotet opened 1 year ago

cristicotet commented 1 year ago
psalm: Target PHP version: 8.2 (inferred from current PHP version) Enabled extensions: dom, mysqli.
Scanning files... 
Analyzing files...  

Uncaught InvalidArgumentException: Could not get class storage for unhandledmatcherror in phar://C:/Tools/bin/psalm.phar/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:39
Stack trace: 
#0 phar://C:/Tools/bin/psalm.phar/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php(177): Psalm\Internal\Provider\ClassLikeStorageProvider->get('UnhandledMatchE...') 
#1 phar://C:/Tools/bin/psalm.phar/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php(124): Psalm\Internal\Analyzer\ClassLikeAnalyzer::checkFullyQualifiedClassLikeName(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), 'UnhandledMatchE...', Object(Psalm\CodeLocation), 'Software\\E...', 'software\\e...', Array)

The class UnhandledMatchError is defined in package symfony/polyfill-php80 vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php

if (\PHP_VERSION_ID < 80000) {
    class UnhandledMatchError extends Error
    {
    }
}
composer why symfony/polyfill-php80                                               
php-http/client-common 2.6.0  requires symfony/polyfill-php80 (^1.17) 
sentry/sentry          3.13.1 requires symfony/polyfill-php80 (^1.17)
composer why sentry/sentry         
sentry/sdk 3.3.0 requires sentry/sentry (^3.9) 
composer why sentry/sdk   
software/name-removed dev-main requires sentry/sdk (^3.3) 
psalm-github-bot[bot] commented 1 year ago

Hey @cristicotet, can you reproduce the issue on https://psalm.dev ?

ohader commented 8 months ago

@cristicotet None one the packages you mentioned seems to relevant for UnhandledMatchError. Please run psalm with the --debug option again, and try to identify the last file/class that is potentially causing this error.