Skip to content

Replace deprecated $type instanceof ConstantStringType#150

Merged
szepeviktor merged 7 commits intoszepeviktor:masterfrom
IanDelMar:instanceof
Feb 24, 2023
Merged

Replace deprecated $type instanceof ConstantStringType#150
szepeviktor merged 7 commits intoszepeviktor:masterfrom
IanDelMar:instanceof

Conversation

@IanDelMar
Copy link
Copy Markdown
Contributor

@IanDelMar IanDelMar commented Feb 24, 2023

This PR replaces some of the deprecated $type instanceof ConstantStringType by

if (count($type->getConstantStrings()) === 0) {}

foreach ($type->getConstantStrings() as $constantString) {}

as suggested in Why Is instanceof *Type Wrong and Getting Deprecated?.

Part of #149

@szepeviktor
Copy link
Copy Markdown
Owner

szepeviktor commented Feb 24, 2023

Ian, this is like a gift to me.

Thank you.

@szepeviktor szepeviktor merged commit 5c6c6c4 into szepeviktor:master Feb 24, 2023
@IanDelMar IanDelMar deleted the instanceof branch February 25, 2023 01:25
@herndlm
Copy link
Copy Markdown
Contributor

herndlm commented Feb 25, 2023

👍

@herndlm
Copy link
Copy Markdown
Contributor

herndlm commented Feb 25, 2023

And this also gives us support for more union type scenarios as discussed recently. Thx! I also had this on my list but didn't find time yet :)

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