Re: PHP's support to contravariance and covariance

From: Date: Tue, 31 Jan 2017 20:47:52 +0000
Subject: Re: PHP's support to contravariance and covariance
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-98092@lists.php.net to get a copy of this message
> Is there anything else that I am missing? Sadly, yes. Consider the following snippet: class A { function method(): B; } class B extends A { function method(): C; } class C extends B {} When checking that B::method satisfies the requirements of A::method it must know if C extends B. At the time we check if B::method satisfies A::method, C will *not* yet be in the symbol table. You need to adjust the passes over the code to register symbols and their declared relationships, and then in a separate pass validate them. After that if the class isn't found then you trigger an autoload. It's doable, it just hasn't been done.

« previous php.internals (#98092) next »