You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parent class uses the trait with protected method,
child class uses the same trait and changes visibility of method to public.
The method is public in PHP, but it is protected in HHVM.
<?phptrait t {
protectedfunctiontraitMethod() {
return1;
}
}
abstractclass p {
use t; //parent class imports trait methods as ispublicfunctionparentMethod() {
return1;
}
}
class c extends p {
use t {
traitMethod aspublic; // child class changes visibility of method
}
publicfunctionclassMethod() {
return1;
}
}
$class = new \ReflectionClass(newc());
$methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
var_dump($methods);
Using traits with as is not supported by Hack's trait model.
Naming[2102] Trait use as is a PHP feature that is unsupported in Hack
--> file.hack
24 | traitMethod as public; // child class changes visibility of method
| ^^^^^^^^^^^
1 error found.
Parent class uses the trait with protected method,
child class uses the same trait and changes visibility of method to public.
The method is public in PHP, but it is protected in HHVM.
http://3v4l.org/S584c
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: