laravel / pint

Laravel Pint is an opinionated PHP code style fixer for minimalists.

Home Page:https://laravel.com/docs/pint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[binary_operator_spaces] Invalid configuration

stebogit opened this issue · comments

  • Pint Version: 1.2.1
  • PHP Version: 8.0.25

I'm getting this error running ./vendor/bin/pint:

In AbstractFixer.php line 152:
                                                                                                                                                                                                                                                                                                                                                
  [binary_operator_spaces] Invalid configuration: Unexpected "operators" key, expected any of "=", "*", "/", "%", "<", ">", "|", "^", "+", "-", "&", "&=", "&&", "||", ".=", "/=", "=>", "==", ">=", "===", "!=", "<>", "!==", "<=", "and", "or", "xor", "-=", "%=", "*=", "|=", "+=", "<<", "<<=", ">>", ">>=", "^=", "**", "**=", "<=>", "??  
  ", "??=", got "string#!".                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                

In BinaryOperatorSpacesFixer.php line 316:
                                                                                                                                                                                                                                                                                                                         
  Unexpected "operators" key, expected any of "=", "*", "/", "%", "<", ">", "|", "^", "+", "-", "&", "&=", "&&", "||", ".=", "/=", "=>", "==", ">=", "===", "!=", "<>", "!==", "<=", "and", "or", "xor", "-=", "%=", "*=", "|=", "+=", "<<", "<<=", ">>", ">>=", "^=", "**", "**=", "<=>", "??", "??=", got "string#!".                                                                                                                                                                                                                                                                                                     

What's wrong with my binary_operator_spaces definition? I believe it is correct.

{
  "preset": "laravel",
  "rules": {
    "binary_operator_spaces": {
      "default": "single_space",
      "operators": {
        "=>": "align_single_space_minimal",
        "|": "no_space",
        "!": "no_space"
      }
    },
    "function_declaration": {
      "closure_function_spacing": "none"
    },
    "cast_spaces": {
      "space": "none"
    },
    "blank_line_before_statement": {
      "statements": [
        "try",
        "declare"
      ]
    },
    "not_operator_with_space": false,
    "unary_operator_spaces": false,
    "not_operator_with_successor_space": false
  },
}