Re: [RFC][VOTE] Allow abstract function override
| From: | Marco Pivetta | Date: | Tue, 28 Mar 2017 11:43:09 +0000 |
| Subject: | Re: [RFC][VOTE] Allow abstract function override | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98650@lists.php.net to get a copy of this message | ||
Hey Wes,
On 28 Mar 2017 02:14, "Wes" <netmo.php@gmail.com> wrote:
Yes, yes you are :D Quick reminder:
```php
interface iA { function bar(stdClass $x); }
interface iB extends iA { function bar($x): stdClass; } // OK
class cA { function bar(stdClass $x) {} }
class cB extends cA { function bar($x): stdClass {} } // OK in 7.2
abstract class cC { abstract function bar(stdClass $x); }
abstract class cD extends cC { abstract function bar($x): stdClass; } //
Fatal error: why?
class cE extends cD { function bar($x): stdClass{} }
```
What is this useful for, precisely? Also, I really never saw the need for
re-defining the signature in multiple abstract inheritance levels (a single
abstract class already smells in most scenarios).