bug #37543 [PhpUnitBridge] consider traits imported in parent classes (xabbuh)
This PR was merged into the 5.1 branch.
Discussion
----------
[PhpUnitBridge] consider traits imported in parent classes
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
A public method declared in a trait can be used by a class without
importing the trait itself when the trait is already imported by one
of the parent classes from the inheritance chain.
Commits
-------
eac6369db7
consider traits imported in parent classes
This commit is contained in:
commit
2b18acc8af
@ -232,7 +232,7 @@ class SymfonyTestsListenerTrait
|
||||
if (isset($annotations['class']['expectedDeprecation'])) {
|
||||
$test->getTestResultObject()->addError($test, new AssertionFailedError('`@expectedDeprecation` annotations are not allowed at the class level.'), 0);
|
||||
}
|
||||
if (isset($annotations['method']['expectedDeprecation']) || $this->checkNumAssertions = \in_array(ExpectDeprecationTrait::class, class_uses($test), true)) {
|
||||
if (isset($annotations['method']['expectedDeprecation']) || $this->checkNumAssertions = method_exists($test, 'expectDeprecation') && (new \ReflectionMethod($test, 'expectDeprecation'))->getFileName() === (new \ReflectionMethod(ExpectDeprecationTrait::class, 'expectDeprecation'))->getFileName()) {
|
||||
if (isset($annotations['method']['expectedDeprecation'])) {
|
||||
self::$expectedDeprecations = $annotations['method']['expectedDeprecation'];
|
||||
self::$previousErrorHandler = set_error_handler([self::class, 'handleError']);
|
||||
|
Reference in New Issue
Block a user