The plugin docs say new, not getClass - #182
Merged
Merged
Conversation
fogproject retired the literal getClass('X') in favour of a plain new
(its ADR 0043), across core and fog-plugins. These are the published
copies of the two developer docs that told plugin authors to do the
opposite.
What changed, and why it is not just a spelling preference: getClass()
is declared @return object|mixed, so nothing can check what you then do
with the result. Converting core's 459 literal sites surfaced 90 PHPStan
errors on a baseline that reported zero, every one a pre-existing
annotation that had drifted from its body. It was never a substitution
seam either -- qualify() consults core's map before the plugins', which
is what stops a plugin answering a core name.
Plugins spell it fully qualified rather than importing, because
fog-plugins' own core-references-are-qualified test refuses a bare core
name: that tree is fetched on its own and cannot assume a fogproject
checkout is nearby.
getClass() with a VARIABLE is unchanged and still documented -- it is
the one shape new cannot express.
English only. scripts/translate.mjs regenerates the six translations
from this source, so hand-editing them would be overwritten.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01684dJC9hw1jY4KjzV81BLC
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.
The published-docs half of FOGProject/fogproject#1710 and FOGProject/fog-plugins#38, which retired the literal
getClass('X')in favour of a plainnew(fogproject ADR 0043).These two files are the published copies of developer docs that currently tell plugin authors to do the opposite:
docs/development/plugin-development.md— the "one place a bare name still bites" section, theestablishSession()example, and the checklist bullet that reads "preferself::getClass('HelloWorld')… overnew".docs/development/storage-node-selection-hooks.md— thepickNode()example a hook author is meant to paste.Why it is not just a spelling preference
getClass()is declared@return object|mixed, so nothing can check what you then do with the result and no editor can follow it to a definition. Converting core's 459 literal sites surfaced 90 PHPStan errors against a baseline that reported zero — every one a pre-existing annotation that had drifted from its body (@return voidon a method endingreturn $queries;;@return objecton methods thatreturn false;, which made everyif (!$x->destroy())guard in the tree read as dead code).It was never a substitution seam either:
qualify()consults core's map before the plugins', which is what stops a plugin answering a core name.Plugins spell it fully qualified rather than importing, because fog-plugins' own
tests/core-references-are-qualified.test.phprefuses a bare core name — that tree is fetched on its own and cannot assume a fogproject checkout is nearby.getClass()with a variable is unchanged and still documented. That is the one shapenewcannot express, and it is what the function is for now.Translations
English only.
scripts/translate.mjsregenerates the six translations from this source, so hand-editingtranslations/*/development/*.mdwould be overwritten on the next run.🤖 Generated with Claude Code
https://claude.ai/code/session_01684dJC9hw1jY4KjzV81BLC