Skip to content

Commit 2b18acc

Browse files
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 ------- eac6369 consider traits imported in parent classes
2 parents 5992bf0 + eac6369 commit 2b18acc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function startTest($test)
232232
if (isset($annotations['class']['expectedDeprecation'])) {
233233
$test->getTestResultObject()->addError($test, new AssertionFailedError('`@expectedDeprecation` annotations are not allowed at the class level.'), 0);
234234
}
235-
if (isset($annotations['method']['expectedDeprecation']) || $this->checkNumAssertions = \in_array(ExpectDeprecationTrait::class, class_uses($test), true)) {
235+
if (isset($annotations['method']['expectedDeprecation']) || $this->checkNumAssertions = method_exists($test, 'expectDeprecation') && (new \ReflectionMethod($test, 'expectDeprecation'))->getFileName() === (new \ReflectionMethod(ExpectDeprecationTrait::class, 'expectDeprecation'))->getFileName()) {
236236
if (isset($annotations['method']['expectedDeprecation'])) {
237237
self::$expectedDeprecations = $annotations['method']['expectedDeprecation'];
238238
self::$previousErrorHandler = set_error_handler([self::class, 'handleError']);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy