Simplify slice 1g: move the 10 most-wired leaf methods out of HtmlCompilation and delete their 33 closures
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Move each method to its natural owner:
htmlPreservationBlockgoes ontoSourceBlockCreator, or a small service next to it. Converters already receiveSourceBlockCreator.- 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.
- 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.
HtmlCompilation's own internal call sites call the new owner directly. Delete the methods fromHtmlCompilation.- 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.phpline change, and net lines (which must go down). - No new tests.
AI assistance: measured and scoped by Claude Opus (Anthropic) via Pi/Roadie.
- Ngôn ngữ chính
- PHP
- Star
- 25
- Fork
- 3
- Merge trung bình
- 2 giờ 20 phút
- Pull request đã merge (30 ngày)
- 934
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Automattic/blocks-engine
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/blocks-engine#4943 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/blocks-engine#4942 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Automattic/blocks-engine#4921 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Automattic/blocks-engine#775 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
Automattic/blocks-engine#5170 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Automattic/blocks-engine
Issue tương tự
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Plugin directory: block icon SVG loses elements other than <path> in the Blocks sectionCó thể đã có người làm @obenland đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
WordPress/wordpress.org#1209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs good first issue php
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày