What the agent does
The agent reads the test setup and the constraints around it. In an app laid out like slimphp/Slim-Skeleton, composer.json requires php ^7.4 || ^8.0 and, for development, phpunit/phpunit ^9.6.17, phpspec/prophecy-phpunit ^2.2, jangregor/phpstan-prophecy, phpstan/phpstan ^1.10 and squizlabs/php_codesniffer. phpunit.xml still points at the 7.1 schema and uses attributes PHPUnit 10 removed: backupStaticAttributes, convertErrorsToExceptions, convertNoticesToExceptions and convertWarningsToExceptions, plus a <filter><whitelist> block that PHPUnit 9 already replaced with <coverage> and PHPUnit 10 replaces again with <source>. tests/TestCase.php uses ProphecyTrait from the prophecy bridge, tests/Domain/User/UserTest.php has a non-static userProvider method used through a @dataProvider annotation, and the action tests build anonymous classes and compare JSON bodies. .github/workflows/tests.yml runs the suite on PHP 7.4, 8.0, 8.1 and 8.2 with Xdebug coverage and --coverage-clover clover.xml, and uploads to Coveralls from the 8.1 job.
The constraint that decides the version is PHP. PHPUnit 10.5 requires PHP 8.1, 11.5 requires 8.2 and 12 requires 8.3, while Slim 4.15 itself still allows 7.4. The agent proposes 10, the newest line that keeps two of the four matrix entries, and says in the pull request that 11 is one more matrix row away. composer.json moves php to ^8.1, phpunit/phpunit to ^10.5 and phpspec/prophecy-phpunit to ^2.3, the first release whose constraint admits PHPUnit 10, and the workflow matrix drops 7.4 and 8.0, with the analysis job still on 8.1. composer update in the sandbox resolves the set and the agent reads the lock diff for anything else that moved.
The configuration migrates with PHPUnit's own tool. vendor/bin/phpunit --migrate-configuration rewrites phpunit.xml against the 10.5 schema: the removed attributes go, backupStaticAttributes becomes backupStaticProperties, cacheDirectory is added, and the whitelist becomes a <source> element with <include> for src/. The agent reads the result rather than trusting it, keeps beStrictAboutTestsThatDoNotTestAnything and the other strictness flags, and confirms --coverage-clover still produces clover.xml for Coveralls. In UserTest.php the provider becomes public static and the annotation becomes a #[DataProvider('userProvider')] attribute, which PHPUnit 10 supports and which keeps the test quiet on 11. The anonymous action classes and the prophecy assertions need nothing.
The check is the suite on every supported version. The agent runs vendor/bin/phpunit with coverage on PHP 8.1 and 8.2 in the sandbox, reads the output for deprecation notices as well as failures, since PHPUnit 10 prints deprecations in its summary, and runs vendor/bin/phpcs and vendor/bin/phpstan as the workflow does, because phpstan-prophecy must still resolve the prophecy types under the new bridge. The pull request quotes all three on both PHP versions.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Upgrade this Slim 4 app from PHPUnit 9 to PHPUnit 10. Read composer.json, phpunit.xml, tests/TestCase.php, every test under tests/, phpstan.neon.dist and .github/workflows/tests.yml first. Raise the php constraint to ^8.1, move phpunit/phpunit to ^10.5 and phpspec/prophecy-phpunit to ^2.3, run composer update and report what else moved in the lock file. Run vendor/bin/phpunit --migrate-configuration, then read phpunit.xml and keep the strictness attributes, the bootstrap and a source include for src/. Make data provider methods public static and replace @dataProvider annotations with DataProvider attributes. Drop PHP 7.4 and 8.0 from the workflow matrix and keep the analysis job on 8.1. Run vendor/bin/phpunit --coverage-clover clover.xml, vendor/bin/phpcs and vendor/bin/phpstan on PHP 8.1 and 8.2 and fix any failure or deprecation they print. Open a pull request that quotes the outputs on both versions and says what PHPUnit 11 would additionally need.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request changes composer.json, composer.lock, phpunit.xml, tests/Domain/User/UserTest.php and .github/workflows/tests.yml. Its description lists each constraint it moved and each package the lock diff moved with it, shows the migrated phpunit.xml, and quotes the PHPUnit, PHP_CodeSniffer and PHPStan output on PHP 8.1 and 8.2, including the deprecation count PHPUnit 10 prints.
A reviewer decides whether dropping PHP 7.4 and 8.0 is acceptable for the project, which is the one product decision in the change; the pull request isolates it to the php constraint and two matrix rows. They check that coverage still reaches Coveralls from the analysis job and that the <source> element covers the same directory the whitelist did.
Contributors run the same composer test as before and see PHPUnit 10's output format, with the suite, the strictness flags and the coverage report unchanged.
Run it on every Monday morning
An automation on the Project with a schedule trigger set to Monday morning in the team's time zone starts a read-only run that reads composer.json and the lock file and posts a comment listing the development dependencies with a newer major line available, PHPUnit among them, and what each would require. The upgrade itself starts from the reader's own server, which sends this body to POST /o/{org}/sessions with the repository in resources and a request_id that is a UUID v5 of the week and repository name, so a retried call returns the run it already started.
Each run reads that project's own constraints, so an app already on PHP 8.2 gets PHPUnit 11 proposed instead, and one whose tests use features PHPUnit 10 removed gets each of them named in the pull request with its replacement.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
A PHPUnit major is a configuration schema, a set of removed attributes, a change to how data providers are declared and a PHP floor, and the mistakes show up as a suite that passes with warnings nobody reads. The agent runs the migration tool, reads what it produced, runs the suite on each PHP version the project will keep, and treats a deprecation as something to fix, with every command and its output kept beside the pull request.
Development dependencies lag in every repository at once. The same request runs across a company's PHP services in parallel, each in its own sandbox, each with a pull request that fits that project's PHP floor and test style, and each with the proof that its own suite, linter and static analysis still pass.
Frequently asked questions
Why PHPUnit 10 and not 11 or 12?
PHPUnit 10.5 needs PHP 8.1, 11.5 needs 8.2 and 12 needs 8.3. The project tests on 7.4 through 8.2, so 10 is the newest line that keeps two existing matrix rows. The pull request says that 11 is one more dropped row away and makes the data providers compatible with it already.
What does --migrate-configuration change?
It rewrites phpunit.xml against the current schema: removed attributes such as convertErrorsToExceptions go, backupStaticAttributes becomes backupStaticProperties, cacheDirectory is added, and the old whitelist becomes a <source> element. The agent reads the result and keeps the strictness flags the project chose.
Does Prophecy still work?
Yes. The project already uses ProphecyTrait from phpspec/prophecy-phpunit, and release 2.3 of that bridge admits PHPUnit 10. The PHPStan Prophecy extension is unchanged, and the pull request quotes the phpstan run to show the types still resolve.
Why do data providers change?
PHPUnit 10 deprecates non-static data provider methods and a later major removes them, and attributes replace the @dataProvider annotation. Making userProvider static and adding #[DataProvider('userProvider')] keeps the test silent on both lines.
Will coverage still reach Coveralls?
The workflow's --coverage-clover clover.xml flag is unchanged and the migrated <source> element covers src/ as the whitelist did. The agent runs that command with Xdebug in the sandbox and confirms the file is produced before opening the pull request.