Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Dec 7, 2025

infection is using ondram/ci-detector 4.x and has class-loading problems when the project-under-test uses a older version of this lib, see infection/infection#2671

upgrading to 4.x allows us to run infection from within build-infection:

➜  phpstan-src git:(upd) ✗ php build-infection/vendor/bin/infection -vvv
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port).
[debug] Checking INFECTION_ALLOW_XDEBUG
[debug] The Xdebug extension is loaded (3.5.0) xdebug.mode=debug
[debug] Process restarting (INFECTION_ALLOW_XDEBUG=internal|3.5.0|1|*|*)
[debug] Running: [/opt/homebrew/Cellar/php@8.3/8.3.28/bin/php, build-infection/vendor/bin/infection, -vvv]
[debug] Checking INFECTION_ALLOW_XDEBUG
[debug] Restarted (47 ms). The Xdebug extension is not loaded

    ____      ____          __  _
   /  _/___  / __/__  _____/ /_(_)___  ____
   / // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
 _/ // / / / __/  __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/  \___/\___/\__/_/\____/_/ /_/

#StandWithUkraine

Infection - PHP Mutation Testing Framework version 0.31.9

before this PR, this step errored with:

➜  phpstan-src git:(2.1.x) ✗ php build-infection/vendor/bin/infection -vvv 

In Container.php line 147:
                                                                  
  [DIContainer\Exception]                                         
  Unknown service "Infection\Configuration\ConfigurationFactory"  
                                                                  

Exception trace:
  at /Users/staabm/workspace/phpstan-src/build-infection/vendor/sanmai/di-container/src/Container.php:147
 DIContainer\Container->get() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Container.php:1045
 Infection\Container->getConfigurationFactory() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Container.php:643
 Infection\Container::Infection\{closure}() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/sanmai/di-container/src/Container.php:139
 DIContainer\Container->get() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Container.php:890
 Infection\Container->getConfiguration() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Command/RunCommand.php:599
 Infection\Command\RunCommand->installTestFrameworkIfNeeded() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Command/RunCommand.php:630
 Infection\Command\RunCommand->startUp() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Command/RunCommand.php:419
 Infection\Command\RunCommand->executeCommand() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/src/Command/BaseCommand.php:75
 Infection\Command\BaseCommand->execute() at /Users/staabm/workspace/phpstan-src/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /Users/staabm/workspace/phpstan-src/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /Users/staabm/workspace/phpstan-src/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /Users/staabm/workspace/phpstan-src/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/infection/infection/bin/infection:94
 include() at /Users/staabm/workspace/phpstan-src/build-infection/vendor/bin/infection:119

run [--test-framework TEST-FRAMEWORK] [--static-analysis-tool STATIC-ANALYSIS-TOOL] [--test-framework-options TEST-FRAMEWORK-OPTIONS] [--static-analysis-tool-options STATIC-ANALYSIS-TOOL-OPTIONS] [-j|--threads THREADS] [--with-uncovered] [-s|--show-mutations [SHOW-MUTATIONS]] [--no-progress] [--force-progress] [-c|--configuration CONFIGURATION] [--coverage COVERAGE] [--mutators MUTATORS] [--filter FILTER] [--formatter FORMATTER] [--git-diff-filter GIT-DIFF-FILTER] [--git-diff-lines] [--git-diff-base GIT-DIFF-BASE] [--logger-github [LOGGER-GITHUB]] [--id ID] [--map-source-class-to-test [MAP-SOURCE-CLASS-TO-TEST]] [--logger-gitlab [LOGGER-GITLAB]] [--logger-project-root-directory LOGGER-PROJECT-ROOT-DIRECTORY] [--logger-html LOGGER-HTML] [--logger-text LOGGER-TEXT] [--noop] [--only-covering-test-cases] [--min-msi MIN-MSI] [--min-covered-msi MIN-COVERED-MSI] [--log-verbosity LOG-VERBOSITY] [--initial-tests-php-options INITIAL-TESTS-PHP-OPTIONS] [--skip-initial-tests] [--ignore-msi-with-no-mutations] [--debug] [--dry-run]                                                                       

so while the root problem should be addressed in the infection application, it does not hurt for us to upgrade ondram/ci-detector to 4.x - which requires PHP 7.4+. this is fine for PHPStan 2.x as we are also requiring 7.4+


breaking changes of 4.x seem to not affect us

@staabm staabm marked this pull request as ready for review December 7, 2025 09:03
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 6284186 into phpstan:2.1.x Dec 7, 2025
636 of 637 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants