-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mryczanczyk
committed
Aug 20, 2020
1 parent
42bd2ac
commit 8c2348e
Showing
4 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor/ | ||
composer.lock | ||
phpcs.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "misiekR/coding-standards", | ||
"description": "misiekR coding standards", | ||
"type": "phpcodesniffer-standard", | ||
"license": "proprietary", | ||
"authors": [ | ||
{ | ||
"name": "Michał Ryczańczyk", | ||
"email": "m.ryczanczyk@gmail.com" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", | ||
"slevomat/coding-standard": "^4.8.6", | ||
"squizlabs/php_codesniffer": "^3.4.0" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?xml version="1.0"?> | ||
<ruleset | ||
name="misiekR" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd" | ||
> | ||
<description>misiekR coding standard.</description> | ||
|
||
<!-- Import PSR-12 coding standard --> | ||
<rule ref="PSR12"/> | ||
|
||
<!-- Forbid alias functions, i.e. `sizeof()`, `delete()` --> | ||
<rule ref="Generic.PHP.ForbiddenFunctions"> | ||
<properties> | ||
<property name="forbiddenFunctions" type="array"> | ||
<element key="chop" value="rtrim"/> | ||
<element key="close" value="closedir"/> | ||
<element key="compact" value="null"/> | ||
<element key="delete" value="unset"/> | ||
<element key="doubleval" value="floatval"/> | ||
<element key="extract" value="null"/> | ||
<element key="fputs" value="fwrite"/> | ||
<element key="ini_alter" value="ini_set"/> | ||
<element key="is_double" value="is_float"/> | ||
<element key="is_integer" value="is_int"/> | ||
<element key="is_long" value="is_int"/> | ||
<element key="is_null" value="null"/> | ||
<element key="is_real" value="is_float"/> | ||
<element key="is_writeable" value="is_writable"/> | ||
<element key="join" value="implode"/> | ||
<element key="key_exists" value="array_key_exists"/> | ||
<element key="pos" value="current"/> | ||
<element key="settype" value="null"/> | ||
<element key="show_source" value="highlight_file"/> | ||
<element key="sizeof" value="count"/> | ||
<element key="strchr" value="strstr"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
|
||
<!-- Disallow Long Array Syntax --> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/> | ||
|
||
<!-- Enforce trailing commas in multi-line arrays --> | ||
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/> | ||
|
||
<!-- Forbid superfluous leading backslash in use statements --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/> | ||
<!-- Forbid useless alias for classes, constants and functions --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/> | ||
<!-- Forbid useless uses of the same namespace --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/> | ||
<!-- Forbid unused use statements --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"> | ||
<properties> | ||
<property name="searchAnnotations" value="true"/> | ||
</properties> | ||
</rule> | ||
<!-- Require empty newlines before and after uses --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"> | ||
<properties> | ||
<property name="linesCountBetweenUseTypes" value="0"/> | ||
</properties> | ||
<!-- Checked by PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse --> | ||
<exclude name="SlevomatCodingStandard.Namespaces.UseSpacing.IncorrectLinesCountBeforeFirstUse"/> | ||
<!-- Checked by PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter --> | ||
<exclude name="SlevomatCodingStandard.Namespaces.UseSpacing.IncorrectLinesCountAfterLastUse"/> | ||
</rule> | ||
<!-- Forbid group uses --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/> | ||
<!-- Require use statements to be alphabetically sorted --> | ||
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/> | ||
|
||
<!-- Forbid yoda conditions --> | ||
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/> | ||
<!-- Forbid assignments in conditions --> | ||
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/> | ||
|
||
<!-- Forbid spaces before semicolon `;` --> | ||
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/> | ||
|
||
<!-- Require one space between typehint and variable, require no space between nullability sign and typehint --> | ||
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/> | ||
<!-- Forbid space around colon in return types --> | ||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"> | ||
<properties> | ||
<property name="spacesCountBeforeColon" value="0"/> | ||
</properties> | ||
</rule> | ||
<!-- Require types to be written as natively if possible; | ||
require iterable types to specify phpDoc with their content; | ||
forbid useless/duplicated information in phpDoc --> | ||
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"> | ||
<properties> | ||
<property name="traversableTypeHints" type="array"> | ||
<element value="Traversable"/> | ||
<element value="Iterator"/> | ||
<element value="IteratorAggregate"/> | ||
<element value="Doctrine\Common\Collections\Collection"/> | ||
</property> | ||
</properties> | ||
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint"/> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"> | ||
<properties> | ||
<property name="traversableTypeHints" type="array"> | ||
<element value="Traversable"/> | ||
<element value="Iterator"/> | ||
<element value="IteratorAggregate"/> | ||
<element value="Doctrine\Common\Collections\Collection"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"> | ||
<properties> | ||
<property name="traversableTypeHints" type="array"> | ||
<element value="Traversable"/> | ||
<element value="Iterator"/> | ||
<element value="IteratorAggregate"/> | ||
<element value="Doctrine\Common\Collections\Collection"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
<!-- Require use of short versions of scalar types (i.e. int instead of integer) --> | ||
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/> | ||
<!-- Forbid useless @var for constants --> | ||
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<ruleset | ||
name="PHPCS Coding Standards for misiekR/coding-standard" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd" | ||
> | ||
<description>Check the code of custom sniffs in misiekR/coding-standards.</description> | ||
|
||
<arg name="basepath" value="."/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="colors" /> | ||
|
||
<arg value="sp"/> | ||
|
||
<rule ref="misiekR"/> | ||
|
||
<file>lib</file> | ||
</ruleset> |