Skip to content

Rename PHP namespace to Torounit\WP\Schedule_Terms - #6

Merged
torounit merged 1 commit into
mainfrom
refactor/namespace-torounit
Jun 18, 2026
Merged

Rename PHP namespace to Torounit\WP\Schedule_Terms#6
torounit merged 1 commit into
mainfrom
refactor/namespace-torounit

Conversation

@torounit

Copy link
Copy Markdown
Owner

Summary

  • Rename the PHP namespace from HAMWORKS\WP\Schedule_Terms to Torounit\WP\Schedule_Terms to align with the torounit/schedule-terms composer package and GitHub ownership.
  • Update the PSR-4 mapping in composer.json accordingly.
  • Add includes/compat.php (loaded via composer's files autoload) that registers class_alias() shims for every old HAMWORKS\WP\Schedule_Terms\* class name, so any third-party code still referencing the old FQCNs keeps working (new, instanceof, type hints, class_exists()).
  • Note the rename in the README's Unreleased changelog entry.

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. The class_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, and get_class()-based string-equality checks against the old name (since get_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 --lock run cleanly
  • composer lint passes
  • npm run test:php (PHPUnit via wp-env) passes
  • Verified via wp eval on a running wp-env site that both class_exists('HAMWORKS\WP\Schedule_Terms\Plugin') and class_exists('Torounit\WP\Schedule_Terms\Plugin') return true, and the plugin activates without fatal errors

…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.
@torounit
torounit merged commit 6bb917b into main Jun 18, 2026
9 checks passed
@torounit
torounit requested a review from Copilot June 18, 2026 23:01

Copilot AI left a comment

Copy link
Copy Markdown

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 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.php via autoload.files to provide class_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.

Comment thread includes/compat.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants