Skip to content

Commit 9c49ae3

Browse files
SanderMullerclaude
authored andcommitted
Load dead-code-detector in self-analysis only on PHP 8.2 and later
On PHP 8.1 serialize() does not trim its buffer, so every cache key that DeadCodeRule builds with it holds a 4 KB allocation. The rule then needs about 150 MB more in the main process, and the Windows PHP 8.1 job runs out of its memory limit. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 08e3736 commit 9c49ae3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎build/ignore-by-php-version.neon.php‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
} else {
77
$includes[] = __DIR__ . '/baseline-pre-8.0.neon';
88
}
9-
if (PHP_VERSION_ID >= 80100) {
10-
$includes[] = __DIR__ . '/../vendor/shipmonk/dead-code-detector/rules.neon';
11-
} else {
9+
if (PHP_VERSION_ID < 80100) {
1210
$includes[] = __DIR__ . '/enums.neon';
1311
$includes[] = __DIR__ . '/readonly-property.neon';
1412
}
1513

14+
// PHP 8.1's serialize() does not trim its buffer, so the rule's cache keys cost 4 KB each
15+
if (PHP_VERSION_ID >= 80200) {
16+
$includes[] = __DIR__ . '/../vendor/shipmonk/dead-code-detector/rules.neon';
17+
}
18+
1619
if (PHP_VERSION_ID >= 70400) {
1720
$includes[] = __DIR__ . '/ignore-gte-php7.4-errors.neon';
1821
}

0 commit comments

Comments
 (0)