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
A public method declared in a trait can be used by a class withoutimporting the trait itself when the trait is already imported by oneof the parent classes from the inheritance chain.
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -232,7 +232,19 @@ public function startTest($test)
232
232
if (isset($annotations['class']['expectedDeprecation'])) {
233
233
$test->getTestResultObject()->addError($test,newAssertionFailedError('`@expectedDeprecation` annotations are not allowed at the class level.'),0);
234
234
}
235
-
if (isset($annotations['method']['expectedDeprecation']) ||$this->checkNumAssertions =\in_array(ExpectDeprecationTrait::class,class_uses($test),true)) {
235
+
236
+
$class =\get_class($test);
237
+
$traits = [];
238
+
239
+
do {
240
+
$traits =array_merge(class_uses($class),$traits);
241
+
}while ($class =get_parent_class($class));
242
+
243
+
foreach ($traitsas$trait =>$same) {
244
+
$traits =array_merge(class_uses($trait),$traits);
245
+
}
246
+
247
+
if (isset($annotations['method']['expectedDeprecation']) ||$this->checkNumAssertions =\in_array(ExpectDeprecationTrait::class,$traits,true)) {
236
248
if (isset($annotations['method']['expectedDeprecation'])) {