X Tutup
Skip to content

clarify classes named after internal php types#10403

Open
dbu wants to merge 1 commit intophpstan:1.11.xfrom
dbu:patch-1
Open

clarify classes named after internal php types#10403
dbu wants to merge 1 commit intophpstan:1.11.xfrom
dbu:patch-1

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.

2 participants

X Tutup