prettier / prettier/plugin-php
Bug: Prettier incorrectly adds parentheses when using new with a static property
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- PHP
- Sterne
- 1.9k
- Forks
- 139
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Description:
When formatting code with Prettier in PHP 8.4, parentheses are incorrectly added to a static property when instantiating an object. This causes a syntax error and breaks the application.
Example:
Before Prettier:
$identifier = new Yii::$app->class([]);
After Prettier:
$identifier = new Yii::$app()->class([]);
Expected behavior:
Prettier should leave the code as-is without adding parentheses when using new on a static property.
Actual behavior:
Prettier adds () to the static property, resulting in invalid syntax.
Impact:
Code breaks when executed, causing runtime errors in applications using this pattern.
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 damit, das PHP-8.4-Beispiel aus dem Issue mit Prettier zu reproduzieren, und vergleiche den Code vor und nach der Formatierung. Die Aufgabe ist erledigt, wenn die statische Eigenschaft im Muster new Yii::$app->class([]) ohne hinzugefügte Klammern erhalten bleibt und der resultierende PHP-Code gültig bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100