Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninterpreted class alias #11197

Open
emmanuelGuiton opened this issue Jan 8, 2025 · 1 comment
Open

Uninterpreted class alias #11197

emmanuelGuiton opened this issue Jan 8, 2025 · 1 comment

Comments

@emmanuelGuiton
Copy link
Contributor

When the 1.3.6 version of yohang/finite war released, Psalm started to emit errors such as :

ERROR: MissingDependency - sources/StateMachine.php:520:74 - Finite\Event\TransitionEvent depends on class or interface symfony\component\eventdispatcher\event that does not exist (see https://psalm.dev/157)
                $this->getDispatcher()->addListener('finite.post_transition', function(TransitionEvent $e) {

When comparing the 1.3.5 and 1.3.6 versions yohang/Finite@1.3.5...1.3.6
One can notice this change :

- if (!class_exists('Symfony\Contracts\EventDispatcher\Event')) {
+ if ((!is_subclass_of('Symfony\Component\EventDispatcher\EventDispatcher', 
+ 'Symfony\Contracts\EventDispatcher\EventDispatcherInterface'))) {
+     class_alias('Symfony\Component\EventDispatcher\Event', 'Symfony\Contracts\EventDispatcher\Event');
+ }

So it seems that Psalm fails to see that the Symfony\Component\EventDispatcher\Event class is in fact an alias towards an existing class which is Symfony\Contracts\EventDispatcher\Event

Copy link

Hey @emmanuelGuiton, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant