mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
e14354af21
# The handling of legacy constructors defined by traits was corrected. # They are now properly registered and used on instantiation. # The situation for conflicting legacy and __construct constructors is # mostly identical. If they are defined in the class, they override conflicts # and do not collide. However, in case different styles are mixed, between # class and trait definition, we assume a programmer's mistake and report # a collision. # # BTW: +1 for all the fixed tests! `make test` is fun again.
36 lines
427 B
PHP
36 lines
427 B
PHP
--TEST--
|
|
In instead definitions all trait whose methods are meant to be hidden can be listed.
|
|
--FILE--
|
|
<?php
|
|
error_reporting(E_ALL);
|
|
|
|
trait A {
|
|
public function foo() {
|
|
echo 'a';
|
|
}
|
|
}
|
|
|
|
trait B {
|
|
public function foo() {
|
|
echo 'b';
|
|
}
|
|
}
|
|
|
|
trait C {
|
|
public function foo() {
|
|
echo 'c';
|
|
}
|
|
}
|
|
|
|
class MyClass {
|
|
use C, A, B {
|
|
B::foo insteadof A, C;
|
|
}
|
|
}
|
|
|
|
$t = new MyClass;
|
|
$t->foo();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
b
|