Skip to content

Commit 4c306f3

Browse files
committed
PHPCS ruleset: update ruleset for upstream changes
* Fix the name and description to prevent confusion between the project ruleset and the organisation ruleset. * Set the minimum PHP version for the PHPCompatibility standard. * Ignore two PHPCompatibility non-issues. * Don't require property type declarations. * Ensure special characters used as literals in an exclude pattern are escaped.
1 parent 274f578 commit 4c306f3

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

phpcs.xml.dist

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
<?xml version="1.0"?>
2-
<ruleset name="phpDocumentor">
3-
<description>The coding standard for phpDocumentor.</description>
2+
<ruleset name="TypeResolver">
3+
<description>The coding standard for this library.</description>
44

55
<file>src</file>
66
<file>tests/unit</file>
7-
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest.php</exclude-pattern>
7+
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest\.php</exclude-pattern>
88
<arg value="p"/>
99

10+
<!-- Set the minimum PHP version for PHPCompatibility.
11+
This should be kept in sync with the requirements in the composer.json file. -->
12+
<config name="testVersion" value="7.2-"/>
13+
1014
<rule ref="phpDocumentor">
15+
<!-- Property type declarations are a PHP 7.4 feature. -->
16+
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
1117
</rule>
1218

1319
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
14-
<exclude-pattern>*/src/*/Abstract*.php</exclude-pattern>
20+
<exclude-pattern>*/src/*/Abstract*\.php</exclude-pattern>
1521
</rule>
1622

1723
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
18-
<exclude-pattern>*/src/PseudoTypes/False_.php</exclude-pattern>
19-
<exclude-pattern>*/src/PseudoTypes/True_.php</exclude-pattern>
24+
<exclude-pattern>*/src/PseudoTypes/False_\.php</exclude-pattern>
25+
<exclude-pattern>*/src/PseudoTypes/True_\.php</exclude-pattern>
26+
</rule>
27+
28+
<!-- Ignore two PHP 8.0 constants which are being polyfilled in the file using them. -->
29+
<rule ref="PHPCompatibility.Constants.NewConstants.t_name_qualifiedFound">
30+
<exclude-pattern>*/src/Types/ContextFactory\.php</exclude-pattern>
31+
</rule>
32+
<rule ref="PHPCompatibility.Constants.NewConstants.t_name_fully_qualifiedFound">
33+
<exclude-pattern>*/src/Types/ContextFactory\.php</exclude-pattern>
2034
</rule>
2135
</ruleset>

0 commit comments

Comments
 (0)