This will be my last reply to this thread. Fundamentally:
class User {
public ?int $id;
public ?string $preferred_name;
public ?string $username;
}
^ This permits null properties at all times. This is acceptable
behavior if null is valid for the domain. It is not valid for this
domain -- all 3 are required.
class User {
public int $id;
public string $preferred_name;
public string $username;
}
^ This never permits null properties, and using them without
initializing them is an error, and you get notified by the runtime
that such a thing happened. This is good and desirable behavior.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php