Closed kkmuffme closed 2 years ago
No
Are you using ResourceBundle somewhere in your code? Could you check if it's properly cased or not if you do?
Could you run with --debug-by-line and copy/paste the few lines surrounding the last location it shows?
Are you using ResourceBundle somewhere in your code?
No.
Could you run with --debug-by-line
Done. The last line before the "Uncaught:" is "some-of-my-files.php:288" If I check this file in my code base, this is the code there:
if ( count( $matches ) === 1 ) {
which is the "count" we see in initial stack trace #4
above. It seems the "count" triggers this issue, as I don't get the error when I remove all "count" from my file.
This PR: https://github.com/vimeo/psalm/pull/8217/files removed ResourceBundle from the list of types accepted in count starting from PHP8. It seems clearly related but I have no idea why Psalm would behave like that
In case it helps: the value of $matches
in the count above is from $matches = preg_grep(
Could you push a PR that reverts that change: https://github.com/vimeo/psalm/pull/8217/files#diff-b8eaee1f550652657daf0a771be5e785bdb01e91acd004b4bbb4c41def706713R1546 and add a test?
I'm not sure why it would crash like that but it's not needed for anything, it shouldn't hurt to revert it
We upgraded to PHP8.1 bc of this bug. Added a PR for it now anyway for other people
For future reference, this is probably because ResourceBundle
comes from the intl
extension. I would guess if that extension were installed the crash would stop happening.
We should avoid referencing extension-declared classes in the callmap (except in the case where a function from an extension uses a class declared by the same extension).
Get similar error, but for predis\client
Could not get class storage for predis\client
at /docker/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:46
42▕ public function get(string $fq_classlike_name): ClassLikeStorage
43▕ {
44▕ $fq_classlike_name_lc = strtolower($fq_classlike_name);
45▕ if (!isset(self::$storage[$fq_classlike_name_lc])) {
➜ 46▕ throw new InvalidArgumentException('Could not get class storage for ' . $fq_classlike_name_lc);
47▕ }
48▕
49▕ return self::$storage[$fq_classlike_name_lc];
50▕ }
When I run --alter: EDIT: seems to be there without --alter too
php /opt/composer/vendor/bin/psalm --config=my-rules.xml --alter --plugin=vendor/orklah/psalm-strict-equality/src/Plugin.php --php-version=7.4 my-file.php
When I do
--php-version=8.0
or--php-version=8.1
I don't get an error. For everythint <= 7.4 I get this error.