Dedupe transformer helpers duplicated by decomposition slices 3/4#270
Merged
Conversation
Refactor slices 3 (#246, SemanticParityReporter) and 4 (#249, FallbackEmitter) were file-scoped, so they copied shared leaf helpers instead of promoting them. Each of the following was byte-identical across its copies; consolidate the single definition into Support/DomHelpersTrait (already used by all three classes) and remove the duplicates: - hasAncestorTag (HtmlTransformer + SemanticParityReporter) - hasSourceNavigationSignal (HtmlTransformer + SemanticParityReporter) - safeNavigationUrl (HtmlTransformer + SemanticParityReporter) - runtimeIslandSelector (HtmlTransformer + FallbackEmitter) - eventMetadata (HtmlTransformer + FallbackEmitter) - isSafeSvgContent (HtmlTransformer + FallbackEmitter) - dedupeArrayRows (HtmlTransformer + FallbackEmitter) Behavior-preserving pure dedupe: no logic or signature changes. Canonical and parity (144 fixtures) identical before and after; full composer test green. Refs #242 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Refs #242
Dedupe helpers that were duplicated by HtmlTransformer decomposition slices 3 (#246,
Diagnostics/SemanticParityReporter) and 4 (#249,Diagnostics/FallbackEmitter). Those slices were file-scoped, so they copied shared leaf helpers instead of promoting them. This is a pure, behavior-preserving dedupe — parity is identical.What changed
Each helper below was confirmed byte-identical across all its copies (diffed before collapsing), then consolidated into the single existing home
Support/DomHelpersTrait(alreadyused by all three classes), with the duplicate copies removed:hasAncestorTaghasSourceNavigationSignalsafeNavigationUrlruntimeIslandSelectoreventMetadataisSafeSvgContentdedupeArrayRowsAlso removed a stray orphan docblock (
@param array<string, string> $attrs) that was left dangling aboveeventMetadatain HtmlTransformer.Intentionally left duplicated
While auditing, several other methods appear in both
HtmlTransformerandFallbackEmitter(recordRuntimeIsland,sourceContext,requiredScriptsForElement,captureCanvasFallback,captureInlineSvgFallback,captureScriptFallback,captureStaticScriptMetadata,captureTemplateFallback,isRuntimeCanvasTarget). These were diffed and found to have diverged — they are the decomposition delegation boundary, not duplication (e.g. HtmlTransformer'srecordRuntimeIslanddelegates to$this->fallbackEmitter, and itssourceContextcalls a resolver closure while FallbackEmitter holds the full implementation). They were left untouched.Behavior preservation
composer test:canonical— all pass, before and after.composer parity— 144 fixtures pass, identical before and after.composer test(canonical + parity + packaging) green.php -lclean on all four files. No fixtures touched. No logic/signature changes.Net: +109 / -217 lines (net -108).
Scope limited to
HtmlTransformer.php,Diagnostics/SemanticParityReporter.php,Diagnostics/FallbackEmitter.php,Support/DomHelpersTrait.php.🤖 Generated with Claude Code
DO NOT MERGE pending review.