-
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
1 parent
8e40e0b
commit 36edc56
Showing
3 changed files
with
25 additions
and
172 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 |
---|---|---|
@@ -1,157 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd"> | ||
<description>The coding standard for PHP_CodeSniffer itself.</description> | ||
<description>PSR-12 based coding style</description> | ||
|
||
<file>src</file> | ||
|
||
<exclude-pattern>*/src/Standards/*/Tests/*\.(inc|css|js)$</exclude-pattern> | ||
<exclude-pattern>*/tests/Core/*/*\.(inc|css|js)$</exclude-pattern> | ||
<exclude-pattern>*/tests/Core/*/Fixtures/*\.php$</exclude-pattern> | ||
<file>tests</file> | ||
|
||
<arg name="basepath" value="."/> | ||
<arg name="colors"/> | ||
<arg name="parallel" value="75"/> | ||
<arg value="sp"/> <!-- Show sniff and progress --> | ||
|
||
<!-- Don't hide tokenizer exceptions --> | ||
<rule ref="Internal.Tokenizer.Exception"> | ||
<type>error</type> | ||
</rule> | ||
|
||
<!-- Include the whole PEAR standard --> | ||
<rule ref="PEAR"> | ||
<exclude name="PEAR.NamingConventions.ValidFunctionName"/> | ||
<exclude name="PEAR.NamingConventions.ValidVariableName"/> | ||
<exclude name="PEAR.Commenting.ClassComment"/> | ||
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/> | ||
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/> | ||
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/> | ||
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/> | ||
<exclude name="PEAR.Commenting.FileComment.Missing"/> | ||
<exclude name="PEAR.Commenting.InlineComment"/> | ||
</rule> | ||
|
||
<!-- Include some sniffs from other standards that don't conflict with PEAR --> | ||
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/> | ||
<rule ref="Squiz.Arrays.ArrayDeclaration"/> | ||
<rule ref="Squiz.ControlStructures.ControlSignature"/> | ||
<rule ref="Squiz.ControlStructures.ElseIfDeclaration"/> | ||
<rule ref="Squiz.Commenting.BlockComment"/> | ||
<rule ref="Squiz.Commenting.DocCommentAlignment"/> | ||
<rule ref="Squiz.Commenting.EmptyCatchComment"/> | ||
<rule ref="Squiz.Commenting.InlineComment"/> | ||
<rule ref="Squiz.Commenting.PostStatementComment"/> | ||
<rule ref="Squiz.Commenting.VariableComment"/> | ||
<rule ref="Squiz.Formatting.OperatorBracket"/> | ||
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/> | ||
<rule ref="Squiz.Operators.ComparisonOperatorUsage"/> | ||
<rule ref="Squiz.PHP.DisallowInlineIf"/> | ||
<rule ref="Squiz.Scope.MethodScope"/> | ||
<rule ref="Squiz.Strings.ConcatenationSpacing"/> | ||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/> | ||
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/> | ||
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/> | ||
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/> | ||
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/> | ||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/> | ||
<rule ref="Generic.ControlStructures.InlineControlStructure"/> | ||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/> | ||
<rule ref="Generic.Formatting.SpaceAfterCast"/> | ||
<rule ref="Generic.NamingConventions.ConstructorName"/> | ||
<rule ref="Generic.PHP.DeprecatedFunctions"/> | ||
<rule ref="Generic.PHP.LowerCaseKeyword"/> | ||
<rule ref="Generic.Strings.UnnecessaryStringConcat"/> | ||
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/> | ||
<rule ref="PSR2.Classes.PropertyDeclaration"/> | ||
<rule ref="PSR2.Methods.MethodDeclaration"/> | ||
<rule ref="PSR2.Files.EndFileNewline"/> | ||
<rule ref="PSR12.Files.OpenTag"/> | ||
<rule ref="Zend.Files.ClosingTag"/> | ||
|
||
<!-- PEAR uses warnings for inline control structures, so switch back to errors --> | ||
<rule ref="Generic.ControlStructures.InlineControlStructure"> | ||
<properties> | ||
<property name="error" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
<!-- We use custom indent rules for arrays --> | ||
<rule ref="Generic.Arrays.ArrayIndent"/> | ||
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"> | ||
<severity>0</severity> | ||
</rule> | ||
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"> | ||
<severity>0</severity> | ||
</rule> | ||
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"> | ||
<severity>0</severity> | ||
</rule> | ||
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine"> | ||
<severity>0</severity> | ||
</rule> | ||
|
||
<!-- Check var names, but we don't want leading underscores for private vars --> | ||
<rule ref="Squiz.NamingConventions.ValidVariableName"/> | ||
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"> | ||
<severity>0</severity> | ||
</rule> | ||
<!-- Show sniff and progress --> | ||
<arg value="sp"/> | ||
|
||
<!-- Only one argument per line in multi-line function calls --> | ||
<rule ref="PEAR.Functions.FunctionCallSignature"> | ||
<properties> | ||
<property name="allowMultipleArguments" value="false"/> | ||
</properties> | ||
</rule> | ||
<!-- PSR12 based --> | ||
<rule ref="PSR12"/> | ||
|
||
<!-- Have 12 chars padding maximum and always show as errors --> | ||
<rule ref="Generic.Formatting.MultipleStatementAlignment"> | ||
<!-- Lines can be N chars long (warnings), errors at M chars --> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="maxPadding" value="12"/> | ||
<property name="error" value="true"/> | ||
<property name="lineLimit" value="130"/> | ||
<property name="absoluteLineLimit" value="180"/> | ||
</properties> | ||
</rule> | ||
|
||
<!-- Ban some functions --> | ||
<rule ref="Generic.PHP.ForbiddenFunctions"> | ||
<properties> | ||
<property name="forbiddenFunctions" type="array"> | ||
<element key="sizeof" value="count"/> | ||
<element key="delete" value="unset"/> | ||
<element key="print" value="echo"/> | ||
<element key="is_null" value="null"/> | ||
<element key="create_function" value="null"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
|
||
<!-- Private methods MUST not be prefixed with an underscore --> | ||
<rule ref="PSR2.Methods.MethodDeclaration.Underscore"> | ||
<type>error</type> | ||
</rule> | ||
|
||
<!-- Private properties MUST not be prefixed with an underscore --> | ||
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore"> | ||
<type>error</type> | ||
</rule> | ||
|
||
<!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases --> | ||
<rule ref="Generic.Strings.UnnecessaryStringConcat"> | ||
<exclude-pattern>tests/bootstrap\.php</exclude-pattern> | ||
</rule> | ||
|
||
<!-- This test file specifically *needs* Windows line endings for testing purposes. --> | ||
<rule ref="Generic.Files.LineEndings.InvalidEOLChar"> | ||
<exclude-pattern>tests/Core/Tokenizer/StableCommentWhitespaceWinTest\.php</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Lines can be N chars long (warnings), errors at M chars --> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="130"/> | ||
<property name="absoluteLineLimit" value="180"/> | ||
</properties> | ||
</rule> | ||
|
||
</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
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