the-ge/phpcsfixer-fixers

Custom PHP CS Fixer rules by The Ge

Maintainers

Package info

github.com/the-ge/phpcsfixer-fixers

pkg:composer/the-ge/phpcsfixer-fixers

Statistics

Installs: 26

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.7 2026-03-19 06:23 UTC

This package is auto-updated.

Last update: 2026-03-19 11:44:55 UTC


README

Custom PHP CS Fixer fixers.

Installation

composer require --dev the-ge/phpcsfixer-fixers

Fixers

TheGe/blank_lines_before_classy_block

Ensures every named classy declaration (class, interface, trait, enum) — including its modifiers (abstract, final, readonly) and its metadata (comments, docblock, attributes) — is preceded by exactly two blank lines (three newline characters).

Anonymous classes (new class) are excluded.

Priority: -24 (runs after blank_line_after_namespace, no_blank_lines_after_phpdoc, and single_line_after_imports).

Example

Configuration: ['blank_lines_count' => 2]

// Before
namespace N;
class Foo {}

// After
namespace N;


class Foo {}

Registration

// .php-cs-fixer.dist.php
use TheGe\PhpCsFixer\Fixer\ClassNotation\BlankLinesBeforeClassyBlockFixer;

return (new PhpCsFixer\Config())
    ->registerCustomFixers([new BlankLinesBeforeClassyBlockFixer()])
    ->setRules([
        'TheGe/blank_lines_before_classy_block' => true,
    ]);

Requirements

  • PHP 8.1 – 8.4
  • friendsofphp/php-cs-fixer ^3.94

Running Tests

composer boot
composer test