File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
namespace PHPUnit \Runner \Extension ;
11
11
12
+ use function count ;
13
+ use function explode ;
12
14
use function extension_loaded ;
15
+ use function implode ;
13
16
use function is_file ;
17
+ use function str_contains ;
14
18
use PharIo \Manifest \ApplicationName ;
15
19
use PharIo \Manifest \Exception as ManifestException ;
16
20
use PharIo \Manifest \ManifestLoader ;
@@ -56,7 +60,7 @@ public function loadPharExtensionsInDirectory(string $directory): array
56
60
57
61
try {
58
62
$ applicationName = new ApplicationName ('phpunit/phpunit ' );
59
- $ version = new PharIoVersion (Version:: series ());
63
+ $ version = new PharIoVersion ($ this -> phpunitVersion ());
60
64
$ manifest = ManifestLoader::fromFile ('phar:// ' . $ file . '/manifest.xml ' );
61
65
62
66
if (!$ manifest ->isExtensionFor ($ applicationName )) {
@@ -99,4 +103,21 @@ public function loadPharExtensionsInDirectory(string $directory): array
99
103
'notLoadedExtensions ' => $ notLoadedExtensions ,
100
104
];
101
105
}
106
+
107
+ private function phpunitVersion (): string
108
+ {
109
+ $ version = Version::id ();
110
+
111
+ if (!str_contains ($ version , '- ' )) {
112
+ return $ version ;
113
+ }
114
+
115
+ $ parts = explode ('. ' , explode ('- ' , $ version )[0 ]);
116
+
117
+ if (count ($ parts ) === 2 ) {
118
+ $ parts [] = 0 ;
119
+ }
120
+
121
+ return implode ('. ' , $ parts );
122
+ }
102
123
}
You can’t perform that action at this time.
0 commit comments