Skip to content

Conversation

@mamazu
Copy link

@mamazu mamazu commented Oct 4, 2019

The problem

The implementation for the implementsInterface only works if the first argument is an object If not then it returns implementsInterface always returns false according to the plugin.

The proposed solution

This is my first attempt in fixing it by adding a get_class for the string and see what happens.

The build is currently not working but I know why.

@mamazu
Copy link
Author

mamazu commented Nov 28, 2019

@ondrejmirtes Could you review this please?

@ondrejmirtes
Copy link
Member

Hi, I have no idea how this could work because PHPStan does not have any dynamic return type extension for class_implements.

@mamazu
Copy link
Author

mamazu commented Nov 28, 2019

Then we need to remove it entirely. Because the current implementation does not reflect what webmozart's function does.

@ondrejmirtes
Copy link
Member

No, we just need to find a different fix.

@mamazu
Copy link
Author

mamazu commented Nov 29, 2019

What do you think of. Currently I have a project that can't use the most recent version of the package because of this bug. I only see two possible options:

Either exclude the case string, string from being checked and just check for classes and strings. Or do something along the lines of trying to check if the class strings. Do match, however this is probably not possible as one of the values is probably resolved at runtime. So it would be as effective as not checking it at all.

@mamazu mamazu deleted the string_fix branch November 29, 2019 08:50
@ondrejmirtes
Copy link
Member

It's solvable but I current have other priorities, like getting PHPStan 0.12 out the door. If you learn how TypeSpecifier extensions work, you can also come up 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

Successfully merging this pull request may close these issues.

2 participants