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

Odd PhanEmptyFQSENInClasslike error when an intersection type is the object in an array callable #4851

Open
anomiex opened this issue Apr 12, 2024 · 0 comments

Comments

@anomiex
Copy link

anomiex commented Apr 12, 2024

Phan version: 5.4.3, v5.x-dev 790e4f7

Reproduction

  1. Create the following file:
     <?php
    
     interface A {}
     interface B {}
    
     function foo( A&B $var ): bool {
         return is_callable( [ $var, 'func' ] );
     }
  2. Do phan --init, then run phan on the file.

Expected results

No issues reported. Or possibly one about method "func" not being known to exist on any of the types involved.

Actual results

This strange issue is reported.

test.php:7 PhanEmptyFQSENInClasslike Possible use of a classlike '\' with an empty FQSEN.

Other notes

This also happens if the types are declared via phpdoc or by @phan-var.

If you instead do like

$var2 = [ $var, 'func' ];
is_callable( $var2 );

it doesn't report the unexpected PhanEmptyFQSENInClasslike issue. But I think that may be because it's not really checking $var2 at all rather than that it's doing the right thing with it.

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