Em dom, 23 de set de 2018 às 13:09, Larry Garfield <la...@garfieldtech.com>
escreveu:

> 3) Object properties may be type hinted and the class author has until the
> end
> of the constructor to make sure they're fulfilled, otherwise TypeError on
> the
> spot (what I'm proposing).
>

Item 3 could not be enough, for instance:

<<<
class Example {
    public /* string */ $string;
    public function __construct() { static:: stringParameter
($this->string); }
    public static function stringParameter(string $string) {}
}

new Example;
>>>

It will fail because __construct() uses an uninitialized non-nullable
property.

Maybe it should throw a new Exception like UninitializedPropertyException
when you try to read a uninitialized property like this case.



-- 
David Rodrigues

Reply via email to