Hello Internals, I'm going to try something new. I've been working on another RFC called "Typed Aliases" (https://wiki.php.net/rfc/typed-aliases). It is very much a draft and in-flux, and I've already worked out the technical mechanics of it ... however, I am very unhappy with the syntax, and while I have a few ideas about that; I assume this list will be much better at it than me. So, please bring your brushes and paint; I brought a bikeshed.
If you haven't read it already, here's the TL;DR: - This RFC expands the "use ... as ..." syntax to allow any type expression on the left side. These aliases are PER FILE and expire once the file is compiled. - This RFC also adds the ability for an alias to survive a file (currently using the "as alias" syntax that I don't like) which actually just creates a special kind of class. When this special class is encountered during type-checking, the alias is expanded and checked. It also allows this via a "type_alias()" function instead of the "use ... as alias ..." syntax. How it works: use string as alias MyString gets virtually compiled into a special class that would look something like this to ReflectionClass (as it is currently): class MyString extends PrimitiveAlias { const PrimitiveType aliasOf = PrimitiveType::string; } - Reflection is a bit weird here, and I'm not exactly happy with it; but I'm curious what the list thinks. I'm open to virtually anything that makes sense here; including not allowing ReflectionClass on the type aliases at all. - Since these are "technically" classes, I went with just "use"-ing them like normal classes. Originally, I had something different: "use alias ..." (like "use function ...") to make it more clear. I will probably go back to this, but I'm curious what others think. I'm going to take a step back and listen/answer questions. But please, grab a brush and paint. — Rob