phpstan-src
phpstan-src copied to clipboard
DynamicFunctionReturnTypeExtension for the get_debug_type function.
Closes: https://github.com/phpstan/phpstan/issues/10558 Closes: https://github.com/phpstan/phpstan/issues/10585
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.
Looking at the failing checks, none of them seem to be genuinely caused by this change.
Please add a pattern-matching example-test and use it in rule-tests which emit errors before this PR and are expected to be fixed now
Please add a pattern-matching example-test and use it in rule-tests which emit errors before this PR and are expected to be fixed now
Updated the PR.
Error emitted before this PR: '20: Match expression does not handle remaining value: string'.
Updated to also specify the type in condition branches. This closes https://github.com/phpstan/phpstan/issues/10585 for me.
I have a question about TypeTraverser::map and TypeCombinator::union. I tried to replicate the code in GettypeFunctionReturnTypeExtension as it is a similar feature. However, when trying to combine:
'bool'|string(constant stringboolor any string) it gets normalized tostring'Namespace\ClassA'|'Namespace\ClassB'(constant strings with FQCN) it gets normalized toNamespace\ClassA|Namespace\ClassB
Is this expected? Can this be turned off? Are those considered equivalent?