We are using Prettier (with the PHP plugin) in our project, and after changing Doctrine data format from annotations to attributes in Skipper, we ran into issues. The first export from Skipper goes fine, then Prettier formats those attributes a little differently than Skipper did. They are still valid PHP after prettier formatting, but then when exporting from Skipper again, the result is a syntax error (Prettier's output of course depends on settings, but mostly I think the issue is with changing them from one single line to multiple lines, or the trailing comma).
Here's an example:
After first export from Skipper:
#[ORM\Entity(repositoryClass: "Our\AppBundle\Entity\Repository\DataRepository")]
#[ORM\Table(name: "data", options: ["collate"=>"utf8_swedish_ci"])]
class Data
{
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: \Our\AppBundle\Entity\Document::class)]
#[ORM\JoinColumn(name: "document", referencedColumnName: "id", nullable: false)]
private $Document;
// ...
After Prettier formatting:
#[
ORM\Entity(
repositoryClass: 'Our\AppBundle\Entity\Repository\DataRepository',
),
]
#[ORM\Table(name: 'data', options: ['collate' => 'utf8_swedish_ci'])]
class Data
{
#[ORM\Id]
#[
ORM\ManyToOne(
targetEntity: \Our\AppBundle\Entity\Document::class,
),
]
#[
ORM\JoinColumn(
name: 'document',
referencedColumnName: 'id',
nullable: false,
),
]
private $Document;
// ...
Then exporting from Skipper again (without any schema changes):
#[, ORM\Entity(repositoryClass: "Our\AppBundle\Entity\Repository\DataRepository")]
#[ORM\Table(name: "data", options: ["collate"=>"utf8_swedish_ci"])]
class Data
{
#[]
#[, ORM\Id]
#[ORM\ManyToOne(targetEntity: \Our\AppBundle\Entity\Document::class), ORM\JoinColumn(name: "document", referencedColumnName: "id", nullable: false)]
private $Document;
// ...
And that PHP file is invalid and causes syntax error when trying to run the app. Of course Skipper doesn't need to know how to output similar formatting as Prettier, but the expected result would be that when nothing has been changed, then Skipper export doesn't modify the files. And when something has been changed, it can output same way that it originally did, and any formatting on that can be done after the export.
Skipper version is the latest (3.5.0.1878)