Skip to content

Repository files navigation

php-cs-fixer-config

CI Latest Stable Version PHP Version License Codeception

Common PHP CS Fixer configuration for WebProject projects.

Provides a standardized, robust, and modern PHP CS Fixer configuration.


🚀 Key Features

  • Preconfigured Rules: Includes standard rule sets like @PSR12, @Symfony, @Symfony:risky, @PhpCsFixer:risky, and @PHP8x3Migration.
  • Parallel Execution: Automatically detects and utilizes multiple CPU cores for faster analysis.
  • Risky Rules Enabled: Risky refactorings are allowed by default.

📦 Installation

Install the package via Composer:

composer require --dev webproject-xyz/php-cs-fixer-config

Prerequisites

  • PHP: ~8.5.0

🛠️ Usage

Create a .php-cs-fixer.php file in the root of your project:

<?php

declare(strict_types=1);

return new \WebProject\PhpCsFixerConfig\PhpCsFixerConfigFactory()(__DIR__);

Customizing Directories and Exclusions

You can pass specific directories to check, as well as directories to exclude:

<?php

declare(strict_types=1);

return new \WebProject\PhpCsFixerConfig\PhpCsFixerConfigFactory()(
    dirs: [
        __DIR__ . '/src',
        __DIR__ . '/tests',
    ],
    excludeDirs: [
        __DIR__ . '/tests/_output',
    ]
);

🧪 Development & Testing

We maintain high standards for this module:

  • Static Analysis: PHPStan Level 8.
  • Coding Style: Strict PSR-12/Symfony standards.
  • Automation: GrumPHP hooks ensure all commits are verified.

Commands

composer qa        # Run all Quality Assurance checks (build tests, fix CS, run tests, run phpstan)
composer stan      # Run static analysis
composer test      # Run unit tests
composer cs:check  # Check coding standards
composer cs:fix    # Fix coding standards automatically

🤝 Contributing

Contributions are welcome! Please see our CONTRIBUTING.md for details.

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'feat: Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

📜 License

Distributed under the MIT License. See LICENSE for more information.


✉️ Support & Contact

About

php-cs-fixer for all projects

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages