diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php index 0a1603e646cbf..1c84ff32c0b74 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\PhpUnit\Legacy; use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; use PHPUnit\Framework\Warning; /** @@ -36,6 +37,10 @@ public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFo public function startTest($test) { + if (!$test instanceof TestCase) { + return; + } + $annotations = $test->getAnnotations(); $ignoredAnnotations = array('covers', 'coversDefaultClass', 'coversNothing');