20: Give the two WordPress plugin questions a folder of their own - #34
Open
nikolaystrikhar wants to merge 2 commits into
Open
20: Give the two WordPress plugin questions a folder of their own#34nikolaystrikhar wants to merge 2 commits into
nikolaystrikhar wants to merge 2 commits into
Conversation
Plugin_Checker and Plugin_Deactivator are the only files that touch WordPress's own plugin functions, both through Traits\Loads_Plugin_Functions, and they sat in the root of src/ beside the facades with their interfaces in src/Contracts/. They are now src/Plugin/: Checker, Deactivator, and Contracts/ holding Checker_Interface and Deactivator_Interface. Both classes and both interfaces lose the Plugin_ prefix, because the folder is now spelling it. That renames two host seams, which is free until 1.0.0 tags and would not be after; the alternative, Plugin\Plugin_Checker_Interface, stutters in all four names and buys nothing a host can use. src/Contracts/ is down to Activator_Interface and Provider_Interface, and the root of src/ to the seven files a host is likely to name.
The trait exists so that Checker and Deactivator can pull in wp-admin/includes/plugin.php, and nothing else uses it. src/Traits/ is for what cuts across folders, which Guards_Hook_Prefix does and this does not. Its name keeps the Plugin_ the two classes just dropped, because it does not mean the same thing: the folder is the subject "a WordPress plugin", and the name is about the functions in plugin.php.
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.
What: moves
Plugin_Checker,Plugin_Deactivator, their two interfaces andLoads_Plugin_Functionsintosrc/Plugin/asChecker,Deactivator,Contracts\Checker_InterfaceandContracts\Deactivator_Interface. No behaviour changes.Usage:
Why this way:
These are one subject. They are the only files that touch WordPress's own plugin functions, and the trait that pulls in
plugin.phphas no other consumer — so a folder, rather than two root-level classes with their interfaces in the catch-allContracts\and their trait in the cross-cuttingTraits\.All four class and interface names lose the
Plugin_prefix, because the folder now spells it. That renames two host seams, which is free until 1.0.0 tags and would not be after;Plugin\Plugin_Checker_Interfacestutters in every name and buys nothing a host can use. The trait keeps its prefix — the folder means "a WordPress plugin", the name means "the functions inplugin.php".src/Contracts/is down toActivator_InterfaceandProvider_Interface, and the root ofsrc/from eleven files to seven.