We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, attributes used on constructor properties are forcefully placed inline with the property (or above if it doesn't fit the print width).
This can result in chaotic code where the types and names of the properties are all over the place, making it much harder to scan.
I feel like it would be better to allow the attributes to retain their original placement, as long as everything fits within the print width.
Here's an example of this happening:
@prettier/plugin-php v0.22.2 Playground link
Input:
<?php class VariantData extends Data { public function __construct( #[Exists(Variant::class, 'id')] public int|Optional $id, public int|null $media_id, #[RequiredWithout('id'), Filled, StringType, Max(255)] public string $title, #[RequiredWithout('id'), Numeric, Min(0)] public string $price, #[Numeric, Min(0)] public string|null $compare_at_price, #[Min(0)] public int $min_stock, ) { } }
Output:
<?php class VariantData extends Data { public function __construct( #[Exists(Variant::class, 'id')] public int|Optional $id, public int|null $media_id, #[ RequiredWithout('id'), Filled, StringType, Max(255), ] public string $title, #[RequiredWithout('id'), Numeric, Min(0)] public string $price, #[Numeric, Min(0)] public string|null $compare_at_price, #[Min(0)] public int $min_stock, ) { } }
The text was updated successfully, but these errors were encountered:
Yes, appears that this would be in line with the latest PER CS for Attributes https://www.php-fig.org/per/coding-style/#12-attributes
Following the spec it looks like all attributes should be on their own line. I am not sure if we want this in closures parameters though.
Sorry, something went wrong.
No branches or pull requests
Currently, attributes used on constructor properties are forcefully placed inline with the property (or above if it doesn't fit the print width).
This can result in chaotic code where the types and names of the properties are all over the place, making it much harder to scan.
I feel like it would be better to allow the attributes to retain their original placement, as long as everything fits within the print width.
Here's an example of this happening:
@prettier/plugin-php v0.22.2
Playground link
Input:
Output:
The text was updated successfully, but these errors were encountered: