5

I'm looking for a rule that prevents empty lines after the opening brace of a class.

I found the rule Squiz.WhiteSpace.FunctionOpeningBraceSpace for functions, but I can't find any for classes.

Any suggestions are appreciated.

Milad
  • 115
  • 1
  • 1
  • 11

1 Answers1

0

You are looking for no_blank_lines_after_class_opening from FriendsOfPHP/PHP-CS-Fixer.

If you want to use CodeSniffer, you still can. With EasyCodingStandard you can use both.

# easy-coding-standard.neon
checkers:
    - PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer

Do you want more? Check this short post.

Tomas Votruba
  • 23,240
  • 9
  • 79
  • 115
  • 2
    Thanks for this, but I don't want to use two tools. I use PHP_CodeSniffer in both PhpStorm and as a pipeline job in Gitlab. I want to write my own rule for this but didn't have the time yet. – Milad Jun 03 '17 at 14:13
  • I feel it the same way. It's one tool, both locally and on Github (Travis). PHP_CodeSniffer support in PHPStorm i s very limited and not flexible. See [Travis](https://github.com/ApiGen/ApiGen/blob/3adb5e1085e208738b90caa5ff8809f003efdc31/.travis.yml#L19), with [composer.json](https://github.com/ApiGen/ApiGen/blob/3adb5e1085e208738b90caa5ff8809f003efdc31/composer.json#L69) setup – Tomas Votruba Jun 03 '17 at 20:58