Re: [VOTE] Automatic Property Initialization
| From: | Joe Watkins | Date: | Sun, 02 Feb 2014 09:31:30 +0000 |
| Subject: | Re: [VOTE] Automatic Property Initialization | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71980@lists.php.net to get a copy of this message | ||
Morning internalz,
Some clarity ...
Johannes:
it there seems to be a design flaw around inheritance with code like
this:
class Base { public $p; function __construct($this->p = 42); }
Class E extends Base { function __construct($this->p = 23) { parent::__construct(); }
Assuming you meant to declare Base::__construct abstract: L1946 zend_compile.c:new E;
zend_error(E_COMPILE_ERROR, "Automatic property initialization can not be used in an abstract method");
leading to probably unexpected results ... also
class C { public function m($foo->prop){}}
L1933 zend_compile.c:
zend_error(E_COMPILE_ERROR, "Property name can only be prefixed by $this->");Having reviewed the discussion, and played with the patch, I see no genuine objection. Cheers Joe