[Discovery] Replace Discoverer by-ref plumbing with DiscoveryState accumulator - #48
Open
chr-hertel wants to merge 1 commit into
Open
[Discovery] Replace Discoverer by-ref plumbing with DiscoveryState accumulator#48chr-hertel wants to merge 1 commit into
chr-hertel wants to merge 1 commit into
Conversation
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.
Closes #19.
Discoverer::processMethod()was a 90-line switch over four attribute classes mutating five by-reference out-parameters. Now:processMethod()returns a single element reference (or null), dispatching to four small per-attribute builders.processFile()anddiscover()thread an immutableDiscoveryStatethrough instead of five&$refs; the newDiscoveryState::add()keys each element by its identity (tool/prompt name, resource URI, template URI template).$discoveredCountbookkeeping is gone — the final log derives counts from the state.Scope note: the issue's other two sub-findings —
Builder::add()match and theReferenceHandler::handle()cascade — are left out here; they belong with #10/#12.Tests, php-cs-fixer, and phpstan all green;
DiscoveryState::add()got dedicated tests.Confidence: 9/10 — pure structural refactor, discovery output and keying unchanged, full unit suite passes; only exotic behavioral delta is that subclasses of the Mcp* attributes (matched via IS_INSTANCEOF but previously dropped by the exact-classname switch) are now processed.