RFC: decompose WeavingTransformer into TokenStreamEditor + TraitConverter
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
The target is src/Instrument/Transformer/WeavingTransformer.php (1037 lines, 20 methods); read it whole and map which methods belong to token surgery, class/enum→trait conversion, and orchestration. The safety net is the fixture suite under tests/Core/Instrument/Transformer/_files/*, which must stay byte-for-byte identical. Done means the two new services are extracted, WeavingTransformer only matches advisors → converts → writes cache, and the fixtures still pass unchanged — but cut lines are explicitly still under discussion, so the first step is agreeing on the boundaries, not editing.
Written by the indexing model from the issue text.
Description
Problem
src/Instrument/Transformer/WeavingTransformer.php is 1037 lines / 20 methods owning: advisor-matching orchestration, class→trait conversion (:255), enum→trait conversion (:454), #[\Override] stripping (:543), attribute-group stripping (:345), promoted-property demotion (:766), constructor-assignment injection (:830), token-blanking helpers (:386, :404, :894, :935), function proxying (:958), and cache writing (~:996). It is the highest-churn, highest-risk file in the repo — most recent audit commits touched it.
Proposed decomposition (for discussion)
- TokenStreamEditor: the token surgery helpers (blanking, splicing, line-preserving edits) as a directly unit-testable service.
- TraitConverter: class→trait and enum→trait conversion, including
#[\Override]/attribute handling and promoted-property demotion. WeavingTransformerkeeps orchestration: match advisors → convert → write cache.
Pure refactor; the fixture suite (tests/Core/Instrument/Transformer/_files/*) must stay byte-for-byte green. Effort L, risk medium. Needs discussion on cut lines before implementation.
- Dominant language
- PHP
- Stars
- 1.7k
- Forks
- 166
- Avg merge
- 11h 20m
- Merged PRs (30d)
- 37
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from goaop/framework
-
Intercepting a method imported from a trait with #[\Override] fails: OriginalAlias "has #[\Override] attribute, but no matching parent method exists"Possibly taken @lisachenko claimed this 5 days ago. OpenBug PHP8.4
Difficulty 3/5 Half a day Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Several woven classes in one file: their proxies overwrite each other, all but the last class are lost (Class not found)Possibly taken @lisachenko claimed this 5 days ago. OpenBug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
Enhancement Performance
Difficulty 5/5 Over a week Newbie friendliness 35/100
goaop/framework#747 · 1 comment ·
Maintainers usually reply within 1 day
-
Enhancement Performance To Be Discussed
Difficulty 3/5 Half a day Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Feature
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
Similar issues
-
HttpRequestTrait fatals on WordPress 7.2: $blocked_http_requests clashes with WP_UnitTestCase_BaseOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pluginsGLPI/addressing#127 ·