Skip to content

Fix PHPDoc generics for isInstanceOfAny#358

Merged
shadowhand merged 1 commit into
webmozarts:masterfrom
trearcul:fix-isInstanceOfAny-generics-annotation
May 17, 2026
Merged

Fix PHPDoc generics for isInstanceOfAny#358
shadowhand merged 1 commit into
webmozarts:masterfrom
trearcul:fix-isInstanceOfAny-generics-annotation

Conversation

@trearcul
Copy link
Copy Markdown
Contributor

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>
@shadowhand shadowhand merged commit ea4ed4b into webmozarts:master May 17, 2026
9 checks passed
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