garrettmassey's avatar

Laravel Pint & PHPStorm formatting disagreement

I'm trying to get my PHPStorm configuration set up so that when I run the Reformat Code shortcut, it effectively formats it in the way Pint expects it to be formatted. I've got everything working except this last indentation quirk.

Say I have some multi-line return statement like this:

    /**
     * Whether the user can update a trainer
     *
     * @param  User    $user
     * @param  Trainer $trainer
     * @return bool
     */
    public function update(User $user, Trainer $trainer): bool
    {
        return $user->hasAnyRole([
                'Manager',
                'Support Staff',
            ]) || $user->isSysAdmin();
    }

This is how it is formatted in PHPStorm when I run the Reformat Code shortcut, but when I run Pint, this is how it is formatted:

    /**
     * Whether the user can update a trainer
     *
     * @param  User    $user
     * @param  Trainer $trainer
     * @return bool
     */
    public function update(User $user, Trainer $trainer): bool
    {
        return $user->hasAnyRole([
            'Manager',
            'Support Staff',
        ]) || $user->isSysAdmin();
    }

where the end bracket of the array lines up with the beginning of the return statement without a trailing indent.

How can I make PHPStorm do the same thing? And if that isn't possible, what specific item do I need to disable in my pint.json?

Here is my current pint.json

{
  "preset": "laravel",
  "rules": {
    "no_superfluous_phpdoc_tags": false,
    "concat_space": {
      "spacing": "one"
    },
    "method_chaining_indentation": false,
    "phpdoc_align": {
      "align": "vertical"
    },
    "not_operator_with_successor_space": false,
    "binary_operator_spaces": {
      "operators": {
        "=>": "align_single_space_minimal"
      }
    }
  }
}
0 likes
0 replies

Please or to participate in this conversation.