Re: Allow "static" type
| From: | Wes | Date: | Sat, 28 Jan 2017 09:18:42 +0000 |
| Subject: | Re: Allow "static" type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98000@lists.php.net to get a copy of this message | ||
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 return type:
class A{ function bar(): A{} }
class B extends A{ function bar(): B{} } // must be covariant, and B is
covariant to A