On Thu, Feb 12, 2015 at 5:45 PM, Rowan Collins <rowan.coll...@gmail.com> wrote:
> 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. > The reason is that previously it was using E_DEPRECATED in some places and E_STRICT in others. I'd like to have a consistent error level in all cases, so using E_DEPRECATED everywhere (I am not willing to downgrade existing deprecations to strict warnings). And yes, I'm pretty sure there is intent to remove this completely in the future - this is just another leftover from PHP 4. The approach outlined here only avoids dropping support in PHP 7 already (which the original patch did for all practical purposes). Nikita