Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Erick de Azevedo Lima
I'll use it a lot if they'll be namespaced. It avoids name-collision using the existing ecosystem and we already use lots of "uses" in our codes. When Enums came to the party, they came namespaced as traits, classes and interfaces. The last 2 represent types, concrete and abstract. User defined

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Oladoyinbo Vincent
Since there may be need for reusability, I feel it can have this kind of structure: // File: A.php ``` namespace A; typedef TypeLists { type Msg = string|null; type Numeric = int|float; type MyClass = \Package\Test|\Package\Db; } ``` // file: B.php ```

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Deleu
On Thu, Oct 26, 2023 at 4:23 PM Larry Garfield wrote: > On Thu, Oct 26, 2023, at 6:37 AM, Oladoyinbo Vincent wrote: > > App-wide aliases run into the autoloading problem. If the engine runs > across the add() function above, and "numeric" isn't defined, what can it > do? Currently, all it can

[PHP-DEV] Basic Type Alias

2023-10-26 Thread Oladoyinbo Vincent
Greetings to you all, I will like to submit an RFC on introducing type alias to php. Even though Generics won't or never be introduced to PHP, personally i will like php to add the type alias feature. Type aliases provide a mechanism to create more descriptive and readable type hints in PHP

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Robert Landers
On Thu, Oct 26, 2023 at 8:37 AM Oladoyinbo Vincent wrote: > > Greetings to you all, > > I will like to submit an RFC on introducing type alias to php. > > Even though Generics won't or never be introduced to PHP, personally i will > like php to add the type alias feature. > > Type aliases provide

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Saki Takamachi
Hi, It seems to me that there is more to lose than gain. I'm afraid that when we look at the signature, we'll be confused as to whether it's a class or a type. Even if these problems were successfully resolved, I feel that it would only reduce readability. I've never seen a union type complex

[PHP-DEV] PHP 8.3.0RC5 available for testing

2023-10-26 Thread Jakub Zelenka
PHP 8.3.0RC5 has just been released and may be downloaded from https://downloads.php.net/~jakub/ Or use the git tag: php-8.3.0RC5 Windows binaries are available at: https://windows.php.net/qa/ Please test it carefully, and report any bugs at https://github.com/php/php-src/issues The second

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Lanre Waju
Hi Saki, I will have to disagree as the convenience doesn't come from the complexity of union types, rather how many times its used. Its easier to use ConstantNode in 10 functions vs NodeA|NodeB|NodeC. On 2023-10-26 6:58 a.m., Saki Takamachi wrote: Hi, It seems to me that there is more to

[PHP-DEV] PHP 8.2.12 Released!

2023-10-26 Thread Pierrick Charron
The PHP development team announces the immediate availability of PHP 8.2.12. This is a bugfix release. All PHP 8.2 users are encouraged to upgrade to this version. For source downloads of PHP 8.2.12 please visit our downloads page. Windows binaries can be found on the PHP for Windows site. The

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Lanre Waju
I would like to voice my support for this and i'm willing to help with the implementation. As for differentiating between type aliases and classnames, only one of them can be instantiated. Lanre On 2023-10-26 12:37 a.m., Oladoyinbo Vincent wrote: Greetings to you all, I will like to submit

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Aleksander Machniak
On 26.10.2023 08:37, Oladoyinbo Vincent wrote: type MyType = string|null; function greetings(MyType $message): string { // Implementation } greetings(1); // TypeError When writing RFC you'd have to decide/clarify whether you want this to be an error in strict_types mode only or not.

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Marc
Hi, On 26.10.23 08:37, Oladoyinbo Vincent wrote: Greetings to you all, I will like to submit an RFC on introducing type alias to php. Even though Generics won't or never be introduced to PHP, personally i will like php to add the type alias feature. Type aliases provide a mechanism to create

Re: [PHP-DEV] Basic Type Alias

2023-10-26 Thread Larry Garfield
On Thu, Oct 26, 2023, at 6:37 AM, Oladoyinbo Vincent wrote: > Greetings to you all, > > I will like to submit an RFC on introducing type alias to php. > > Even though Generics won't or never be introduced to PHP, personally i will > like php to add the type alias feature. > > Type aliases provide