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

clarify classes named after internal php types #10403

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

Conversation

dbu
Copy link

@dbu dbu commented Jan 8, 2024

put the answer from #10399 into the documentation

i guess for number and double, there is no workaround?

@stof
Copy link
Contributor

stof commented Jan 13, 2024

number is not an actual PHP type but a pseudo-type defined in phpstan (and psalm) meaning int|float. So the workaround is to use the union type directly if you have a Number class in the same namespace.

For double, PHP has 2 names for this internal type: double and float. So when you have a conflicting class in the same namespace, you can use the other name (if you have conflicting classes for both names, you are out of luck).

@dbu
Copy link
Author

dbu commented Jan 16, 2024

thanks @stof , i added your notes into the pull request.

@dbu
Copy link
Author

dbu commented Feb 9, 2024

@ondrejmirtes can you merge this? or do you have more feedback?

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.

None yet

2 participants