Re: [RFC] Type Aliases
| From: | Paul M. Jones | Date: | Wed, 03 Dec 2025 21:04:58 +0000 |
| Subject: | Re: [RFC] Type Aliases | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129529@lists.php.net to get a copy of this message | ||
Hi Rob,
(We've been using a lot of PHPStan type aliasing lately in the Star-Interop work, so this topic
is timely.)
Is there some possibility of making the aliases more classlike so they can be autoloaded? A la:
namespace Foo;
type number { as int|float; }
Then elsewhere:
use Foo\number;
function sum(number $a, number $b): number { return $a + $b; }
Let me know if I've missed something fundamental.
-- pmj