fix: install Infection via Composer for PHP 8.5 compat#4
Merged
Conversation
The Infection PHAR (0.32.6) from jakzal/phpqa is scoped with php-scoper, which does not support PHP 8.5 yet (humbug/php-scoper#1139). This causes a fatal error: `Call to undefined function Infected\array_first()` because php-scoper prefixes the PHP 8.4+ built-in function. Replace the scoped PHAR with a Composer-installed version via `composer global bin infection`, which runs unscoped and works correctly on PHP 8.5. The old PHAR symlink and file are removed to avoid conflicts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Spomky
added a commit
that referenced
this pull request
Mar 1, 2026
The squash merge of #4 lost this fix. The `infection/extension-installer` plugin must be explicitly allowed before requiring infection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
composer global bin infectioninstead of relying on the scoped PHAR from jakzal/phpqaProblem
The Infection PHAR (0.32.6) is scoped with php-scoper, which does not support PHP 8.5. This causes a fatal error on PHP 8.5:
array_first()is a PHP 8.4+ built-in function, but php-scoper prefixes it toInfected\array_first(), which doesn't exist.Fix
Replace the scoped PHAR with an unscoped Composer installation. The
composer global binapproach isolates Infection's dependencies while keeping the binary available in$PATHat/tools/.composer/vendor/bin/infection.Test plan
PHP_VERSION=8.5and runinfection --version🤖 Generated with Claude Code