Re: Constructor promoted property and default value
| From: | Pierre | Date: | Mon, 23 Oct 2023 15:39:34 +0000 |
| Subject: | Re: Constructor promoted property and default value | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121447@lists.php.net to get a copy of this message | ||
Le 23/10/2023 à 17:35, Saki Takamachi a écrit :
Hi, Pierre You may have overlooked the existence of the magic methodIf I understand your use case properly, you should be confused by properties with default values that are not constructor-promoted as well ? Am I wrong ? In this case, your problem is not with promoted properties ? Regards, -- Pierre__unserialize(). Constructor is not the only way to create instances. When rebuilding a serialized object, you may need the initial values of properties. This can easily happen if you are using rolling updates and using Redis. The constructor is not called if__unserialize()is called. In this case, defining the initial value of a property as an argument to a constructor that is never called confuses us. Regards. Saki