prettier / prettier/plugin-php
Improve formatting of heredoc/nowdoc
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- PHP
- Sterne
- 1.9k
- Forks
- 139
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
As suggested in https://github.com/prettier/plugin-php/issues/1274#issuecomment-570709723:
I'd say, it would be The Prettier Way™ (and also the prettier way ) to figure out one way to print heredocs and to enforce that.
One process which sounds reasonable to me: If the starting tag goes on its own line, align the content with that. Otherwise indent it one
tabWidthfurther.Examples of the described rule
Example 1
The heredoc-opening tag goes on its own line.
Input:
some_function(<<<'EOT' Hello World! EOT );Current output:
some_function( <<<'EOT' Hello World! EOT );Envisioned output:
some_function( <<<'EOT' Hello World! EOT );Example 2
The heredoc-opening tag goes on the same line as the preceding code.
Input:
$string = <<<'EOT' Hello World! EOT;Current output:
$string = <<<'EOT' Hello World! EOT;Envisioned output:
$string = <<<'EOT' Hello World! EOT;
The first example is actually already printed correctly, but the second one isn't (playground)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit den verknüpften Playground-Beispielen zur Formatierung von heredoc und nowdoc und vergleiche die aktuelle mit der vorgesehenen Ausgabe. Fertig bedeutet, dass der Formatter Inhalte und schließende Tags konsistent ausrichtet, je nachdem, ob sich das öffnende Tag in einer eigenen Zeile befindet oder auf Code folgt, mit Abdeckung der gezeigten Fälle.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100