Register declaratively and remove the root entry-point class#46
Merged
Conversation
Move the remaining procedural registration out of the root SemanticExternalQueryLookup class into the namespace. The extension function is retained (it must run setup-time PHP for the class_alias calls, which have no declarative equivalent) but relocated to SEQL\Setup::onExtensionFunction, reading seqlgExternalRepositoryEndpoints directly from the populated config global. - Add SEQL\Setup with the class_alias calls (SMWExternalQueryLookup, SMWExternalAskQueryLookup) and the HookRegistry registration. - Point extension.json ExtensionFunctions at SEQL\Setup::onExtensionFunction and drop AutoloadClasses; the class now autoloads via AutoloadNamespaces. - Drop load_composer_autoloader: there is no composer autoload block and no third-party runtime dependency, so there is nothing local to load. - Drop the SEQL_VERSION constant and SemanticExternalQueryLookup::getVersion(); the test bootstrap now reads the version from extension.json. - Delete the root SemanticExternalQueryLookup.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
Completes the move of this extension's registration into
extension.json, eliminating the legacy procedural entry point. Settings were already declarative (config+config_prefix: seqlg); this change removes the last procedural piece — the rootSemanticExternalQueryLookupclass and itsExtensionFunctionscallback.Why an extension function is kept (not fully declarative)
The callback set up two
class_aliascalls —SMWExternalAskQueryLookup(the documented public name used in$smwgQuerySources) and the deprecatedSMWExternalQueryLookup.class_aliashas no declarative equivalent inextension.jsonand must run at setup time, so a thin extension function is unavoidable here. It is now a namespacedSEQL\Setup::onExtensionFunctionrather than a root-class static method.Changes
SEQL\Setupholding theclass_aliascalls and theHookRegistryregistration, readingseqlgExternalRepositoryEndpointsdirectly from the populated config global.extension.json: pointExtensionFunctionsatSEQL\Setup::onExtensionFunction; dropAutoloadClasses(the class now autoloads viaAutoloadNamespaces).load_composer_autoloader: there is no composerautoloadblock and no third-party runtime dependency (requireisphp+composer/installersonly — themediawiki/http-requestruntime dep was already removed), so there is nothing local to load.SEQL_VERSIONconstant andSemanticExternalQueryLookup::getVersion(); the test bootstrap now reads the version fromextension.json.SemanticExternalQueryLookup.php.No user-facing configuration changes: the
seqlg*globals, theSMWExternalAskQueryLookup/SMWExternalQueryLookupaliases, and all hook behavior are preserved.Verification
Run in the docker-compose-ci stack against MW 1.43 / SMW
dev-master:composer analyzeclean (parallel-lint + PHPCS + minus-x, no warnings).composer phpunitgreen (101 tests, 194 assertions).eval.php:seqlg*config globals populated;InterwikiLoadPrefix,smwAskParserFunction,smwShowParserFunctionregistered in the hook container;SEQL\Setuppresent; rootSemanticExternalQueryLookupclass gone; bothSMWExternal*aliases resolve toSEQL\ByHttpRequestQueryLookup;SEQL_VERSIONno longer defined.#askparses with no error/exception markup, and invoking the registeredsmwAskParserFunctionhandler through the hook container correctly gates thesource=parameter by namespace — confirming the relocated callback wires a working handler end-to-end.