Simplify slice 1g: move the 10 most-wired leaf methods out of HtmlCompilation and delete their 33 closures

Cerrado
#4,637 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
backend

Línea de trabajo

Read HtmlCompilation.php, the listed methods, and the consumers that receive them through constructor closures; inspect SourceBlockCreator and the existing style or presentation services to identify suitable owners. Trace the constructor wiring and internal call sites before moving the methods and removing closure parameters, fields, and forwarders. Run the php-transformer gates and compare output byte for byte; report closures removed, the HtmlCompilation.php line change, and net lines.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Part of #4368. Measured at trunk after #4634.

Problem

43 closure-wired methods in HtmlCompilation, behind 66 constructor closures, call no other HtmlCompilation method except createBlock and attr. They only use services, the session or static helpers, so they don't need to live in HtmlCompilation, and the closures exist only to reach them.

Scope: the 10 most-wired, 33 closures

Method Closures Lines Notes
htmlPreservationBlock 8 5 createBlock('core/html', safeFallbackHtml(..., tagMarkers))
disclosureControlPresentation 6 10
codePresentationAttributes 3 15
recognizePatterns 3 14
requiredScriptsForElement 3 11
runtimeAuthoredButton 2 32 uses createBlock
socialAnchorColors 2 14
rememberAccordionDisclosureRoot 2 9
imageDimensions 2 8
parsedCssSelector 2 5

Change

  1. Move each method to its natural owner:
    • htmlPreservationBlock goes onto SourceBlockCreator, or a small service next to it. Converters already receive SourceBlockCreator.
    • Presentation and attribute helpers go to the existing style or presentation service they read from.
    • Use a new small service only when no existing owner fits.
    • If a method has one consumer, move it into that consumer.
  2. Every consumer that received one of these methods as a closure gets the owning service instead. Delete those closure parameters, fields and forwarders, plus the constructor wiring.
  3. HtmlCompilation's own internal call sites call the new owner directly. Delete the methods from HtmlCompilation.
  4. Keep the change mechanical. The other 33 leaf methods are follow-up work.

Acceptance

  • Byte-identical output across all php-transformer gates.
  • The PR body reports closures removed (target 33), the HtmlCompilation.php line change, and net lines (which must go down).
  • No new tests.

AI assistance: measured and scoped by Claude Opus (Anthropic) via Pi/Roadie.

Lenguaje dominante
PHP
Estrellas
25
Forks
3
Merge medio
2 h 23 min
PR fusionados (30 d)
942

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Automattic/blocks-engine

Todos los issues de Automattic/blocks-engine

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.