laravelpint

How with pint to remove empty line in class declaration?


Which property have I to set from
https://github.com/laravel/pint/blob/main/resources/presets/laravel.php rules to remove empty line in class declaration :

class Classname 
{
    /** @var int */
    protected $currentLocate = 'ua';

    /** @var UserQuizzesHistory Collection */
    protected $userQuizzesHistoriesForReview;

between 2 lines ?

Thanks!


Solution

  • If I'm understanding your question correctly I think you want to class_attributes_separation rule.

    If you just want the class properties to have no lines between them then the configuration would look something like this:

    'class_attributes_separation' => [
        'elements' => [
            'property' => 'none',
        ]
    ]
    

    If you want to preserve the Laravel Pint configuration for the other class attributes then it would look like this:

    'class_attributes_separation' => [
        'elements' => [
            'const' => 'one',
            'method' => 'one',
            'property' => 'none',
            'trait_import' => 'none',
        ],
    ],