diff --git a/tests/LexicalGrammarTest.php b/tests/LexicalGrammarTest.php index 59ff69e4..ee43e01d 100644 --- a/tests/LexicalGrammarTest.php +++ b/tests/LexicalGrammarTest.php @@ -17,6 +17,10 @@ class LexicalGrammarTest extends TestCase { private $expectedTokensFile; private $tokens; const FILE_PATTERN = __DIR__ . "/cases/lexical/*"; + const PHP84_FILE_PATTERN = __DIR__ . "/cases/lexical84/*"; + const PATTERNS_FOR_MINIMUM_PHP_VERSION = [ + [80400, self::PHP84_FILE_PATTERN], + ]; public function run(?TestResult $result = null) : TestResult { if (!isset($GLOBALS["GIT_CHECKOUT_LEXER"])) { $GLOBALS["GIT_CHECKOUT_LEXER"] = true; @@ -64,9 +68,23 @@ public function lexicalProvider() { if (in_array(basename($testCase), $skipped)) { continue; } + + if (PHP_VERSION_ID >= 80400 && basename($testCase) === 'keyword5.php') { + continue; + } + $testProviderArray[basename($testCase)] = [$testCase, $testCase . ".tokens"]; } + foreach (self::PATTERNS_FOR_MINIMUM_PHP_VERSION as list($minVersionId, $filePattern)) { + if (PHP_VERSION_ID >= $minVersionId) { + $testCases = glob($filePattern . ".php"); + foreach ($testCases as $testCase) { + $testProviderArray[basename($testCase)] = [$testCase, $testCase . ".tokens"]; + } + } + } + return $testProviderArray; } diff --git a/tests/cases/lexical84/keyword5.php b/tests/cases/lexical84/keyword5.php new file mode 100644 index 00000000..1ae654cc --- /dev/null +++ b/tests/cases/lexical84/keyword5.php @@ -0,0 +1,2 @@ +