Re: [RFC] Deprecate dynamic properties
| From: | Hendra Gunawan | Date: | Wed, 25 Aug 2021 22:47:08 +0000 |
| Subject: | Re: [RFC] Deprecate dynamic properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115841@lists.php.net to get a copy of this message | ||
Hi.
A chunk in the RFC:
abstract class Constraint {
public $groups;
public function __construct() {
unset($this->groups);
}
public function __get($name) {
// Will get called on first access, but once initialized.
$this->groups = ...;
}
}
Interesting! new to me.
Maybe someday we will have this one:
abstract class Constraint {
public lazy $groups;
public function __construct() {
// no need to do this:
// unset($this->groups);
}
public function __get($name) {
// Will get called on first access, but once initialized.
$this->groups = ...;
}
}
Regards,
Hendra Gunawan.