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

Open
wants to merge 1 commit into
base: 1.11.x
Choose a base branch
from

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

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?

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