2016-11-02 07:29:00 +01:00
|
|
|
<?xml version="1.0"?>
|
2021-06-08 04:55:21 +02:00
|
|
|
<ruleset
|
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
|
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
|
|
|
|
name="Psalm coding standard"
|
|
|
|
>
|
2021-12-01 22:46:10 +01:00
|
|
|
<description>The coding standard for Psalm.</description>
|
|
|
|
|
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* Configuration *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
2021-12-05 18:51:26 +01:00
|
|
|
<config name="php_version" value="70100"/>
|
2019-06-26 22:52:29 +02:00
|
|
|
<config name="installed_paths" value="../../slevomat/coding-standard"/>
|
2021-12-01 22:46:10 +01:00
|
|
|
|
|
|
|
<arg name="basepath" value="."/>
|
|
|
|
|
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* Files to include/exclude *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
|
|
|
<file>bin/</file>
|
|
|
|
<file>src/</file>
|
|
|
|
<file>tests/</file>
|
|
|
|
|
|
|
|
<!-- These are just examples and stub classes/files, so it doesn't really matter if they're PSR-2 compliant. -->
|
|
|
|
<exclude-pattern>src/Psalm/Internal/Stubs/</exclude-pattern>
|
|
|
|
<exclude-pattern>tests/fixtures/</exclude-pattern>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* STANDARD: Generic *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Restrict line length.
|
|
|
|
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Docs/Files/LineLengthStandard.xml
|
|
|
|
-->
|
|
|
|
<rule ref="Generic.Files.LineLength">
|
|
|
|
<exclude-pattern>tests</exclude-pattern>
|
|
|
|
<exclude-pattern>src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
2022-05-23 18:44:57 +02:00
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* STANDARD: PSR1 *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
|
|
|
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
|
|
|
|
<exclude-pattern>bin/update-property-map.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2021-12-01 22:46:10 +01:00
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* STANDARD: PSR2 *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
|
|
|
<rule ref="PSR2"/>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Namespace Declarations.
|
|
|
|
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/Docs/Namespaces/UseDeclarationStandard.xml
|
|
|
|
-->
|
|
|
|
<rule ref="PSR2.Namespaces.UseDeclaration">
|
|
|
|
<exclude-pattern>*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* STANDARD: Squiz *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
|
|
|
<!--
|
|
|
|
The self keyword should be used instead of the current class name.
|
|
|
|
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Docs/Classes/SelfMemberReferenceStandard.xml
|
|
|
|
-->
|
|
|
|
<rule ref="Squiz.Classes.SelfMemberReference"/>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- **************************************************************************************************************
|
|
|
|
* STANDARD: SlevomatCodingStandard *
|
|
|
|
************************************************************************************************************** -->
|
|
|
|
|
2021-12-15 04:40:34 +01:00
|
|
|
<!--
|
|
|
|
Handles enforcement and line spacing of declare(strict_types=1).
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsdeclarestricttypes-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
|
|
|
|
<properties>
|
|
|
|
<property name="declareOnFirstLine" type="bool" value="false"/>
|
|
|
|
<property name="linesCountBeforeDeclare" type="int" value="1"/>
|
|
|
|
<property name="linesCountAfterDeclare" type="int" value="1"/>
|
|
|
|
<property name="spacesCountAroundEqualsSign" type="int" value="0"/>
|
|
|
|
</properties>
|
|
|
|
|
|
|
|
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing"/>
|
|
|
|
</rule>
|
|
|
|
|
2021-12-15 04:46:39 +01:00
|
|
|
<!--
|
|
|
|
Requires only one namespace in a file.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesrequireonenamespaceinfile
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/>
|
|
|
|
|
2021-12-15 04:50:26 +01:00
|
|
|
<!--
|
|
|
|
Enforces formatting of namespace.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesnamespacedeclaration-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration"/>
|
|
|
|
|
2021-12-15 04:55:08 +01:00
|
|
|
<!--
|
|
|
|
Enforces number of lines before and after namespace.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesnamespacespacing-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing">
|
|
|
|
<properties>
|
|
|
|
<property name="linesCountBeforeNamespace" type="int" value="1"/>
|
|
|
|
<property name="linesCountAfterNamespace" type="int" value="1"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2022-01-20 23:33:06 +01:00
|
|
|
<rule ref="Squiz.Classes.ValidClassName">
|
|
|
|
<exclude-pattern>src/Psalm/Storage/Assertion/Empty_.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2021-12-01 22:46:10 +01:00
|
|
|
<!--
|
|
|
|
Handle imports from namespaces.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesreferenceusednamesonly-
|
|
|
|
-->
|
2019-06-26 22:52:29 +02:00
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
|
|
|
|
<properties>
|
2021-12-03 20:29:06 +01:00
|
|
|
<property name="allowFullyQualifiedExceptions" type="bool" value="false"/>
|
2021-12-03 21:07:25 +01:00
|
|
|
<property name="allowFullyQualifiedGlobalFunctions" type="bool" value="false"/>
|
2021-12-03 21:25:22 +01:00
|
|
|
<property name="allowFullyQualifiedGlobalConstants" type="bool" value="false"/>
|
2021-12-03 21:40:18 +01:00
|
|
|
<property name="allowFullyQualifiedGlobalClasses" type="bool" value="false"/>
|
2021-12-02 17:42:50 +01:00
|
|
|
|
2021-12-03 22:44:41 +01:00
|
|
|
<property name="allowFullyQualifiedNameForCollidingClasses" type="bool" value="false"/>
|
|
|
|
<property name="allowFullyQualifiedNameForCollidingFunctions" type="bool" value="false"/>
|
|
|
|
<property name="allowFullyQualifiedNameForCollidingConstants" type="bool" value="false"/>
|
2021-12-02 17:42:50 +01:00
|
|
|
|
2021-12-03 22:44:41 +01:00
|
|
|
<property name="allowFallbackGlobalFunctions" type="bool" value="false"/>
|
|
|
|
<property name="allowFallbackGlobalConstants" type="bool" value="false"/>
|
2021-12-02 17:42:50 +01:00
|
|
|
|
|
|
|
<property name="allowPartialUses" type="bool" value="true"/>
|
|
|
|
|
2021-12-04 03:37:19 +01:00
|
|
|
<property name="searchAnnotations" type="bool" value="true"/>
|
2019-06-26 22:52:29 +02:00
|
|
|
</properties>
|
2021-05-03 23:22:15 +02:00
|
|
|
</rule>
|
|
|
|
|
2021-12-01 22:46:10 +01:00
|
|
|
<!--
|
|
|
|
Looks for unused imports from other namespaces.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesunuseduses-
|
|
|
|
-->
|
2021-05-03 23:22:15 +02:00
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
|
|
|
|
<properties>
|
2021-06-08 04:55:21 +02:00
|
|
|
<property name="searchAnnotations" value="true"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
2021-12-01 22:46:10 +01:00
|
|
|
|
|
|
|
<!--
|
|
|
|
Checks whether uses at the top of a file are alphabetically sorted.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesalphabeticallysorteduses-
|
|
|
|
-->
|
2021-06-08 04:55:21 +02:00
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
|
|
|
|
<properties>
|
2021-12-15 05:11:15 +01:00
|
|
|
<property name="psr12Compatible" type="bool" value="true"/>
|
2021-12-01 22:46:10 +01:00
|
|
|
<property name="caseSensitive" value="true"/>
|
2021-06-08 04:55:21 +02:00
|
|
|
</properties>
|
|
|
|
</rule>
|
2021-12-01 22:46:10 +01:00
|
|
|
|
|
|
|
<!--
|
|
|
|
Enforces configurable number of lines before/after/between use.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardnamespacesusespacing-
|
|
|
|
-->
|
2021-06-08 04:55:21 +02:00
|
|
|
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
|
|
|
|
<properties>
|
2021-12-01 22:46:10 +01:00
|
|
|
<property name="linesCountBetweenUseTypes" value="1"/>
|
2021-05-03 23:22:15 +02:00
|
|
|
</properties>
|
|
|
|
</rule>
|
2017-04-28 06:31:55 +02:00
|
|
|
|
2021-12-05 18:51:26 +01:00
|
|
|
<!--
|
|
|
|
Checks for missing return typehints and useless @return annotations.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehint-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
|
|
|
|
<properties>
|
|
|
|
<property name="enableObjectTypeHint" type="bool" value="false"/>
|
|
|
|
<property name="enableStaticTypeHint" type="bool" value="false"/>
|
|
|
|
<property name="enableMixedTypeHint" type="bool" value="false"/>
|
|
|
|
<property name="enableUnionTypeHint" type="bool" value="false"/>
|
|
|
|
</properties>
|
|
|
|
|
|
|
|
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Enforces consistent formatting of return typehints.
|
|
|
|
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehintspacing-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
|
|
|
|
<properties>
|
|
|
|
<property name="spacesCountBeforeColon" value="0"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2022-01-05 12:21:30 +01:00
|
|
|
<!--
|
|
|
|
Requires using a underscore separator for long numbers.
|
|
|
|
https://github.com/slevomat/coding-standard/#slevomatcodingstandardnumbersrequirenumericliteralseparator
|
|
|
|
-->
|
2022-01-05 03:11:52 +01:00
|
|
|
<rule ref="SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator">
|
|
|
|
<properties>
|
|
|
|
<property name="enable" value="true"/>
|
|
|
|
<property name="minDigitsBeforeDecimalPoint" value="5"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2022-01-05 12:21:30 +01:00
|
|
|
<!--
|
|
|
|
Requires use of null coalesce operator when possible.
|
|
|
|
https://github.com/slevomat/coding-standard/#slevomatcodingstandardcontrolstructuresrequirenullcoalesceoperator-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Requires use of null coalesce equal operator when possible.
|
|
|
|
https://github.com/slevomat/coding-standard/#slevomatcodingstandardcontrolstructuresrequirenullcoalesceequaloperator-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator">
|
|
|
|
<properties>
|
|
|
|
<property name="enable" value="true"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
2022-01-05 22:32:01 +01:00
|
|
|
|
|
|
|
<!--
|
|
|
|
Enforces using short form of list syntax, [...] instead of list(...).
|
|
|
|
https://github.com/slevomat/coding-standard/#slevomatcodingstandardphpshortlist-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
|
2022-01-05 23:45:11 +01:00
|
|
|
|
|
|
|
<!--
|
|
|
|
Requires arrow functions.
|
|
|
|
https://github.com/slevomat/coding-standard/#slevomatcodingstandardfunctionsrequirearrowfunction-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.Functions.RequireArrowFunction">
|
|
|
|
<properties>
|
|
|
|
<property name="enabled" value="true"/>
|
|
|
|
<property name="allowNested" value="true"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
2022-11-23 05:08:29 +01:00
|
|
|
|
|
|
|
<!--
|
|
|
|
Forces uniform arrow function style
|
|
|
|
https://github.com/slevomat/coding-standard/blob/master/doc/functions.md#slevomatcodingstandardfunctionsarrowfunctiondeclaration-
|
|
|
|
-->
|
|
|
|
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
|
|
|
|
<properties>
|
|
|
|
<property name="spacesCountAfterKeyword" value="0"/>
|
|
|
|
<property name="spacesCountBeforeArrow" value="1"/>
|
|
|
|
<property name="spacesCountAfterArrow" value="1"/>
|
|
|
|
<property name="allowMultiLine" value="true"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
2017-01-15 01:06:58 +01:00
|
|
|
</ruleset>
|