Skip to content

Formatter: Option for stacking/grouping multiple attributes #1158

@klunejko

Description

@klunejko

Feature

Would be really useful if you could add an option that would allow you to specify how multiple attributes are formatted, either stacked or grouped. Ideally also whether to break multiple grouped attributes, regardless of the print-width setting.

Example

<?php 

// grouped, multi-line
final class Market extends ConfigEntity
{
    public function __construct(
        #[
            Id,
            FromConfigArray('id')
        ]
        protected EntityIdInterface $id,
    ) {}
}

// grouped, singe-line (following print-width)
final class Market extends ConfigEntity
{
    public function __construct(
        #[Id, FromConfigArray('id')]
        protected EntityIdInterface $id,
    ) {}
}

// stacked
final class Market extends ConfigEntity
{
    public function __construct(
        #[Id]
        #[FromConfigArray('id')]
        protected EntityIdInterface $id,
    ) {}
}

Metadata

Metadata

Assignees

Labels

c-formatterPHP code reformatting and style rulest-enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions