psalm-plugin-laravel: Could not get class storage for eloquent
Describe the bug
Running Psalm with --debug-by-line on a Laravel 8 project I get:
/var/www/html/app/Models/User.php:1
Exception
Could not get class storage for eloquent
Stack trace in the forked worker:
#0 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(750): Psalm\Internal\Provider\ClassLikeStorageProvider->get('Eloquent')
#1 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(394): Psalm\Internal\Analyzer\ClassAnalyzer::addContextProperties(Object(Psalm\Internal\Analyzer\ClassAnalyzer), Object(Psalm\Storage\ClassLikeStorage), Object(Psalm\Context), 'App\\Models\\Mapp...', 'Illuminate\\Data...', Array)
#2 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(213): Psalm\Internal\Analyzer\ClassAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Context))
#3 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(343): Psalm\Internal\Analyzer\FileAnalyzer->analyze(NULL)
#4 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(193): Psalm\Internal\Codebase\Analyzer->Psalm\Internal\Codebase\{closure}(5, '/var/www/html/a...')
#5 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(409): Psalm\Internal\Fork\Pool->__construct(Array, Object(Closure), Object(Closure), Object(Closure), Object(Closure))
#6 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 5)
#7 /var/www/html/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(636): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 5, false, true)
#8 /var/www/html/vendor/vimeo/psalm/src/psalm.php(700): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/var/www/html/', true)
#9 /var/www/html/vendor/vimeo/psalm/src/psalm.php(884): Psalm\{closure}(Array)
#10 /var/www/html/vendor/vimeo/psalm/psalm(2): require_once('/var/www/html/v...')
#11 {main}
Ofc I have the issue also without --debug-by-line.
Impacted Versions
barryvdh/laravel-debugbar v3.5.7
barryvdh/laravel-ide-helper v2.9.1
fruitcake/laravel-cors v2.0.4
laravel/framework v8.44.0
laravel/sail v1.7.0
laravel/tinker v2.6.1
psalm/plugin-laravel v1.4.5
spatie/laravel-ray 1.18.0
vimeo/psalm 4.7.3
Additional context
User.php is the standard user class that comes with every fresh new project.
I tried to remove psalm and psalm/plugin-laravel, clear the cache, and I get the same Could not get class storage for eloquent in other parts of the codebase, for example
/var/www/html/tests/Feature/Models/Mapper/v1/TestCase.php:1
I’m stuck with this.
Edit: I forgot to mention that I’m on php 8.0.3
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (5 by maintainers)
I’m afraid I can’t really help without a reproducer – I haven’t run into this specific issue at all
@mr-feek FYI I’m still experiencing the same issue with da4e6bc: