> On Dec 3, 2025, at 15:09, Rob Landers <[email protected]> wrote:
>
> On Wed, Dec 3, 2025, at 22:04, Paul M. Jones wrote:
>>
>>
>> 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
>
>
> They fundamentally cannot be autoloaded because autoloading happens at
> runtime, not compile time. At least, with the current autoloader. Autoloading
> type aliases would need to have a fundamentally different type of autoloading
> that doesn’t exist today.
Got it; thanks for the clarification.
-- pmj