laravel / pint

Laravel Pint is an opinionated PHP code style fixer for minimalists.
https://laravel.com/docs/pint
MIT License
2.75k stars 138 forks source link

Weird bugs when having set binary_operator_spaces: align_single_space_minimal #245

Closed CamilleScholtz closed 7 months ago

CamilleScholtz commented 7 months ago

Pint Version

1.13.9

PHP Version

8.2.14

Description

This bug happens since 1.13.9, not in 1.13.8. When having the binary_operator_spaces set to align_single_space_minimal all kinds of paths and strings get destroyed by spaces in places where they should be, some example:

'postal-code'  => ['required',  'regex:/^[0-9]{4} ?[a-zA-Z]{2}$/'],
// becomes
'postal-code'  => ['required',  'regex:/^[0-9]{4} ?[a- zA- Z]{2}$/'],

'edit'   => Pages\EditArticle::route('/{record}/edit'),
// becomes
'edit'   => Pages\EditArticle::route('/{record} /edit'),

The config:

{
    "preset": "laravel",
    "rules": {
        "no_useless_else": true,
        "binary_operator_spaces": {
            "default": "align_single_space_minimal"
        }
    }
}

Steps To Reproduce

Set the config file as shown above and run laravel pint.

Jubeki commented 7 months ago

Is already fixed, will probably be released on Tuesday.

driesvints commented 7 months ago

Thanks @Jubeki