-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Description
https://psalm.dev/r/78e3962d20
Real world example: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Cache/Traits/RedisTrait.php#L548-L553
Uncaught InvalidArgumentException: Could not get class storage for predis\connection\aggregate\clusterinterface in /vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:43
Triggered by:
psalm/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php
Lines 766 to 776 in 6abce35
| || $codebase->classImplements( | |
| $iterator_atomic_type->value, | |
| 'Traversable' | |
| ) || | |
| ( | |
| $codebase->interfaceExists($iterator_atomic_type->value) | |
| && $codebase->interfaceExtends( | |
| $iterator_atomic_type->value, | |
| 'Traversable' | |
| ) | |
| )) |
Potential fix (wrap in try/catch, return false in case subject class does not exist):
| $class_storage = $this->classlike_storage_provider->get($fq_class_name); |
Reactions are currently unavailable