Re: Basic Type Alias

From: Date: Thu, 26 Oct 2023 16:56:33 +0000
Subject: Re: Basic Type Alias
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-121472@lists.php.net to get a copy of this message
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. For example, here int could be cast to string in non-strict types mode. -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com

« previous php.internals (#121472) next »