Adopt silverassist/wp-plugin-kernel across all sub-plugins - #5
Merged
Conversation
Replaces each sub-plugin's own duplicated LoadableInterface + Plugin bootstrap with the shared silverassist/wp-plugin-kernel package, closing the gap documented after the wp-plugin-kernel rollout (7 other plugins already migrated; this monorepo was the one holdout). - Every component now implements the kernel's LoadableInterface (get_priority(): int, should_load(): bool, init(): void) instead of the old local priority()/register() contract, plus a static instance(): self method — AbstractPlugin's load_components() calls $class::instance() with no arguments. - The 3 Core/Plugin.php files shrink to extending AbstractPlugin with just get_components(): array (a list of class-strings); the singleton access, priority sort, and per-component error isolation are all inherited, not re-typed per plugin. - contentful-tables' TableDataLoader was constructor-injected into ShortcodeRegistrar/SettingsPage before this change — since kernel-managed components can't take constructor arguments, TableDataLoader became a proper singleton and the other two now fetch it via TableDataLoader::instance() in their own constructors. - graphql-shortcode-support already used get_priority()/should_load()/ init() method names independently (it converged on nearly the same shape as the kernel before the kernel existed) — its migration was just swapping the interface import and Plugin.php's base class. - Updated 3 READMEs' directory trees and CONTRIBUTING.md's documented interface contract, which still described the old local pattern (caught by a pre-PR core-review pass). Verified: make phpcs, make phpstan, and make build all clean across all three sub-plugins.
Clears the 'Node.js 20 is deprecated' warnings now surfacing on every CI job step (actions/checkout, actions/cache, actions/upload-artifact were still pinned to their Node 20 majors).
4 tasks
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
PR B1 of the standardization effort (see plan) — closes the wp-plugin-kernel rollout gap. This monorepo was the only SilverAssist WordPress plugin holdout still using a locally-duplicated bootstrap pattern instead of the shared
silverassist/wp-plugin-kernelpackage (already adopted in 7 other plugins).Changes
LoadableInterface-implementing class in the 3 sub-plugins now implements the kernel's interface (get_priority(): int,should_load(): bool,init(): void) instead of the old localpriority()/register()contract, plus a staticinstance(): selfsingleton method —AbstractPlugin::load_components()calls$class::instance()with no arguments.Core/Plugin.phpin all 3 sub-plugins now extendsAbstractPlugin, implementing onlyget_components(): array(a list of class-strings). Singleton access, priority-ordered loading, and per-component error isolation are inherited, not re-typed per plugin.contentful-tables'TableDataLoaderwas constructor-injected intoShortcodeRegistrar/SettingsPagebefore this — since kernel-managed components can't take constructor arguments,TableDataLoaderbecame a proper singleton and the other two now fetch it viaTableDataLoader::instance().graphql-shortcode-supporthad already independently converged on the sameget_priority()/should_load()/init()method names before the kernel existed — its migration was just swapping the interface import andPlugin.php's base class.Core/Interfaces/LoadableInterface.phpfiles are deleted.silverassist/wp-plugin-kerneladded torequire(runtime, not--dev) in all 3composer.json.Docs
A pre-PR
core-reviewpass caught 3 READMEs' directory trees andCONTRIBUTING.md's documented interface contract still describing the old local pattern — updated all 4.Verified
make phpcs,make phpstan, andmake buildall clean across all three sub-pluginscore-reviewpass (read-only subagent): confirmed every migrated class has all 4 required singleton pieces, no orphaned references to the deleted interface files,contentful-tables' DI-to-singleton change didn't leave any stalenew TableDataLoader()call sites, andcomposer.jsonchanges are validNot done in this PR (see plan)