44
55use PHPUnit \Framework \TestListener as BaseTestListener ;
66use PHPUnit \Framework \TestListenerDefaultImplementation ;
7+ use PHPUnit \Framework \Test ;
78
89class TestListener implements BaseTestListener
910{
1011 use TestListenerDefaultImplementation;
1112
1213 private $ ignorePolicy ;
1314
14- const PHPUNIT_PROPERTY_PREFIX = 'PHPUnit_ ' ;
15+ private const PHPUNIT_PROPERTY_PREFIX = 'PHPUnit_ ' ;
1516
1617 public function __construct (IgnoreTestPolicy $ ignorePolicy = null )
1718 {
18- $ this ->ignorePolicy = ( $ ignorePolicy) ?: new NeverIgnoreTestPolicy ();
19+ $ this ->ignorePolicy = $ ignorePolicy ?: new NeverIgnoreTestPolicy ();
1920 }
2021
21- public function endTest (\ PHPUnit \ Framework \ Test $ test , float $ time ): void
22+ public function endTest (Test $ test , float $ time ): void
2223 {
2324 $ testReflection = new \ReflectionObject ($ test );
2425
@@ -29,7 +30,7 @@ public function endTest(\PHPUnit\Framework\Test $test, float $time): void
2930 $ this ->safelyFreeProperties ($ test , $ testReflection ->getProperties ());
3031 }
3132
32- private function safelyFreeProperties (\ PHPUnit \ Framework \ Test $ test , array $ properties )
33+ private function safelyFreeProperties (Test $ test , array $ properties )
3334 {
3435 foreach ($ properties as $ property ) {
3536 if ($ this ->isSafeToFreeProperty ($ property )) {
@@ -48,7 +49,7 @@ private function isNotPhpUnitProperty(\ReflectionProperty $property)
4849 return 0 !== strpos ($ property ->getDeclaringClass ()->getName (), self ::PHPUNIT_PROPERTY_PREFIX );
4950 }
5051
51- private function freeProperty (\ PHPUnit \ Framework \ Test $ test , \ReflectionProperty $ property )
52+ private function freeProperty (Test $ test , \ReflectionProperty $ property )
5253 {
5354 $ property ->setAccessible (true );
5455 $ property ->setValue ($ test , null );
@@ -57,7 +58,7 @@ private function freeProperty(\PHPUnit\Framework\Test $test, \ReflectionProperty
5758
5859class NeverIgnoreTestPolicy implements IgnoreTestPolicy
5960{
60- public function shouldIgnore (\ReflectionObject $ testReflection )
61+ public function shouldIgnore (\ReflectionObject $ testReflection ): bool
6162 {
6263 return false ;
6364 }
0 commit comments