On 16.06.2020 at 16:19, Benas IML wrote:

> I meant something like this:
> ```
> <?php
> class Test {
>     public function __construct() {}
> }
>
> class Test2 extends Test {
>     /* this is legal */
>     public function __construct(): void {}
> }
>
> class Test3 extends Test {
>     /*
>      * this is illegal, even though no
>      * return type means mixed|void
>      */
>     public function __construct(): mixed {}
> }
>
> class Test4 extends Test2 {
>     /*
>      * this is legal, even though we are
>      * widening void type to mixed|void
>      * but LSP checks don't apply to
>      * constructors and destructors
>      */
>     public function __construct() {}
> }
> ```

Currently, constructors are exempt from LSP checks[1]; are you planning
to change that?

[1] <https://3v4l.org/PeDCY>

--
Christoph M. Becker

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to