Support the ongoing development of Laravel.io →
posted 8 months ago
Laravel

Here is the code for my pint.json file:

{
  "preset": "laravel",
  "rules": {
    "not_operator_with_successor_space": false,
    "concat_space": {
      "spacing": "one"
    },
    "class_attributes_separation": {
      "elements": {
        "method": "one"
      }
    },
    "array_syntax": {
      "syntax": "short"
    },
    "list_syntax": {
      "syntax": "long"
    },
    "braces": {
      "position_after_functions_and_oop_constructs": "next"
    }
  }
}

The project has this code:

namespace App\Providers;

class SomeClass1
{
    public function register(): void
    {
    }
}

Laravel Pint changes it to this code:

class SomeClass1
{
    public function register(): void {}
}

The same goes for the class. The project has this code:

class SomeClass2
{
}

Laravel Pint changes it to this code:

class SomeClass2 {}

I do not like it. I want the formatting of empty classes and methods to look the same as non-empty ones. How can I prevent Laravel Pint from removing newlines from empty methods and classes?

0

Try to search for suitable rule here:

PHP-CS-Fixer configuration

0

Sign in to participate in this thread!

Eventy

Your banner here too?

evgeny evgeny-laravel Joined 23 Jul 2024

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.