mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
cf7c68283d
If we're validating a class method against a trait method, we need to treat "self" in the trait method as the class where the method is used. To achieve this, we need to thread the proto scope through all methods, so it can be provided separately from proto.common->scope.
20 lines
346 B
PHP
20 lines
346 B
PHP
--TEST--
|
|
Abstract method in trait using "self" (invalid)
|
|
--FILE--
|
|
<?php
|
|
|
|
trait T {
|
|
abstract private function method(self $x): self;
|
|
}
|
|
|
|
class C {
|
|
use T;
|
|
|
|
private function method(int $x): int { }
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
--EXPECTF--
|
|
Fatal error: Declaration of C::method(int $x): int must be compatible with T::method(C $x): C in %s on line %d
|