Skip to content

Commit be9976b

Browse files
committed
Use TYPO3\CMS\Core\Information\Typo3Version to get installed TYPO3 version
1 parent 592fe0f commit be9976b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Stubs/StubFilesExtensionLoader.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace SaschaEgerer\PhpstanTypo3\Stubs;
44

5-
use Composer\InstalledVersions;
65
use Composer\Semver\VersionParser;
6+
use TYPO3\CMS\Core\Information\Typo3Version;
77

88
class StubFilesExtensionLoader implements \PHPStan\PhpDoc\StubFilesExtension
99
{
@@ -12,10 +12,13 @@ public function getFiles(): array
1212
{
1313
$stubsDir = dirname(__DIR__, 2) . '/stubs';
1414
$files = [];
15-
if (InstalledVersions::satisfies(new VersionParser(), 'typo3/cms-core', '< 12')) {
15+
$typo3Version = new Typo3Version();
16+
$versionParser = new VersionParser();
17+
18+
if ($versionParser->parseConstraints($typo3Version->getVersion())->matches($versionParser->parseConstraints('< 12'))) {
1619
$files[] = $stubsDir . '/GeneralUtility.stub';
1720
}
18-
if (InstalledVersions::satisfies(new VersionParser(), 'typo3/cms-core', '<= 12.2.0')) {
21+
if ($versionParser->parseConstraints($typo3Version->getVersion())->matches($versionParser->parseConstraints('<= 12.2.0'))) {
1922
$files[] = $stubsDir . '/QueryResult.stub';
2023
}
2124

0 commit comments

Comments
 (0)