-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefix dependencies with PHP-Scoper #879
base: trunk
Are you sure you want to change the base?
Conversation
@ernilambar FWIW the issue is that the latest PHP-Scoper requires PHP 8.2. This could be mitigated by installing that dependency with PHP 8.2 separate from the others, run the prefixing, then downgrade again. |
@ernilambar I think it's very close now, after having fixed most of the namespace/autoloader issues. The last one seems to be specifically Don't yet know why because it doesn't really happen to me locally. |
All the production dependencies required by Plugin Check are prefixed and stored in
vendor-prefixed
. This includes:afragen/wordpress-plugin-readme-parser
plugin-check/phpcs-sniffs
squizlabs/php_codesniffer
This avoids any autoloading conflicts in case another plugin uses the same dependencies.
The plugin's own classes are autoloaded with a new slim autoloader in
includes/vendor
. No actual dependencies are in there, it's just a classmap.For
afragen/wordpress-plugin-readme-parser
there is a special case: if the plugin is running on WordPress.org, the original and unprefixedWordPressdotorg\Plugin_Directory\Readme\Parser
is available, so there is aclass_exists
check to use that one if available.Unfortunately right now requires dependencies to be prefixed manually by installing PHP-Scoper in that other directory & running
composer prefix-dependencies
Fixes #328