2017 © Pedro Peláez
 

library php-code-style

Longish Code style configurations

image

longman/php-code-style

Longish Code style configurations

  • Thursday, October 26, 2017
  • by LONGMAN
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,702 Installations
  • 5 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 16 % Grown

The README.md

Longish code style configuration

This is a PSR-12 based code style ruleset for PHP Code Sniffer, (*1)

PHP Code Sniffer

Configuration file: longish.phpcs.xml, (*2)

Usage

  1. Link longman/php-code-style repo as composer dependency, (*3)

    $ composer require --dev longman/php-code-style, (*4)

  2. Extend provided configuration to adapt it to your project. For example, create custom phpcs.xml file and put:, (*5)

<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Project code style checker config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd">
    <rule ref="./vendor/longman/php-code-style/longish.phpcs.xml"/>

    <!-- Exclude stubs file for PSR1.Classes.ClassDeclaration rule -->
    <rule ref="PSR1.Classes.ClassDeclaration">
        <exclude-pattern>*/_stubs.php</exclude-pattern>
    </rule>

    <!-- Exclude stubs file for Generic.CodeAnalysis.UnconditionalIfStatement rule -->
    <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement.Found">
        <exclude-pattern>*/_stubs.php</exclude-pattern>
    </rule>
</ruleset>
  1. For Laravel you can directly include laravel.phpcs.xml:

<ruleset name="Project code style checker config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd">
    <rule ref="./vendor/longman/php-code-style/laravel.phpcs.xml" />

</ruleset>

Running check (Laravel example):, (*6)

vendor/bin/phpcs --standard=vendor/longman/php-code-style/laravel.phpcs.xml -spn --encoding=utf-8 --report-width=150 --colors --parallel=16 app/ config/ tests/

Running check with custom phpcs.xml:, (*7)

vendor/bin/phpcs --standard=phpcs.xml -spn --encoding=utf-8 --report-width=150 --colors --parallel=16 app/ config/ tests/

The Versions

26/10 2017

dev-master

9999999-dev

Longish Code style configurations

  Sources   Download

MIT

The Requires

 

26/10 2017

1.0.2

1.0.2.0

Longish Code style configurations

  Sources   Download

MIT

The Requires

 

16/06 2017

1.0.1

1.0.1.0

Longish Code style configurations

  Sources   Download

MIT

The Requires

 

16/06 2017

1.0.0

1.0.0.0

Longish Code style configurations

  Sources   Download

MIT

The Requires