Re: [PHP-DEV] Allow "static" type

2017-01-28 Thread Wes
I completely agree with what you said. Static inheritance is wrong. Static members shouldn't be inherited. This is what I think and probably what you think too. But it's too late to fix this. I don't think it's worth changing the expectations of the users, which rely on inherited members to be

Re: [PHP-DEV] Allow "static" type

2017-01-28 Thread Giovanni Giacobbi
On 28 January 2017 at 10:18, Wes wrote: > Hi​, static could be definitely a valid return type, but I don't see this > happening for parameters, for the same reasons this is disallowed: > > class A{ function bar(A $a){} } > class B extends A{ function bar(B $b){} } // must be

Re: [PHP-DEV] Allow "static" type

2017-01-28 Thread Wes
Hi​, static could be definitely a valid return type, but I don't see this happening for parameters, for the same reasons this is disallowed: class A{ function bar(A $a){} } class B extends A{ function bar(B $b){} } // must be contravariant, but B is covariant to A However again, it works as

[PHP-DEV] Allow "static" type

2017-01-27 Thread Marc Bennewitz
Hi all, I would like to know your opinion about using "static" as type-hint similar to "self" and how simple / complex it would be to implement. Example - using static: https://3v4l.org/XqDma class Base { public static function test(static $obj) : static { echo get_class($obj) .