PHPackages                             vairogs/php-cs-fixer-custom-fixers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vairogs/php-cs-fixer-custom-fixers

Abandoned → [valksor/php-dev-cs-fixer-custom-fixers](/?search=valksor%2Fphp-dev-cs-fixer-custom-fixers)Library[Utility &amp; Helpers](/categories/utility)

vairogs/php-cs-fixer-custom-fixers
==================================

034PHP

Since Oct 15Pushed 5mo agoCompare

[ Source](https://github.com/vairogs/php-cs-fixer-custom-fixers)[ Packagist](https://packagist.org/packages/vairogs/php-cs-fixer-custom-fixers)[ RSS](/packages/vairogs-php-cs-fixer-custom-fixers/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Vairogs PHP-CS-Fixer Custom Fixers
==================================

[](#vairogs-php-cs-fixer-custom-fixers)

A PHP library providing custom fixers for PHP-CS-Fixer to enhance code quality and enforce coding standards.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require vairogs/php-cs-fixer-custom-fixers
```

Requirements
------------

[](#requirements)

PHP 8.4 or higher

Usage
-----

[](#usage)

The package provides custom fixers that can be used with PHP-CS-Fixer to automatically fix code style issues.

### Basic Usage

[](#basic-usage)

```
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use Vairogs\PhpCsFixerCustomFixers\Fixers;

$finder = Finder::create()
    ->in(__DIR__)
    ->exclude('vendor')
    ->name('*.php');

$config = new Config();
$config
    ->setRules([
        '@PSR12' => true,
        // Enable all Vairogs custom fixers
        'VairogsPhpCsFixerCustomFixers/declare_after_opening_tag' => true,
        'VairogsPhpCsFixerCustomFixers/doctrine_migrations' => true,
        'VairogsPhpCsFixerCustomFixers/isset_to_array_key_exists' => true,
        'VairogsPhpCsFixerCustomFixers/line_break_between_method_arguments' => true,
        'VairogsPhpCsFixerCustomFixers/line_break_between_statements' => true,
        'VairogsPhpCsFixerCustomFixers/no_useless_dirname_call' => true,
        'VairogsPhpCsFixerCustomFixers/no_useless_strlen' => true,
        'VairogsPhpCsFixerCustomFixers/promoted_constructor_property' => true,
    ])
    ->setFinder($finder);

// Register custom fixers
$fixers = new Fixers();
foreach ($fixers as $fixer) {
    $config->registerCustomFixers([$fixer]);
}

return $config;
```

### Registering Specific Fixers

[](#registering-specific-fixers)

If you only want to use specific fixers, you can register them individually:

```
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use Vairogs\PhpCsFixerCustomFixers\Fixer\DoctrineMigrationsFixer;
use Vairogs\PhpCsFixerCustomFixers\Fixer\IssetToArrayKeyExistsFixer;

$finder = Finder::create()
    ->in(__DIR__)
    ->exclude('vendor')
    ->name('*.php');

$config = new Config();
$config
    ->setRules([
        '@PSR12' => true,
        // Enable only specific Vairogs custom fixers
        'VairogsPhpCsFixerCustomFixers/doctrine_migrations' => true,
        'VairogsPhpCsFixerCustomFixers/isset_to_array_key_exists' => true,
    ])
    ->setFinder($finder)
    ->registerCustomFixers([
        new DoctrineMigrationsFixer(),
        new IssetToArrayKeyExistsFixer(),
    ]);

return $config;
```

Available Fixers
----------------

[](#available-fixers)

### DeclareAfterOpeningTagFixer

[](#declareafteropeningtagfixer)

Ensures that `declare(strict_types = 1)` is placed immediately after the opening PHP tag.

### DoctrineMigrationsFixer

[](#doctrinemigrationsfixer)

Removes unnecessary auto-generated comments from Doctrine migration files.

```
// Before
/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20230101000000 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
    }
}

// After
final class Version20230101000000 extends AbstractMigration
{
    public function up(Schema $schema)
    {
    }
}
```

### IssetToArrayKeyExistsFixer

[](#issettoarraykeyexistsfixer)

Replaces `isset($array[$key])` with `array_key_exists($key, $array)` when possible.

```
// Before
if (isset($array[$key])) {
    echo $array[$key];
}

// After
if (array_key_exists($key, $array)) {
    echo $array[$key];
}
```

Note: This fixer is marked as risky because `isset()` and `array_key_exists()` have slightly different behaviors. `isset()` also checks if the value is not null, while `array_key_exists()` only checks if the key exists.

### LineBreakBetweenMethodArgumentsFixer

[](#linebreakbetweenmethodargumentsfixer)

Ensures that method arguments are separated by line breaks when there are multiple arguments.

### LineBreakBetweenStatementsFixer

[](#linebreakbetweenstatementsfixer)

Ensures that statements are separated by line breaks for better readability.

### NoUselessDirnameCallFixer

[](#nouselessdirnamecallfixer)

Removes unnecessary `dirname()` calls.

### NoUselessStrlenFixer

[](#nouselessstrlenfixer)

Removes unnecessary `strlen()` calls when used in comparisons.

### PromotedConstructorPropertyFixer

[](#promotedconstructorpropertyfixer)

Converts traditional constructor property assignments to promoted properties (PHP 8.0+).

License
-------

[](#license)

This package is licensed under the [BSD-3-Clause License](LICENSE).

About Vairogs
-------------

[](#about-vairogs)

This package is part of the [vairogs/vairogs](https://github.com/vairogs/vairogs) project - a comprehensive PHP library and Symfony bundle that provides a collection of utilities, components, and integrations for Symfony applications.

The main project includes:

- Various utility functions and components
- Doctrine ORM tools and extensions
- API Platform integrations
- Symfony bundle for easy configuration
- And much more

If you find these custom fixers useful, you might want to check out the full Vairogs project for additional tools and utilities that can enhance your Symfony application development.

To install the complete package:

```
composer require vairogs/vairogs
```

###  Health Score

19

—

LowBetter than 12% of packages

Maintenance49

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c4db85e32518c5a6caa2fd625032a2b016ef42d60cf8a101c165cc5c0048b221?d=identicon)[k0d3r1s](/maintainers/k0d3r1s)

---

Top Contributors

[![k0d3r1s](https://avatars.githubusercontent.com/u/38725938?v=4)](https://github.com/k0d3r1s "k0d3r1s (16 commits)")

### Embed Badge

![Health badge](/badges/vairogs-php-cs-fixer-custom-fixers/health.svg)

```
[![Health](https://phpackages.com/badges/vairogs-php-cs-fixer-custom-fixers/health.svg)](https://phpackages.com/packages/vairogs-php-cs-fixer-custom-fixers)
```

###  Alternatives

[saadj55/filament-copyable

Filament fields and columns with copyable values

365.5k](/packages/saadj55-filament-copyable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
