Re: [RFC][Vote] Typed Properties
| From: | Benoit Schildknecht | Date: | Wed, 25 May 2016 20:23:28 +0000 |
| Subject: | Re: [RFC][Vote] Typed Properties | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93528@lists.php.net to get a copy of this message | ||
Le Wed, 25 May 2016 21:40:28 +0200, Fleshgrinder <php@fleshgrinder.com> a écrit:
and unset simply because the property is not explicitly assigned null by unset, it is being undefined.Because null !== undefined. That's why you get an error after an unset($this->var), and you don't get one after $this->var = null; . "$var = null;" and "unset($var)" are totally different, it has been like that for years. If you want to change this behavior, propose an RFC, and make it approve. But meanwhile, you'll have to keep this in mind : "null" is a value. While "unset" does not affect a value, it deletes the variable, it deletes any references of the variable it targets, the variable doesn't exist anymore. With unset, the variable is dead. With null, it has amnesia. I can't find any better analogy.