On Thu, Nov 6, 2014 at 12:43 AM, Dmitry Stogov <dmi...@zend.com> wrote:
> It's clear, that covariant types are more smart, but not supporting them,
> won't prevent access to more specific type properties and methods.
> We are not C++ or Java, and we don't need to cast objects to more specific
> types.
>
> On the other hand covariance requires all return types to be defined before
> class binding.
> It may be a serious new problem. For example you won't be able to compile
> the following code at all?
>
> <?php
> class A {
>   function foo(): C {}
> }
> class B extends A {
>   function foo(): C {}
> }
> class C extends B {
>   function foo(): C {}
> }
> ?>

I think I have figured out away to do the type checks that would allow
this and current checks to work; I'll report back after some trial and
testing.

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

Reply via email to