Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-15 Thread Matthew Brown
On Mon, 15 Mar 2021 at 09:36, Nikita Popov wrote: > I'm not sure I follow your point. The fact that something is compatible, > does not mean that you can just blindly perform a forwarding call. For > example, consider this: > > class A { > public function method(string $x) {} > } > > class B

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-15 Thread Rowan Tommins
On 15/03/2021 13:16, Matthew Brown wrote: On Sun, 14 Mar 2021 at 18:09, Rowan Tommins > wrote: Are you saying that having the parent::getSomeInt() call fail would be problematic?  Yes, that's where this becomes unsound – you can call the child metho

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-15 Thread Nikita Popov
On Mon, Mar 15, 2021 at 2:16 PM Matthew Brown wrote: > On Sun, 14 Mar 2021 at 18:09, Rowan Tommins > wrote: > > > Are you saying that having the parent::getSomeInt() call fail would be > > problematic? > > > > > Yes, that's where this becomes unsound – you can call the child method > statically

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-15 Thread Matthew Brown
On Sun, 14 Mar 2021 at 18:09, Rowan Tommins wrote: > Are you saying that having the parent::getSomeInt() call fail would be > problematic? > > Yes, that's where this becomes unsound – you can call the child method statically, but the parent call assumes a dynamic instance. This is just my persp

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-14 Thread Alexandru Pătrănescu
On Sun, Mar 14, 2021 at 6:02 PM Gert de Pagter wrote: > Hey Internals, > > Recently i've been working on an older code base, where we have a lot > of classes with all > static methods. We've been moving to injecting the classes, and > calling the methods as if they > were not static. > > I wanted

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-14 Thread Rowan Tommins
On 14/03/2021 19:40, Matthew Brown wrote: It's maybe possible in the special case of implementing interfaces, but it's unsound for general inheritance: someInt; } } class B extends A { public static function getSomeInt() : int { return parent::getSomeInt(); } } Can yo

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-14 Thread Matthew Brown
On Sun, 14 Mar 2021 at 12:02, Gert de Pagter wrote: > Hey Internals, > > Recently i've been working on an older code base, where we have a lot > of classes with all > static methods. We've been moving to injecting the classes, and > calling the methods as if they > were not static. > > I wanted t