Rename PHP namespace to Torounit\WP\Schedule_Terms - #6
Merged
Conversation
…ounit\WP\Schedule_Terms Align the namespace with the actual torounit/schedule-terms package and GitHub ownership. Update the PSR-4 mapping in composer.json accordingly, and add includes/compat.php (loaded via composer's "files" autoload) to register class_alias() shims for every old HAMWORKS\WP\Schedule_Terms\* class name so third-party code referencing the old FQCNs keeps working. This plugin doesn't serialize any of these objects into the database and isn't consumed as a library, so the rename carries minimal compatibility risk; the shim is removed in a future major release once the old namespace is no longer supported.
There was a problem hiding this comment.
Pull request overview
This PR renames the plugin’s internal PHP namespace from HAMWORKS\WP\Schedule_Terms to Torounit\WP\Schedule_Terms to match the torounit/schedule-terms Composer package name and current repository ownership, while preserving backward compatibility via class aliases.
Changes:
- Updated namespaces/usages across plugin PHP sources and PHPUnit tests to
Torounit\WP\Schedule_Terms. - Updated Composer PSR-4 autoload mapping and added
includes/compat.phpviaautoload.filesto provideclass_alias()shims for legacy FQCNs. - Documented the namespace rename in the README changelog and ignored PHPUnit result cache in
.gitignore.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/php/Term_Manager_Test.php | Updates test namespace/imports to the new Torounit namespace. |
| tests/php/Schedule_Test.php | Updates test namespace/imports to the new Torounit namespace. |
| schedule-terms.php | Updates plugin bootstrap to instantiate the Torounit\WP\Schedule_Terms\Plugin class. |
| README.md | Notes the namespace rename and compatibility alias plan in the Unreleased changelog. |
| includes/Term/UI.php | Renames the Term\UI namespace to the new root prefix. |
| includes/Term_UI.php | Updates namespace and use import for the new Term\UI FQCN. |
| includes/Term_Meta.php | Renames namespace to the new root prefix. |
| includes/Term_Manager.php | Renames namespace to the new root prefix. |
| includes/Schedule.php | Renames namespace to the new root prefix. |
| includes/Post_Meta.php | Renames namespace to the new root prefix. |
| includes/Plugin.php | Renames namespace to the new root prefix. |
| includes/Assets.php | Renames namespace to the new root prefix. |
| includes/compat.php | Introduces legacy HAMWORKS\... to Torounit\... class alias shims. |
| composer.json | Updates PSR-4 mappings and adds autoload.files entry for compat shims. |
| composer.lock | Updates the lockfile content hash after Composer changes. |
| .gitignore | Ignores .phpunit.result.cache. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
HAMWORKS\WP\Schedule_TermstoTorounit\WP\Schedule_Termsto align with thetorounit/schedule-termscomposer package and GitHub ownership.composer.jsonaccordingly.includes/compat.php(loaded via composer'sfilesautoload) that registersclass_alias()shims for every oldHAMWORKS\WP\Schedule_Terms\*class name, so any third-party code still referencing the old FQCNs keeps working (new,instanceof, type hints,class_exists()).Compatibility notes
This plugin is self-contained (bootstraps itself via
new Plugin()) and isn't consumed as a library, and none of these objects are ever serialized into the database (post/term meta only store scalars/arrays), so the rename carries minimal risk. Theclass_alias()shim covers the realistic compatibility cases (new,instanceof, type hints,class_exists()). Two edge cases it can't fully cover are out of scope given the above: code that references the old FQCN at file top-level before this plugin's autoloader has run, andget_class()-based string-equality checks against the old name (sinceget_class()always returns the canonical name). The shim is intended to be removed in a future major release.Test plan
composer dump-autoload/composer update --lockrun cleanlycomposer lintpassesnpm run test:php(PHPUnit via wp-env) passeswp evalon a running wp-env site that bothclass_exists('HAMWORKS\WP\Schedule_Terms\Plugin')andclass_exists('Torounit\WP\Schedule_Terms\Plugin')returntrue, and the plugin activates without fatal errors