Re: "Cannot use $this as lexical variable" message still in PHP 5.4
| From: | Etienne Kneuss | Date: | Sat, 07 Jan 2012 14:16:36 +0000 |
| Subject: | Re: "Cannot use $this as lexical variable" message still in PHP 5.4 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57265@lists.php.net to get a copy of this message | ||
Hi,
On Jan 7, 2012 10:41 AM, "Sebastian Bergmann" <sebastian@php.net> wrote:
>
> Am 07.01.2012 10:34, schrieb Stas Malyshev:
> > Why you need to add $this there? $this should be available automatically
> > IIRC unless you make the closure static.
>
> That is not the point I wanted to make. Explicitly listing $this in
> use() should not trigger a compiler error, IMHO.
To me it seems similar to assigning $this, only here it is via special
closure syntax. Since this code is no longer necessary, and might conflict
with the rebinding of $this, the error makes sense IMHO.
>
> I just wanted to make sure that it was not an oversight to not remove
> the error message.
>
> --
> Sebastian Bergmann Co-Founder and Principal Consultant
> http://sebastian-bergmann.de/
> http://thePHP.cc/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>