Skip to content
New issue

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

Fixing indentation is broken in Laravel preset since 1.8.0 #177

Closed
hjanos1 opened this issue Apr 23, 2023 · 2 comments · Fixed by #178
Closed

Fixing indentation is broken in Laravel preset since 1.8.0 #177

hjanos1 opened this issue Apr 23, 2023 · 2 comments · Fixed by #178
Labels

Comments

@hjanos1
Copy link
Contributor

hjanos1 commented Apr 23, 2023

Pint Version

1.9.0

PHP Version

8.2.0

Description

Fixing indentation is broken in the Laravel preset since #166 was merged.

This is caused by the statement_indentation rule not being enabled in the Laravel preset.

Before the above PR was merged, the rule was being run by the braces rule.

Resolution: statement_indentation rule should be enabled in the Laravel preset. Sending a PR.

Steps To Reproduce

  1. Edit a file so that the indentation is broken
  2. Run pint
  3. Formatting (indentation) should be fixed, but it is not.

Example on a new laravel project, edited app/Providers/AppServiceProvider.php:

➜  pint-test git:(master) ✗ cat app/Providers/AppServiceProvider.php
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
 * Register any application services.
 */
public function register(): void
{
       //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        //
    }
}
➜  pint-test git:(master) ✗ ./vendor/bin/pint --version
Pint 1.9.0
➜  pint-test git:(master) ✗ ./vendor/bin/pint app/Providers/AppServiceProvider.php

  .

  ───────────────────────────────────────────────────────────────────────────────── Laravel
    PASS   ......................................................................... 1 file
@driesvints
Copy link
Member

Ping @Jubeki

@driesvints driesvints added the bug label Apr 24, 2023
@Jubeki
Copy link
Contributor

Jubeki commented Apr 24, 2023

Yeah that seems to fix it (see pint.json below).

I assumed there was a reason statement_indentation was already disabled beforehand and so I didn't touch it further.

{
    "preset": "laravel",
    "rules": {
        "statement_indentation": true
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants