prettier / prettier/plugin-php
Some comment positions inside attributes can result in prettier failing with an exception
Nessuno ha ancora preso questa issue.
- Lingua principale
- PHP
- Stelle
- 1.9k
- Fork
- 139
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Not sure which cases these include exactly but some cases result in pretter stopping with an error:
Error: Comment "// abc" was not printed. Please report this error!
I know that i was also able to produce that error with other positions, but various other work fine so it is a bit weird.
Playground also shows it: Link to playground
Prettier 2.88.0 (but also tried latest)
PHP Plugin 0.19.6 (but also tried latest)
# Options (if any):
--no-options
Input:
<?php declare(strict_types=1);
namespace App\Controller\General;
use App\Dto\BarDto;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
class EnrollmentController extends AbstractController
{
public function save(
#[
MapRequestPayload(
serializationContext: [ // abc
AbstractNormalizer::CALLBACKS => [
'abc' => 'trim',
],
],
),
]
BarDto $data,
): Response {
return $this->json(['foo']);
}
}
Output:
None. Errror as mentioned above.
Expected behavior:
No error and correctly formatted.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci l’eccezione con l’input PHP fornito nel playground collegato o nell’ultima versione del plugin, quindi traccia la gestione dei commenti del plugin PHP per i commenti all’interno degli attributi. L’attività è completata quando l’input viene formattato correttamente e conserva il commento senza l’errore “Comment was not printed”.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100