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

False positive with aliased interfaces #10023

Closed
mad-briller opened this issue Oct 17, 2023 · 3 comments
Closed

False positive with aliased interfaces #10023

mad-briller opened this issue Oct 17, 2023 · 3 comments

Comments

@mad-briller
Copy link
Contributor

mad-briller commented Oct 17, 2023

Bug report

Aliased interfaces are not handled properly when performing type comparisons

Can't reproduce in playground due to use of bootstrapFiles but here is a repro:

https://github.com/mad-briller/phpstan-alias-repro

Running php vendor/bin/phpstan causes the following unexpected error:

=> php vendor/bin/phpstan
Note: Using configuration file /home/brad.miller/code/phpstan-alias-repo/phpstan.neon.dist.
 5/5 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------
  Line   test.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------
  12     Parameter #1 $impl of method Madbriller\PhpstanRepro\Consumer::call() expects Madbriller\PhpstanRepro\InterfaceExists, Madbriller\PhpstanRepro\Impl given.
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------


 [ERROR] Found 1 error

However running php src/test.php prints "reached".

Code snippet that reproduces the problem

No response

Expected output

I would expect no error as the code runs correctly

Did PHPStan help you today? Did it make you happy in any way?

Everyday!

@mergeable
Copy link

mergeable bot commented Oct 17, 2023

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

Adopted regression test: c1a0c97
Fix: phpstan/phpstan-src@d5c599c

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants