Skip to content

Fix PHPDoc generics for isInstanceOfAny#358

Open
trearcul wants to merge 1 commit into
webmozarts:masterfrom
trearcul:fix-isInstanceOfAny-generics-annotation
Open

Fix PHPDoc generics for isInstanceOfAny#358
trearcul wants to merge 1 commit into
webmozarts:masterfrom
trearcul:fix-isInstanceOfAny-generics-annotation

Conversation

@trearcul
Copy link
Copy Markdown

Originally, the method used @param T $value, which already implied the asserted type and therefore did not provide any type narrowing through @psalm-assert. By changing the parameter type to mixed and typing $classes param, static analyzers can now correctly understand and infer the asserted object type.

Original behavior - https://phpstan.org/r/7f96122b-fa81-4578-a4df-04aaa9154cd3
After the fix - https://phpstan.org/r/2cac2398-0028-4e34-9aa1-71250f5cc888

Signed-off-by: trearcul <pavel.vondrak@hotmail.cz>
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.

1 participant