Skip to content
Advertisement

PHP Union Types with default value

I wanted to implement methods with union-type dependencies for the argument like so:

JavaScript

but it’s triggering an error

JavaScript

I looked through the documentation but there is no mention of this. Thanks in advance

Advertisement

Answer

You can add new type for other type hint:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement