Skip to content

Commit f679797

Browse files
committed
Fix tests compatibility with parser less than 1.2.1
1 parent 50d75e3 commit f679797

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/Unit/Reader/ReaderTestCase.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace TypeLang\Reader\Tests\Unit\Reader;
66

7+
use Composer\InstalledVersions;
78
use PHPUnit\Framework\Attributes\Group;
89
use TypeLang\Parser\Node\Node;
910
use TypeLang\Parser\Node\Stmt\TypeStatement;
@@ -41,6 +42,13 @@ protected static function assertSameType(?TypeStatement $expected, ?TypeStatemen
4142
public static function readersDataProvider(): iterable
4243
{
4344
yield ReflectionReader::class => [new ReflectionReader()];
44-
yield AttributeReader::class => [new AttributeReader()];
45+
46+
$parserVersion = InstalledVersions::getVersion('type-lang/parser')
47+
?? '0.0.0.0';
48+
49+
// @see https://github.com/php-type-language/parser/releases/tag/1.2.1
50+
if (\version_compare($parserVersion, '1.2.1', '>=')) {
51+
yield AttributeReader::class => [new AttributeReader()];
52+
}
4553
}
4654
}

0 commit comments

Comments
 (0)