-
Notifications
You must be signed in to change notification settings - Fork 0
Chore: Plugin refactoring according to PSR4 #17
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the OneUpdate plugin to follow PSR-4 autoloading standards and modern PHP best practices. The refactoring reorganizes code into logical modules, improves code organization, implements proper encryption for sensitive data, and enhances the development tooling infrastructure.
Key changes:
- Migrated from classmap autoloading to PSR-4 namespace structure under
OneUpdate\Modules\* - Implemented encryption for sensitive credentials (API keys, GitHub tokens, S3 credentials)
- Enhanced build tooling with TypeScript support and improved webpack configuration
- Added comprehensive code quality tools (PHPStan, expanded PHPCS rules)
- Restructured REST API controllers with a base abstract class
Reviewed changes
Copilot reviewed 88 out of 95 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.js | Updated build paths and added TypeScript support with path aliases |
| uninstall.php | Enhanced multisite support and comprehensive cleanup |
| tsconfig.json | Added TypeScript configuration with strict type checking |
| phpunit.xml.dist | New PHPUnit configuration for testing |
| phpstan.neon.dist | Added static analysis configuration |
| phpcs.xml.dist | Comprehensive PHPCS rules with Slevomat standards |
| package.json | Updated dependencies and build scripts |
| oneupdate.php | Simplified entry point using autoloader |
| inc/Main.php | New main plugin class with registrable pattern |
| inc/Autoloader.php | PSR-4 autoloader with graceful failure handling |
| inc/Encryptor.php | AES-256-GCM encryption for sensitive data |
| inc/Modules/* | Reorganized code into logical modules |
| inc/Contracts/* | Interfaces and traits for architecture |
| composer.json | Updated to PSR-4 autoloading with modern dev dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
justlevine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
As with previous migrations, I'm not sure what exactly is preexisting and what is from the refactor (for some reason git isn't recognizing them as renames), so use your discretion
| "composer/installers": true | ||
| }, | ||
| "platform": { | ||
| "php": "8.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentionally PHP 8.1 and not 8.0? If so we should update the docs + plugin headers + phpcs/phpstan configs. If not, we should drop this + the require below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes as aws/aws-sdk-php requires minimum 8.1 PHP.
https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-php-runtimes-8-0-x-and-below-in-the-aws-sdk-for-php/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, make sure to bump readme.txt and remove it from the (commented out) phpunit matrix in test.yml
justlevine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once those last 2 comments are handled, go ahead and merge - no reason to wait on me.
|
Merging since it's already being approved. |
Overview
This PR refactors the OneUpdate plugin to follow PSR-4 autoloading standards and modern PHP best practices, improving code organization, maintainability, and developer experience.
Code Organization & Architecture
PSR-4 Autoloading: Restructured all PHP classes to follow PSR-4 naming conventions and directory structure
Namespace Organization: Organized code into logical modules under OneUpdate\Modules*
Checklist
npm run changeset.