File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1313class PHPUnitVersionDetector
1414{
1515
16+ private bool $ initialized = false ;
17+
1618 private ?int $ majorVersion = null ;
1719
1820 private ReflectionProvider $ reflectionProvider ;
@@ -24,16 +26,17 @@ public function __construct(ReflectionProvider $reflectionProvider)
2426
2527 public function isPHPUnit10OrNewer (): bool
2628 {
27- return $ this ->getMajorVersion () >= 10 ;
29+ $ majorVersion = $ this ->getMajorVersion ();
30+ return $ majorVersion !== null && $ majorVersion >= 10 ;
2831 }
2932
30- private function getMajorVersion (): int
33+ private function getMajorVersion (): ? int
3134 {
32- if ($ this ->majorVersion !== null ) {
35+ if ($ this ->initialized ) {
3336 return $ this ->majorVersion ;
3437 }
38+ $ this ->initialized = true ;
3539
36- $ this ->majorVersion = 9 ;
3740 if ($ this ->reflectionProvider ->hasClass (TestCase::class)) {
3841 $ testCase = $ this ->reflectionProvider ->getClass (TestCase::class);
3942 $ file = $ testCase ->getFileName ();
You can’t perform that action at this time.
0 commit comments