Re: RFC: constructor argument promotion

From: Date: Wed, 07 Aug 2013 20:12:50 +0000
Subject: Re: RFC: constructor argument promotion
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi!

> https://wiki.php.net/rfc/constructor-promotion

1. From the first glance, it doesn't seem clear how this syntax would
interact with magic methods - i.e., if you have __get, would access to
$make call it? If not, it's rather un-intuitive since the property is
not defined in the class but magic method is not called.

2. What would happen with this code:

class Base { public __construct(public $f) {} }
class PublicBase extends Base {
  public __construct($param) { __parent::__construct($param); }
}

class Child extends PublicBase { public __construct(public $f) {
$this->f = 42; parent::__construct($f); } }

Note here that whoever writes class Child may not be aware that class
Base even exists and how it is implemented, since he implements against
PublicBase.

3. What happens if I need to have some arguments that are not properties?

4. How would one extract phpdoc descriptions for such properties?
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227


Thread (18 messages)

« previous php.internals (#68402) next »