You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2519e02
Browse filesBrowse the repository at this point in the historyBrowse files
Prefix the Phar's third-party dependencies into third_party/
Replaces the earlier approach on this branch, which rewrote vendor/ in
place from a separate build step.
WP-CLI registers its autoloader before WordPress boots, so for any class
shipped both by the Phar and by the site's own vendor/ the Phar's copy wins.
A site depending on psr/log v3 therefore loads the Phar's psr/log v1 and
fatals on the incompatible LoggerInterface signature.
Composer's dependency tree (composer/composer and everything it pulls in,
resolved from installed.json) is now rewritten under the WP_CLI\Vendor
namespace into third_party/, which gets its own classmap autoloader that
php/boot-phar.php registers. vendor/ is left untouched; utils/make-phar.php
bundles third_party/ instead of the original packages and drops them from
the main autoload maps, so the Phar stops advertising the unprefixed names.
A Composer-based installation of the bundle is unaffected.
The prefixing runs as Composer's post-install-cmd/post-update-cmd hook
(`composer prefix-dependencies`) rather than as a separate build step. The
php-scoper toolchain needs PHP 8.2+ while the bundle targets 7.2, so it
lives in utils/scoper/composer.json with a committed lock file; on an older
PHP the hook skips with a notice and a Phar built from that checkout
bundles the unprefixed tree. CI that must test on older PHP installs the
toolchain with a recent interpreter first and hands it over through
WP_CLI_SCOPER_PHP, as the deployment test matrix now does. The build job
refuses to build a Phar without third_party/.
`Composer\` itself stays unprefixed so that third-party Composer plugins
run by `wp package install` keep implementing the real interfaces, and the
Symfony polyfills are copied verbatim since they only work under their
global names. The hook verifies that the generated classmap advertises
nothing else under an original name, and that no bundled WP-CLI package
depends on a prefixed namespace.
See wp-cli/wp-cli#5920
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BrV8jGVsfiypo6buRmZfug
0 commit comments