2017 © Pedro Peláez
 

phpcodesniffer-standard coding-standard

Eventjet Coding Standard

image

eventjet/coding-standard

Eventjet Coding Standard

  • Thursday, July 19, 2018
  • by trinet
  • Repository
  • 1 Watchers
  • 0 Stars
  • 100 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Eventjet Coding Standard

PHP-CS-Fixer

Basic Usage:

Add the following .php-cs-fixer.dist.php file to your project's root:, (*1)

in(['features', 'module', 'tests'])->exclude('tests/fixtures');
return Config::basic($finder);
```

### More strict rules:
To use the strict rules, use the `strict` method::
```php

<ruleset>
    <rule ref="Eventjet"/>

    <file>src</file>
    <file>tests</file>
</ruleset>

More strict rules:

There is also a more strict ruleset which forces type hints and return types to be set., (*2)

This sniff can be problematic: If you implement interfaces or have your own interfaces which don't have parameter type hints and return types set or if you are on legacy code, enforcing this sniff would lead to a BC break. This sniff is also set to phpcs-only, so phpcbf won't fix errors automatically., (*3)

To use this ruleset, just use the corresponding rule name in your phpcs rule ref instead of the default one:, (*4)


<ruleset>
    <rule ref="EventjetStrict"/>

    <file>src</file>
    <file>tests</file>
</ruleset>

Excluding sniffs:

For certain files:

To exclude a sniff for a certain set of files, reference the rule explicitly and add an exclude pattern:, (*5)

<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint">
    <exclude-pattern>*Interface.php</exclude-pattern>
</rule>

Suppressing sniffs locally

To suppress a sniff directly in the code, use the @phpcsSuppress annotation:, (*6)

/**
 * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
 * @param int $bar
 */
public function foo($bar = 0): int
{
}

More info on this can be found here., (*7)

Exclude a whole sniff:

It is also possible to exclude a sniff completely:, (*8)


<ruleset>
    <rule ref="Eventjet">
        <exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
    </rule>

    <file>src</file>
    <file>tests</file>
</ruleset>

The Versions

19/07 2018

dev-master

9999999-dev

Eventjet Coding Standard

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Rieschl

19/07 2018

2.1.0

2.1.0.0

Eventjet Coding Standard

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Rieschl

19/07 2018

dev-move-sniff-to-strict

dev-move-sniff-to-strict

Eventjet Coding Standard

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Rieschl

10/07 2018

2.0.1

2.0.1.0

Eventjet Coding Standard

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Rieschl

22/06 2018

2.0.0

2.0.0.0

Eventjet Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

12/06 2018

1.1.0

1.1.0.0

Eventjet Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

13/02 2018

1.0.0

1.0.0.0

Eventjet Coding Standard

  Sources   Download

proprietary

The Requires