2017 © Pedro Peláez
 

library coding-standards

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

image

simgroep/coding-standards

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  • Tuesday, August 1, 2017
  • by Breuls
  • Repository
  • 4 Watchers
  • 0 Stars
  • 3,011 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 13 Versions
  • 1 % Grown

The README.md

simgroep/coding-standards

Coding standard configuration for SIMGroep PHP projects using friendsofphp/php-cs-fixer, (*1)

Installation

$ composer require simgroep/coding-standards

Configuration

To customize the default configuration in your project you can add a .php-cs-fixer.php to your project and include the default configuration like this:, (*2)

<?php


$config = require 'vendor/simgroep/coding-standards/php-cs-fixer.dist.php';

$config->setFinder(
    \PhpCsFixer\Finder::create()
        ->in([
            getcwd() . '/src',
            getcwd() . '/test',
        ])
    )
;

return $config;

LEGACY NOTE the deprecated name for the configuration file was .php_cs, and for a legacy use may still require the vendor/simgroep/coding-standards/.php_cs.dist instead, (*3)

Symfony example

When applying the coding standards to a standard Symfony project you can customize the configuration for a blacklisting approach like this:, (*4)

<?php

$config = require 'vendor/simgroep/coding-standards/.php_cs.dist';

$config->setFinder(
    \PhpCsFixer\Finder::create()
        ->in(getcwd())
        ->exclude('app')
        ->exclude('bin')
        ->exclude('var/cache')
        ->exclude('vendor')
    )
;

return $config;

Usage

Only check for coding standard violations:, (*5)

$ ./vendor/bin/php-cs-fixer fix --dry-run --diff --config=vendor/simgroep/coding-standard/.php_cs.dist --stop-on-violation --allow-risky=yes

Fix coding standard violations:, (*6)

$ ./vendor/bin/php-cs-fixer fix --diff --config=vendor/simgroep/coding-standard/.php_cs.dist --stop-on-violation --allow-risky=yes

PhpStorm integration

Start by installing this library global:, (*7)

$ composer global require simgroep/coding-standards

Open PhpStorm and navigate to "Settings" -> "Tools" -> "File Watchers" add one (+). Disable "Immediate file synchronization"., (*8)

Program: /Users/<username>/.composer/vendor/bin/php-cs-fixer, (*9)

Arguments: fix $FileDir$/$FileName$ --config=/Users/<username>/.composer/vendor/simgroep/coding-standards/.php_cs.dist, (*10)

Working dir: $ProjectFileDir$, (*11)

The Versions

01/08 2017

dev-master

9999999-dev

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

01/08 2017

2.0.5

2.0.5.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

10/07 2017

dev-readme-typo

dev-readme-typo

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

17/06 2017

2.0.4

2.0.4.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

18/04 2017

2.0.2

2.0.2.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

18/04 2017

2.0.3

2.0.3.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

13/04 2017

2.0.1

2.0.1.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

17/03 2017

2.0.0

2.0.0.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

16/03 2017

1.3.0

1.3.0.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

04/12 2016

1.2.1

1.2.1.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

13/07 2016

1.2.0

1.2.0.0

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

02/06 2016

1.1.0

1.1.0.0

Coding standard configuration for MainlyCode PHP projects using fabpot/php-cs-fixer

  Sources   Download

MIT

The Requires

 

by Avatar othillo

23/11 2015

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by Avatar othillo