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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to