Re: 'Uninitialized' creates a lot of cluttering
| From: | naitsirch at e dot mail dot de | Date: | Wed, 08 Feb 2023 16:04:10 +0000 |
| Subject: | Re: 'Uninitialized' creates a lot of cluttering | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119489@lists.php.net to get a copy of this message | ||
Am 08-Feb-2023 15:59:02 +0100 schrieb tekiela246@gmail.com:
> When using typed properties, the language cannot use NULL as the default
> anymore because the type might not allow NULL, e.g public string $name
> allows only string values.
Would it make sense to make "null" the default value for nullable properties at least?
So that one could write
class Test {
public ?string $name;
}
var_dump((new Test())->name); // null
Best regards
Christian