Why are we reinventing alias syntax? We already have "use" to alias per file:
use My\Namespace\MyFancyType as MyNewFancyType;
use string|int|bool as MyFancyType;
Further, in PHP we specify a type using a colon, not an equal sign,
thus this feels more idiomatic to PHP (and less ambiguous):
type MyFancyType: string|int|bool;
or using existing functionality for creating aliases for types:
class_alias('string|int|bool', 'My\Namespace\MyFancyType');
However,
type MyFancyType = string|int|bool;
immediately makes me think of the consts "string", "int", and "bool"
being bitwise-OR'ed together, and not a type. The only hint that we're
dealing with types is the `type` keyword.
Robert Landers
Software Engineer
Utrecht NL
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php