psalm: Recent commit breaks psalm

Recently psalm stopped working, throwing

Uncaught Exception: InvalidArgumentException Could not get class storage for spaze\phpstan\rules\disallowed\allowed\allowdirectivesconfig
 Emitted in /.../vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:45 
.......

(Psalm dev-master@a4de6d9dc092d77871b6097af42498a192362e9a crashed due to an uncaught Throwable)

It is thrown on dozens of different repositories which have typehints or classes that are not present. In example above PHPAT surely has a problem, but it should not kill psalm, especially as psalm configuration has <ignoreFiles><directory name="../vendor"/>.

More so it’s thrown on libraries that have optional dependencies, in my case psalm throws the same error on Monolog for the ElasticSearch code (I don’t have elastic search as I don’t use it, but it’s supported by Monolog):

Uncaught Exception: InvalidArgumentException Could not get class storage for elastic\elasticsearch\response\elasticsearch
Emitted in /home/stelshevsky/work/projects/jefe/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:45

After requiring different psalm versions (./composer.phar require --dev vimeo/psalm:dev-master#a4de6d9dc092d77871b6097af42498a192362e9a --with-d ependencies), seems this commit causes this: https://github.com/vimeo/psalm/commit/a4de6d9dc092d77871b6097af42498a192362e9a

Any older version does not have this issue.

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 17

Most upvoted comments

Thank you, can no longer reproduce and big thanks for the tip on omitting the target folder

Actually took much less time: https://github.com/vlakarados/psalmtest

Composer update/install and

./vendor/bin/psalm --config=psalm.xml .

Uncaught Exception: InvalidArgumentException Could not get class storage for elastic\elasticsearch\response\elasticsearch
Emitted in /home/stelshevsky/work/sandbox/psalmtest/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:45

php -v
PHP 8.2.8 (cli) (built: Jul  8 2023 07:09:59) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies

Running in ubuntu in wsl2, though error appears in docker container as well (official image php:8.2-fpm)

image