-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor Event Manager #1
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 Event Manager package by splitting functionality into two distinct classes (EventManager and PluginApiManager), significantly modernizing the codebase with PHP 7.4+ requirements, and adding comprehensive test coverage. The refactoring follows proper dependency injection patterns and includes both unit and integration tests.
Key changes:
- Split event management into EventManager (business logic) and PluginApiManager (WordPress Plugin API wrapper)
- Added comprehensive unit and integration test suites with dedicated test infrastructure
- Upgraded minimum PHP version from 5.6 to 7.4 and modernized all dependencies
- Implemented strict type declarations throughout the codebase
- Added PHPStan, updated PHPCS rules, and GitHub Actions workflows for automated testing
- Updated namespace from WP_Media to WPMedia for consistency
Reviewed changes
Copilot reviewed 37 out of 40 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| inc/EventManager.php | Core event manager class that handles subscriber registration/removal using dependency-injected PluginApiManager |
| inc/PluginApiManager.php | New wrapper class for WordPress Plugin API functions (add_filter, remove_filter, etc.) |
| inc/SubscriberInterface.php | Interface defining the contract for event subscribers |
| inc/EventManagerAwareSubscriberInterface.php | Interface for subscribers that need access to the EventManager instance |
| tests/Unit/* | Unit tests for EventManager and PluginApiManager using mocks |
| tests/Integration/* | Integration tests for EventManager and PluginApiManager using actual WordPress functions |
| tests/Fixtures/DummySubscriber.php | Test fixture implementing SubscriberInterface for testing |
| phpcs.xml.dist | Updated PHP CodeSniffer configuration for WordPress standards with PHP 7.4+ compatibility |
| phpstan.neon.dist | New PHPStan static analysis configuration |
| composer.json | Updated dependencies, autoload paths, PHP version requirement (7.4+), and test scripts |
| README.md | Enhanced documentation with installation, initialization, and usage examples |
| .github/workflows/* | New GitHub Actions workflows for PHPUnit, PHPStan, and PHPCS |
| bin/install-wp-tests.sh | Shell script for installing WordPress test suite |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Pull request overview
This PR refactors the Event Manager package by splitting functionality into two distinct classes (EventManager and PluginApiManager), significantly modernizing the codebase with PHP 7.4+ requirements, and adding comprehensive test coverage. The refactoring follows proper dependency injection patterns and includes both unit and integration tests.
Key changes: