You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Various comments inside attributes are moved to really weird places instead of staying where they were.
The example below is not the only one where something like this happens. There are a few other scenarios like e..g for a parameter etc.
Prettier 2.88.0 (but also tried the latest)
PHP Plugin 0.19.6 (but also tried the latest)
# Options (if any):
--no-options
Input:
<?phpdeclare(strict_types=1);
namespaceApp\Controller\General;
useApp\Dto\BarDto;
useSymfony\Bundle\FrameworkBundle\Controller\AbstractController;
useSymfony\Component\HttpFoundation\Request;
useSymfony\Component\HttpFoundation\Response;
useSymfony\Component\Routing\Annotation\Route;
class EnrollmentController extends AbstractController
{
#[Route(path: '/foo', name: 'app.foo', methods: [
Request::METHOD_GET, // GET is required for third party app.
Request::METHOD_POST,
])]
publicfunctionsave(): Response
{
return$this->json(['foo']);
}
}
Output:
<?phpdeclare(strict_types=1);
namespaceApp\Controller\General;
useApp\Dto\BarDto;
useSymfony\Bundle\FrameworkBundle\Controller\AbstractController;
useSymfony\Component\HttpFoundation\Request;
useSymfony\Component\HttpFoundation\Response;
useSymfony\Component\Routing\Annotation\Route;
class EnrollmentController extends AbstractController // GET is required for third party app.
{
#[Route(path: '/foo', name: 'app.foo', methods: [Request::METHOD_GET, Request::METHOD_POST])]
publicfunctionsave(): Response
{
return$this->json(['foo']);
}
}
Expected behavior:
Output should keep the comment where it was. IT definitely should not be moved to the class:
<?phpdeclare(strict_types=1);
namespaceApp\Controller\General;
useApp\Dto\BarDto;
useSymfony\Bundle\FrameworkBundle\Controller\AbstractController;
useSymfony\Component\HttpFoundation\Request;
useSymfony\Component\HttpFoundation\Response;
useSymfony\Component\Routing\Annotation\Route;
class EnrollmentController extends AbstractController
{
#[Route(path: '/foo', name: 'app.foo', methods: [
Request::METHOD_GET, // GET is required for third party app.
Request::METHOD_POST
])]
publicfunctionsave(): Response
{
return$this->json(['foo']);
}
}
This seems to be the case for quite some time as even the old version on the playground shows the issue: Link to playground
The text was updated successfully, but these errors were encountered:
Got the same thing happenning, but instead of only moving, it also duplicates.
I got that simple thing with a PHPDoc so my IDE doesn't tell me my var is undefined (I know I could work around it but I just find this easier for now)
Various comments inside attributes are moved to really weird places instead of staying where they were.
The example below is not the only one where something like this happens. There are a few other scenarios like e..g for a parameter etc.
Prettier 2.88.0 (but also tried the latest)
PHP Plugin 0.19.6 (but also tried the latest)
# Options (if any): --no-options
Input:
Output:
Expected behavior:
Output should keep the comment where it was. IT definitely should not be moved to the class:
This seems to be the case for quite some time as even the old version on the playground shows the issue: Link to playground
The text was updated successfully, but these errors were encountered: