Skip to content

Add Type::isScalar()#2149

Merged
ondrejmirtes merged 3 commits intophpstan:1.9.xfrom
herndlm:add-is-scalar
Dec 28, 2022
Merged

Add Type::isScalar()#2149
ondrejmirtes merged 3 commits intophpstan:1.9.xfrom
herndlm:add-is-scalar

Conversation

@herndlm
Copy link
Copy Markdown
Contributor

@herndlm herndlm commented Dec 27, 2022

Returns yes for bool, float, int or string only. I found myself in need of something like that in the filter_var() extension. The alternative would be to combine isBoolean(), isFloat(), isInteger() and isString() of course, but that feels somehow wrong too.

@herndlm herndlm requested a review from ondrejmirtes December 28, 2022 12:51
@ondrejmirtes ondrejmirtes merged commit 1e7b58a into phpstan:1.9.x Dec 28, 2022
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you!

@herndlm herndlm deleted the add-is-scalar branch December 28, 2022 12:55
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.

3 participants