#15 Deployer v8 Support#21
Merged
Merged
Conversation
Composer package changes
|
add a phpstan extension that dynamically ignores errors depending on v7 or v8 deployer function signature
Contributor
There was a problem hiding this comment.
Pull request overview
Adds runtime + test-suite compatibility for both Deployer v7 and Deployer v8, updating recipes, helpers, CI matrices, and static analysis so the project can be installed and validated under either major Deployer version.
Changes:
- Introduces version-aware helpers (
Utils::isDeployerVersion(),Utils::quote()) and updates localhost execution wrapper for v8 named-parameterrunLocally()usage. - Updates tests/bootstrap and functional/integration tests to accommodate moved classes and signature changes between v7 and v8.
- Expands Composer and CI constraints/matrices to test against both Deployer majors (and relevant PHP/Symfony combinations), plus adds PHPStan bootstrap stubs and an ignore-error extension.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/Utils.php |
Adds runtime Deployer version detection and a v7/v8 shell-quoting wrapper. |
src/Localhost.php |
Adapts runLocally() invocation to v8 named parameters while keeping v7 array-options support. |
recipes/common.php |
Switches recipe quoting to the new Utils::quote() compat helper. |
tests/bootstrap.php |
Conditionally loads Deployer helper files (v8 autoloads them) and adds class aliases for moved/renamed classes. |
tests/Functional/FunctionalTestCase.php |
Uses runtime Deployer version to construct ProcessRunner correctly for v7 vs v8. |
tests/Integration/WpCliIntegrationTest.php |
Updates mock expectations to handle Deployer v8 ProcessRunner::run() signature changes. |
tests/Functional/Tasks/DatabaseTasksFunctionalTest.php |
Relaxes failure output assertions to tolerate v7/v8 wording differences. |
stubs/deployer-v7.php |
Adds PHPStan stubs for cross-version symbol differences (primarily v7-only removals). |
phpstan/DeployerVersionCompatExtension.php |
Suppresses intentional PHPStan signature mismatches for runLocally() across Deployer majors. |
phpstan.neon |
Registers the stub bootstrap and the ignore-error extension; includes phpstan/ in scan paths. |
composer.json |
Broadens Deployer and Symfony constraints; adds composer-runtime-api requirement; adds autoload-dev for PHPStan extension. |
composer.lock |
Updates locked dependencies to Deployer v8 and related dependency graph changes. |
.github/workflows/tests.yml |
Updates matrix to include Deployer v8 and pins Deployer version before dependency resolution. |
.github/workflows/code-quality.yml |
Mirrors the tests matrix for code-quality checks and pins Deployer version before dependency resolution. |
.gitattributes |
Excludes phpstan/ and stubs/ from exported dist artifacts. |
README.md |
Updates contributor guidance to run composer precommit and documents testing against both Deployer majors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replaced locked audit with general audit for Composer packages.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Add Deployer v8 support
#15
Extends compatibility from
deployer/deployer:^7.3to also support^8.0, while keeping v7 working.What changed
Runtime compatibility (
src/)Utils::isDeployerVersion()— new helper usingComposer\InstalledVersionsto check the installed Deployer version at runtime; used wherever behaviour differs between versionsUtils::quote()— v7/v8 compat wrapper for shell-argument escaping (Deployer\Support\escape_shell_argumentwas replaced byDeployer\quotein v8)Localhost::run()— updated to use v8's named parameters forrunLocally()(v8 replaced the options array with individual named params); v7 falls through to the no-options call since no callers pass optionsRecipes
recipes/common.php— replaces directescape_shell_argumentimport withUtils::quote()Static analysis
stubs/deployer-v7.php— PHPStan bootstrap stub declaring v7-only symbols (Deployer\Support\escape_shell_argument) so v7 compatibility code paths type-check under v8; excluded from Composer dist via.gitattributesphpstan.neon— registers the stub viabootstrapFilesTest infrastructure
tests/bootstrap.php— guards the manualrequireof Deployer helper files (v8 autoloads them), and addsclass_aliasshims for moved classes (ProcessRunner,Ssh\Client) so test files use a single import for both versionsFunctionalTestCase.php—ProcessRunnerconstructor changed in v8 from($pop, $logger)to($logger); usesUtils::isDeployerVersionto select the right callWpCliIntegrationTest.php— migrated mock assertions from->with($host, $command, $options)to->willReturnCallback(...)because v8'sProcessRunner::run()dropped the third$optionsparameterDatabaseTasksFunctionalTest.php— replaced exact"Task X failed"string assertions with OR regex (/failed|error/i) to cover v7's and v8's different error output formatsDependencies
composer.json: constraint updated to^7.3 || ^8.0,composer-runtime-api ^2.0added torequire(formalises theInstalledVersionsdependency), Symfony dev deps widened to^6.4 || ^7.4.0 || ^8.0.0