Skip to content

Commit c916650

Browse files
ci: run qa on php 8.4 and 8.5
1 parent 72ad5ad commit c916650

6 files changed

Lines changed: 38 additions & 9 deletions

File tree

.github/workflows/qa.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
php-version:
19-
- '8.2'
20-
- '8.3'
2119
- '8.4'
2220
- '8.5'
2321

@@ -42,5 +40,4 @@ jobs:
4240
run: vendor/bin/phpcs -i
4341

4442
- name: Run QA
45-
if: matrix['php-version'] == '8.5'
4643
run: composer qa

SymPress/Helpers/Names.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use function array_merge;
1515
use function array_unique;
1616
use function array_values;
17+
use function constant;
18+
use function defined;
1719
use function in_array;
1820
use function ltrim;
1921

@@ -102,7 +104,7 @@ private static function operatorTokens(): array
102104
static $tokens;
103105

104106
if ($tokens === null) {
105-
$tokens = array_values(array_unique(array_merge(
107+
$tokens = array_merge(
106108
array_keys(Tokens::$arithmeticTokens),
107109
array_keys(Tokens::$assignmentTokens),
108110
array_keys(Tokens::$equalityTokens),
@@ -125,12 +127,17 @@ private static function operatorTokens(): array
125127
T_ELLIPSIS,
126128
T_FN_ARROW,
127129
T_MATCH_ARROW,
128-
T_PIPE,
129130
T_STRING_CONCAT,
130131
T_TYPE_INTERSECTION,
131132
T_TYPE_UNION,
132133
],
133-
)));
134+
);
135+
136+
if (defined('T_PIPE')) {
137+
$tokens[] = constant('T_PIPE');
138+
}
139+
140+
$tokens = array_values(array_unique($tokens));
134141
}
135142

136143
return $tokens;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
],
7676
"static-analysis": [
7777
"Composer\\Config::disableProcessTimeout",
78-
"phpstan analyse"
78+
"phpstan analyse --memory-limit=1G"
7979
],
8080
"tests": [
8181
"Composer\\Config::disableProcessTimeout",

docs/Release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Every release candidate must be verified against the required matrix before tagg
2525

2626
| Dimension | Required | Experimental |
2727
| --------- | -------- | ------------ |
28-
| PHP runtime | Install and PHPCS discovery on 8.2, 8.3, 8.4, and 8.5; full package QA on 8.5 | next PHP minor when available |
28+
| PHP runtime | Full package QA on 8.4 and 8.5 | next PHP minor when available |
2929
| PHP_CodeSniffer | 3.x supported range | 4.x until promoted |
3030
| WordPress target config | 6.5, 7.0 | latest trunk when useful |
3131
| Standards | WPCS, VIPWPCS, Slevomat, PHPCompatibility | dependency pre-releases |

tests/fixtures/disallow-short-open-tag.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ function (string $sniff, array $messages, array $warnings, array $errors, array
1111
return [$sniff, $messages, $errors, $warnings, $properties];
1212
}
1313

14-
return [$sniff, $messages, $warnings, $errors, $properties];
14+
return [
15+
$sniff,
16+
$messages,
17+
$warnings,
18+
array_map(
19+
static fn (array $codes): array => array_map(
20+
static fn (string $code): string => $code === 'PossibleFound' ? 'Found' : $code,
21+
$codes,
22+
),
23+
$errors,
24+
),
25+
$properties,
26+
];
1527
}
1628
// @phpcsProcessFixtureEnd
1729
?>

tests/unit/Php85SyntaxTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public function callback(): Closure
5151
#[Test]
5252
public function php85PipeTokenIsClassifiedAsOperator(): void
5353
{
54+
$this->requiresPhp85Runtime();
55+
5456
$file = $this->factoryFile(self::CODE, '8.5');
5557
$tokens = $file->getTokens();
5658

@@ -64,6 +66,8 @@ public function php85PipeTokenIsClassifiedAsOperator(): void
6466
#[Test]
6567
public function sympressPureParsesPhp85SyntaxWithoutSyntaxErrors(): void
6668
{
69+
$this->requiresPhp85Runtime();
70+
6771
$tempDir = sys_get_temp_dir() . '/sympress-cs-php85-' . bin2hex(random_bytes(8));
6872
self::assertTrue(mkdir($tempDir));
6973

@@ -91,4 +95,13 @@ public function sympressPureParsesPhp85SyntaxWithoutSyntaxErrors(): void
9195
rmdir($tempDir);
9296
}
9397
}
98+
99+
private function requiresPhp85Runtime(): void
100+
{
101+
if (PHP_VERSION_ID >= 80500) {
102+
return;
103+
}
104+
105+
self::markTestSkipped('PHP 8.5 syntax tokenization requires a PHP 8.5 runtime.');
106+
}
94107
}

0 commit comments

Comments
 (0)