Marc Bennewitz wrote: > If I declare a return type of "object" and extends that to return "static" it > doesn't compile because "static" is not a valid return type yet. > https://3v4l.org/lp3AB/rfc#version=rfc-typed-properties
I think that it is need too, because it will avoid reference the class by name when you need return it - but not is a biiig problem too. 2016-11-23 9:07 GMT-02:00 Marc Bennewitz <dev@mabe.berlin>: > > > Am 23.11.2016 um 01:52 schrieb Dan Ackroyd: >> >> Hi, >> >> This is the reintroduction of the Object Type RFC for discussion. >> >> There was previously strong feedback from people who would prefer that >> the inheritance checks for methods that use object types should be >> co/contravariant. This has been added to the RFC. >> >> https://wiki.php.net/rfc/object-typehint > > > I like this RFC :) > > And I have a question where I'm not sure if that should be catched by this > RFC, too: > > If I declare a return type of "object" and extends that to return "static" > it doesn't compile because "static" is not a valid return type yet. > > https://3v4l.org/lp3AB/rfc#version=rfc-typed-properties > > class Test { > public static function factory() : object { > return new static(); > } > } > > class Test2 extends Test { > public static function factory() : static { > return parent::factory(); > > } > } > > >> >> cheers >> Dan >> Ack >> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php