Re: Remove $this from incompatible context
| From: | Rowan Collins | Date: | Thu, 12 Feb 2015 16:45:43 +0000 |
| Subject: | Re: Remove $this from incompatible context | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82544@lists.php.net to get a copy of this message | ||
Nikita Popov wrote on 12/02/2015 14:24:
Hi internals, As part of [1] and [2] we have decided to remove support for doing static calls to instance methods, if this would result in an incompatible $this variable to be used. When applying [3] this change we found that the change as originally intended may be too strict.[snip]
The compromise I'd like to implement instead is to only throw a fatal error if $this is actually used in the called method and otherwise throw a deprecation warning. Calls from instance methods, static methods and functions will all be handled the same.[snip] I'm definitely in favour of this over completely forbidding such calls. The only thing I'd question is the use of E_DEPRECATED when the static call doesn't use $this. Is there actually any intent to change the behaviour in a future version? What is the advantage to doing so? It strikes me as rather like the case of "var" for properties, which had the deprecation notice removed. I think it would make more sense to raise an E_STRICT, since the main purpose seems to be to discourage users making such calls. Regards, -- Rowan Collins [IMSoP]