Skip to content

Commit

Permalink
switch from syde/phpcs to inpsyde/php-coding-standards to support PHP…
Browse files Browse the repository at this point in the history
… >=7.4.
  • Loading branch information
Chrico committed Jan 14, 2025
1 parent ff304a2 commit da38ad5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require-dev": {
"brain/monkey": "^2.6.1",
"syde/phpcs": "1.0.0-rc.1",
"inpsyde/php-coding-standards": "^2.0.0",
"roots/wordpress-no-content": "@dev",
"mikey179/vfsstream": "^v1.6.11",
"phpunit/phpunit": "^9.6.19",
Expand Down
49 changes: 36 additions & 13 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
<?xml version="1.0"?>
<ruleset>

<file>./src</file>
<file>./tests</file>

<arg value="sp"/>
<arg name="colors"/>
<config name="testVersion" value="7.4-"/>
<config name="ignore_warnings_on_exit" value="1"/>

<rule ref="Inpsyde">
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />
</rule>

<rule ref="Syde-Extra">
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall.MissingTrailingComma" />
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration.MissingTrailingComma" />
<rule ref="Inpsyde.CodeQuality.Psr4">
<properties>
<property
name="psr4"
type="array"
value="
Inpsyde\Modularity=>src,
Inpsyde\Modularity\Tests=>tests/src,
Inpsyde\Modularity\Tests\Unit=>tests/unit"
/>
</properties>
</rule>

<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="src" value="Inpsyde\Modularity" />
<element key="tests/phpunit/Unit" value="Inpsyde\Modularity\Tests\Unit" />
</property>
</properties>
</rule>
</ruleset>
<rule ref="Inpsyde.CodeQuality.FunctionLength">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Inpsyde.CodeQuality.ForbiddenPublicProperty">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.PHP.DevelopmentFunctions">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.PHP.DiscouragedPHPFunctions">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.Security.EscapeOutput">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.PHP.Eval">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
</ruleset>
6 changes: 2 additions & 4 deletions src/Container/ServiceExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,15 @@ protected function resolveById(string $id, $service, Container $container)
*
* @return mixed
*
* phpcs:disable SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh
* phpcs:disable Syde.Functions.ReturnTypeDeclaration.NoReturnType
* phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
* phpcs:disable Inpsyde.CodeQuality.ReturnTypeDeclaration.NoReturnType
*/
protected function resolveByType(
string $className,
object $service,
Container $container,
array $extendedClasses = []
) {
// phpcs:enable Generic.Metrics.CyclomaticComplexity
// phpcs:enable Inpsyde.CodeQuality.ReturnTypeDeclaration

$extendedClasses[] = $className;

Expand Down
2 changes: 1 addition & 1 deletion src/Properties/LibraryProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LibraryProperties extends BaseProperties
*
* @return LibraryProperties
*
* phpcs:disable SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh
* phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
* phpcs:disable Syde.Functions.FunctionLength.TooLong
*/
public static function new(string $composerJsonFile, ?string $baseUrl = null): LibraryProperties
Expand Down

0 comments on commit da38ad5

Please sign in to comment.