Re: [PHP-DEV] [RFC] Deprecate dynamic properties

This is only part of a thread. view whole thread
  115841
August 25, 2021 22:47 the.liquid.metal@gmail.com (Hendra Gunawan)
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.