Repository navigation
Conversation
AJenbo
force-pushed
the
restart-manager
branch
from
October 21, 2026 11:12
b2d4c91 to
41077c0
Compare
| persist-credentials: false | ||
|
|
||
| - name: "Install PHP" | ||
| uses: "shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962" # 2.40.0 |
| php-version: "8.2" | ||
| extensions: ${{ matrix.extensions }} | ||
|
|
||
| - uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0 |
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.
Rewrite of #6253 that replaces composer/xdebug-handler, the xdebug/pcov/tideways
ProcessRestarterfrom #6757 and the turbo/OPcache-onlyTurboProcessRestarterwith one restart manager inPHPStan\Process\Restart. It runs frombin/phpstanbefore the Composer autoloader. It collects every reason to restart, then re-executes the process once.It overlaps with #6769, which has the same goal; see the comparison there.
How it works
ExtensionRegistryis a table of reasons. Each reason says how to neutralize its extension:xdebug.mode=off, plusXDEBUG_MODE=off, because the env var overrides the ini.pcov.enabled=0.uopz.disable=1.-d extension=from next to the phar.IniComposerwrites one composed php.ini: every loaded ini file, with stripped extensions commented out, then the runtimeini_get_all()diff so-doverrides survive, then the forced settings.PHPRC. Spawned workers read it, and forked workers inherit the configuration anyway.PHPSTAN_RESTART=<reasons>) prevents a second restart.RestartExecutorusespcntl_exec(). Without it (Windows), it runs the restarted command as a child process and passes its exit code on.Behaviour changes
--debugrestarts like any other run, as on 2.3.x.--xdebug(or the deprecatedPHPSTAN_ALLOW_XDEBUG) keeps xdebug armed; pcov and uopz are still disarmed, and the option description now says so.pcntl_exec().diagnosehas a "Process restart" section: what was found, what the process was restarted for, and what a run started now would restart for.-vvvprints the restart line, and so doesXDEBUG_HANDLER_DEBUG, for CI configurations that already set it.API
TurboProcessRestarter::restartIfSuitable()(@apisince Stop the recursion when an enum case value reads itself #6731/807d030f6f) is kept as a facade.$appName: e.g.'rector', it applies every reason and honours--xdebugand<APP>_ALLOW_XDEBUG. A program like Rector can then drop its own xdebug-handler restart and get one restart in total.PHPStan\Process\Restartis internal.Tests
TurboProcessRestarterTest.Process restart E2E testsjob:XDEBUG_MODE,--xdebug, xdebug and pcov together, uopz, OPcache,--debugand diagnose, plus a Windows run of theproc_open()path that checks the exit code is passed on.bootstrapFilesrecords each process, forked workers included. Anauto_prepend_filecounts the starts of the main process. Every row asserts exactly one restart and the expected armed/disarmed state everywhere, and that no composed ini is left behind.pcovortidewaysextension is loaded #6757/Improvepcove2e tests #6770 now assert the new restart line, and that pcov is disabled rather than unloaded.Related:
pcovortidewaysextension is loaded #6757pcove2e tests #6770XdebugHandler->check()should be called very early composer/xdebug-handler#175pcntl_execcomposer/xdebug-handler#176