File: phpcs.xml

package info (click to toggle)
php-zend-code 4.8.0-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,644 kB
  • sloc: php: 13,762; xml: 1,931; makefile: 18
file content (48 lines) | stat: -rw-r--r-- 2,775 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0"?>
<ruleset
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
    <!-- Paths to check -->
    <file>src</file>
    <file>test</file>
    <exclude-pattern>*/TestAsset/*</exclude-pattern>
    <exclude-pattern>*/_files/*</exclude-pattern>

    <rule ref="LaminasCodingStandard">
        <!-- This rule is deprecated and produces false positives. -->
        <exclude name="SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse"/>

        <!-- non-strict comparisons are used in a lot of legacy code, and must be removed with care and additional
             testing. For now, we accept that it exists in the codebase -->
        <exclude name="SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator"/>
        <exclude name="SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator"/>

        <!-- the `GOTO` statement is used in legacy scanner code that was written in such way in order to achieve
             better performance in a time at which the PHP engine did not yet have JIT or OpCache optimizations.
             It could be removed in future, but adapting the code now is a major endeavour that should be taken
             on with clarity that it requires a lot of effort to do so. -->
        <exclude name="Generic.PHP.DiscourageGoto.Found"/>

        <!-- As a result of using `GOTO`, some code is incorrectly detected as "unreachable" by phpcs -->
        <exclude name="Squiz.PHP.NonExecutableCode.Unreachable"/>

        <!-- Variables in scanner code do not respect standard naming conventions due to parser logic following
             more traditional lexeme/token uppercase naming -->
        <exclude name="WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCaps"/>

        <!-- sometimes, the reference and bitwise `&` are confused by coding standard rules, and that can lead
             to mis-interpretation of spacing rules -->
        <exclude name="WebimpressCodingStandard.Formatting.Reference.UnexpectedSpace"/>

        <!-- Strict types need to be tested throughly before enabling them everywhere. Disabling the check for now. -->
        <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>

        <!-- This rule produces invalid PHP 7.4 code -->
        <exclude name="SlevomatCodingStandard.Classes.ModernClassNameReference"/>

        <!-- Forcing abstract classes to be named `abstract` is silly: `abstract` should be used carefully,
             and is not used to represent "designed for inheritance" here, most often -->
        <exclude name="WebimpressCodingStandard.NamingConventions.AbstractClass.Prefix"/>
    </rule>
</ruleset>