RFC: decompose WeavingTransformer into TokenStreamEditor + TraitConverter

Chiusa
#638 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@lisachenko ci sta già lavorando.

Dal 29/10/2026.

  • #778 di @lisachenko — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Enhancement To Be Discussed

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.
  • WeavingTransformer keeps 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.

Lingua principale
PHP
Stelle
1.7k
Fork
166
Merge medio
1g 5h
PR unite (30g)
30

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di goaop/framework

Tutte le issue di goaop/framework

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.