On Thu, 16 Oct 2014 18:39:06 +0400, Davey Shafik <da...@php.net> wrote:

I very much like this — though I would say it was dependent on the nullable
types RFC (like splat and variadics were codependent).

While I would like to see the introduction of a void type, I understand and
respect the limitations on the RFC.

However, one thing that I do think is missing, is the equivalent of Hacks
`$this` return type. You have `self` and `parent`, but I think without a
`static` equivalent you can break things:

class foo {
     static public function instanceOf(): self {
           return new static();
     }
}

class bar extends foo { }

foo::instanceOf(); // new foo, this is fine, returns `self`.
bar::instanceOf(); // new bar, no longer `self`

Hi,

bar is considered as instance of foo so shouldn't be any problem. Otherwise it would break LSP

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

Reply via email to