Re: [RFC] Fix inconsistent behavior of $this variable
| From: | Christoph Becker | Date: | Tue, 31 May 2016 17:21:38 +0000 |
| Subject: | Re: [RFC] Fix inconsistent behavior of $this variable | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93657@lists.php.net to get a copy of this message | ||
On 31.05.2016 at 18:55, Fleshgrinder wrote:
> On 5/31/2016 6:39 PM, Dmitry Stogov wrote:
>>
>> $this is still confirm to variable syntax. It's just a special variable.
>> I think, we should keep lexical rules unchanged.
>
> TL;DR $this does conform to syntax but not to basic PHP userland rules
> for variable naming (what the manual page is about).
I agree with Dmitry here. While the page is about variables, the
paragraph is about variable names, and it is already noted there that:
| $this is a special variable that can't be assigned
In other sections of the manual, $this is described as
pseudo-variable. However, it is still a variable, even though it
can't be assigned to – I think of it as read-only (final) variable.
Hence, it shouldn't be excluded from the valid variable names.
--
Christoph M. Becker