Skip to content

Commit 029f15f

Browse files
committed
Apply PHPCS coding standards
Add declare(strict_types=1) to all files except Instantiator.php (which needs coercive typing for dynamic method invocation with INI data). Add typed properties, parameter types, and return types throughout. Replace array() with [], use modern PHP 8.5 syntax (constructor promotion, arrow functions, str_contains, ::class). Modernize tests to PHPUnit 12 style with attributes. Add phpcs.xml.dist with Respect coding standard. Remove dead test file InstantiatorImplementsInvoke.php (duplicate of LazyLoadTest).
1 parent 8aab283 commit 029f15f

10 files changed

Lines changed: 738 additions & 578 deletions

phpcs.xml.dist

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0"?>
2+
<ruleset
3+
name="PHPCS Coding Standards for Respect/Config"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
6+
>
7+
<arg name="basepath" value="." />
8+
<arg name="cache" value=".phpcs.cache" />
9+
<arg name="colors" />
10+
<arg name="extensions" value="php" />
11+
<arg value="p" />
12+
<arg value="s" />
13+
14+
<file>src/</file>
15+
<file>tests/</file>
16+
17+
<rule ref="Respect" />
18+
19+
<!-- Instantiator dynamically invokes methods with loosely-typed INI data;
20+
strict_types conflicts with call_user_func coercion requirements -->
21+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing">
22+
<exclude-pattern>src/Instantiator.php</exclude-pattern>
23+
</rule>
24+
25+
<!-- Test files contain inline fixture classes required by the DI container tests -->
26+
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
27+
<exclude-pattern>tests/</exclude-pattern>
28+
</rule>
29+
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
30+
<exclude-pattern>tests/</exclude-pattern>
31+
</rule>
32+
<rule ref="Squiz.Classes.ValidClassName.NotPascalCase">
33+
<exclude-pattern>tests/</exclude-pattern>
34+
</rule>
35+
36+
<!-- Test fixture properties use snake_case to match INI config keys -->
37+
<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
38+
<exclude-pattern>tests/</exclude-pattern>
39+
</rule>
40+
</ruleset>

0 commit comments

Comments
 (0)