mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
c5ba229617
- aliases that are not actually matching anything are treated as errors now. This will make sure that all methods that are expected to be in a class are actually there, or in case a trait changed for instance, that the code breaks already on composition - Precedence declarations are also checked to ensure that the method which is supposed to take precedence actually exists, however, the other traits mentioned in the declaration are not regarded. We are more lenient here, since this avoids unnecessary fragility. - fixed another seamingly unrelated test which broke in the progress but wasn't clear before either.
22 lines
410 B
PHP
22 lines
410 B
PHP
--TEST--
|
|
Bug #60165 (Aliasing unexisting trait should throw/trigger the exception/error)
|
|
--FILE--
|
|
<?php
|
|
|
|
// The same is true for the insteadof operator to resolve conflicts
|
|
|
|
trait A {}
|
|
|
|
trait B {
|
|
public function bar() {}
|
|
}
|
|
|
|
class MyClass {
|
|
use A, B {
|
|
A::bar insteadof B;
|
|
}
|
|
}
|
|
|
|
--EXPECTF--
|
|
Fatal error: A precedence rule was defined for A::bar but this method does not exist in %s on line %d
|