phpcs.xml.dist 6.22 KB
Newer Older
Luís Cobucci's avatar
Luís Cobucci committed
1
<?xml version="1.0"?>
Sergei Morozov's avatar
Sergei Morozov committed
2 3 4 5
<ruleset
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
Luís Cobucci's avatar
Luís Cobucci committed
6 7 8 9
    <arg name="basepath" value="."/>
    <arg name="extensions" value="php"/>
    <arg name="parallel" value="80"/>
    <arg name="cache" value=".phpcs-cache"/>
10
    <arg name="colors"/>
Luís Cobucci's avatar
Luís Cobucci committed
11

12 13
    <!-- Ignore warnings, show progress of the run and show sniff names -->
    <arg value="nps"/>
Luís Cobucci's avatar
Luís Cobucci committed
14

15
    <file>bin</file>
Luís Cobucci's avatar
Luís Cobucci committed
16 17 18
    <file>lib</file>
    <file>tests</file>

19 20
    <rule ref="Doctrine">
        <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
21 22
        <exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
        <exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
23
        <exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
Sergei Morozov's avatar
Sergei Morozov committed
24 25
        <exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>

26
        <exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
Sergei Morozov's avatar
Sergei Morozov committed
27 28 29 30 31
        <!-- https://github.com/slevomat/coding-standard/issues/867 -->
        <exclude name="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing.IncorrectLinesCountAfterLastControlStructure"/>
        <!-- See https://github.com/squizlabs/PHP_CodeSniffer/issues/2937 -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline"/>
        <exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore"/>
32
    </rule>
Luís Cobucci's avatar
Luís Cobucci committed
33

Sergei Morozov's avatar
Sergei Morozov committed
34 35 36 37 38 39 40 41 42 43 44 45
    <!-- Disable the rules that will require PHP 7.4 -->
    <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
        <properties>
            <property name="enableNativeTypeHint" value="false"/>
        </properties>
    </rule>

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

    <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
46 47 48
        <exclude-pattern>*/lib/*</exclude-pattern>
    </rule>

Luís Cobucci's avatar
Luís Cobucci committed
49 50 51 52
    <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
        <exclude-pattern>*/tests/*</exclude-pattern>
    </rule>

53 54 55 56
    <rule ref="Squiz.Classes.ClassFileName.NoMatch">
        <exclude-pattern>*/tests/*</exclude-pattern>
    </rule>

Luís Cobucci's avatar
Luís Cobucci committed
57 58 59
    <rule ref="Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase">
        <exclude-pattern>lib/Doctrine/DBAL/Events.php</exclude-pattern>
    </rule>
60 61 62 63

    <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedProperty">
        <exclude-pattern>tests/Doctrine/Tests/DBAL/Tools/TestAsset/*</exclude-pattern>
    </rule>
64

65 66 67 68
    <!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/2099 -->
    <rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn">
        <exclude-pattern>lib/Doctrine/DBAL/Platforms/AbstractPlatform.php</exclude-pattern>
        <exclude-pattern>lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php</exclude-pattern>
69
        <exclude-pattern>tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php</exclude-pattern>
70 71
    </rule>

Sergei Morozov's avatar
Sergei Morozov committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    <!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/2838 -->
    <rule ref="Squiz.Commenting.FunctionComment.SpacingAfter">
        <exclude-pattern>lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php</exclude-pattern>
    </rule>

    <rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
        <!-- This test contains a fixture class that should use snake case  -->
        <exclude-pattern>tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php</exclude-pattern>
    </rule>

    <!-- https://github.com/squizlabs/PHP_CodeSniffer/issues/2837 -->
    <rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps">
        <!--
            This file uses the return value db2_server_info(), which does not follow conventions
            phpcs wrongly complains about it, and that has been reported here:
            https://github.com/squizlabs/PHP_CodeSniffer/issues/2950
        -->
        <exclude-pattern>lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php</exclude-pattern>
90
        <exclude-pattern>lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionFailed.php</exclude-pattern>
Sergei Morozov's avatar
Sergei Morozov committed
91 92 93 94 95 96 97
        <!-- See https://github.com/squizlabs/PHP_CodeSniffer/issues/2837 -->
        <exclude-pattern>lib/Doctrine/DBAL/SQLParserUtils.php</exclude-pattern>
        <exclude-pattern>lib/Doctrine/DBAL/Tools/Dumper.php</exclude-pattern>
        <exclude-pattern>tests/Doctrine/Tests/DBAL/Driver/StatementIteratorTest.php</exclude-pattern>
        <exclude-pattern>tests/Doctrine/Tests/DBAL/Tools/DumperTest.php</exclude-pattern>
    </rule>

98 99 100 101
    <!-- some statement classes close cursor using an empty while-loop -->
    <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedWhile">
        <exclude-pattern>lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php</exclude-pattern>
    </rule>
102

103 104 105
    <!-- See https://github.com/slevomat/coding-standard/issues/770 -->
    <rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
        <exclude-pattern>lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php</exclude-pattern>
106
        <exclude-pattern>lib/Doctrine/DBAL/Driver/PDOException.php</exclude-pattern>
107
    </rule>
108

109
    <!-- see https://github.com/doctrine/dbal/issues/3377 -->
110
    <rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator">
111 112
        <exclude-pattern>lib/Doctrine/DBAL/Schema/Comparator.php</exclude-pattern>
    </rule>
113

Sergei Morozov's avatar
Sergei Morozov committed
114 115 116 117 118 119 120 121
    <!-- DB2_AUTOCOMMIT_ON/DB2_AUTOCOMMIT_OFF are of int type but db2_autocommit() incorrectly expects bool,
         see https://bugs.php.net/bug.php?id=77591 -->
    <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing">
        <exclude-pattern>lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php</exclude-pattern>
    </rule>

    <!-- The SQLSRV_* functions are defined in the upper case by the sqlsrv extension and violate the standard
         see https://docs.microsoft.com/en-us/sql/connect/php/constants-microsoft-drivers-for-php-for-sql-server -->
122
    <rule ref="Squiz.PHP.LowercasePHPFunctions">
Sergei Morozov's avatar
Sergei Morozov committed
123
        <exclude-pattern>lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php</exclude-pattern>
124
    </rule>
Luís Cobucci's avatar
Luís Cobucci committed
125
</ruleset>