Giter Site home page Giter Site logo

wayofdev / php-cs-fixer-config Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 707 KB

Package adds custom rule-sets to php-cs-fixer.

Home Page: https://wayof.dev

License: MIT License

PHP 77.26% Makefile 22.74%
code-standards code-style php php-cs-fixer static-analysis

php-cs-fixer-config's Introduction




Build Status Total Downloads Latest Stable Version Software License Commits since latest release

PHP CS Fixer Config

Wrapper with pre-defined rules around the PHP-CS-Fixer package โ€” A tool to automatically fix PHP Coding Standards issues.

If you like/use this package, please consider starring it. Thanks!


๐Ÿ’ฟ Installation

โ†’ Using composer

Require as dependency:

$ composer req wayofdev/cs-fixer-config

๐Ÿ›  Configuration

  1. Create PHP file and name it .php-cs-fixer.dist.php and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically.

  2. Example contents of .php-cs-fixer.dist.php file:

    <?php
    
    declare(strict_types=1);
    
    use WayOfDev\PhpCsFixer\Config\ConfigBuilder;
    use WayOfDev\PhpCsFixer\Config\RuleSets\DefaultSet;
    
    require_once 'vendor/autoload.php';
    
    return ConfigBuilder::createFromRuleSet(new DefaultSet())
        ->inDir(__DIR__ . '/src')
        ->inDir(__DIR__ . '/tests')
        ->addFiles([__FILE__])
        ->getConfig();
  3. Place .php-cs-fixer.cache file into .gitignore


๐Ÿ’ป Usage

โ†’ Running

Fix coding standards by simply running console command:

$ php vendor/bin/php-cs-fixer fix -v

โ†’ Using Makefile

To use with our Makefile:

  1. Add scripts section to composer.json:

    {
        "scripts": {
            "cs-fix": "php vendor/bin/php-cs-fixer fix -v",
            "cs-diff": "php vendor/bin/php-cs-fixer fix --dry-run -v --diff"
        }
    }
  2. Use Makefile code to run PHP-CS-Fixer tests:

    # Run inspections and fix code
    $ make cs-fix
    
    # Check coding standards without applying the fix
    $ make cs-diff

๐Ÿงช Running Tests

โ†’ PHPUnit tests

To run tests, run the following command:

$ make test

โ†’ Static Analysis

Code quality using PHPStan:

$ make stan

โ†’ Coding Standards Fixing

Fix code using The PHP Coding Standards Fixer (PHP CS Fixer) to follow our standards:

$ make cs-fix

๐Ÿค License

Licence


๐Ÿ™†๐Ÿผโ€โ™‚๏ธ Author Information

Created in 2022 by lotyp / wayofdev


๐Ÿงฑ Resources


php-cs-fixer-config's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar lotyp avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

php-cs-fixer-config's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ^8.1
  • friendsofphp/php-cs-fixer ^3.14.4
  • ergebnis/composer-normalize ^2.30.2
  • phpstan/extension-installer ^1.2.0
  • phpstan/phpstan ^1.10.5
  • phpstan/phpstan-deprecation-rules ^1.1.2
  • phpstan/phpstan-phpunit ^1.3.10
  • phpstan/phpstan-strict-rules ^1.5.0
  • phpunit/phpunit ^10.0.14
github-actions
.github/workflows/auto-merge-release.yaml
  • peter-evans/enable-pull-request-automerge v3
.github/workflows/ci.yml
  • actions/checkout v4@3df4ab11eba7bda6032a0b82a6bb43b11571feac
  • shivammathur/setup-php v2
  • actions/cache v3
  • codecov/codecov-action v4
.github/workflows/codesee-arch-diagram.yml
  • Codesee-io/codesee-action v2
.github/workflows/create-release.yml
  • google-github-actions/release-please-action v3
.github/workflows/label.yml
  • actions/labeler v4
.github/workflows/shellcheck.yml
  • actions/checkout v4@3df4ab11eba7bda6032a0b82a6bb43b11571feac
  • redhat-plumbers-in-action/differential-shellcheck v4
npm
package.json

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.