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

DynamicFunctionReturnTypeExtension for the get_debug_type function. #2910

Merged
merged 1 commit into from
May 30, 2024

Conversation

patrickkusebauch
Copy link
Contributor

@patrickkusebauch patrickkusebauch commented Feb 10, 2024

@phpstan-bot
Copy link
Collaborator

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.

@patrickkusebauch patrickkusebauch force-pushed the 1.11.x branch 3 times, most recently from 61be403 to 1e360f4 Compare February 10, 2024 22:33
@patrickkusebauch
Copy link
Contributor Author

patrickkusebauch commented Feb 10, 2024

Looking at the failing checks, none of them seem to be genuinely caused by this change.

@staabm
Copy link
Contributor

staabm commented Feb 11, 2024

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

@patrickkusebauch
Copy link
Contributor Author

patrickkusebauch commented Feb 12, 2024

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'.

@patrickkusebauch patrickkusebauch force-pushed the 1.11.x branch 2 times, most recently from 17d6626 to 4c1b0cb Compare February 12, 2024 17:03
Conditional type specifier for `get_debug_type` function.
@patrickkusebauch
Copy link
Contributor Author

Updated to also specify the type in condition branches. This closes phpstan/phpstan#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 string bool or any string) it gets normalized to string
  • 'Namespace\ClassA'|'Namespace\ClassB' (constant strings with FQCN) it gets normalized to Namespace\ClassA|Namespace\ClassB

Is this expected? Can this be turned off? Are those considered equivalent?

@ondrejmirtes ondrejmirtes merged commit 57b6434 into phpstan:1.11.x May 30, 2024
429 of 432 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants