Skip to content

Commit

Permalink
Fix new PHPCS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean90 committed Apr 9, 2024
1 parent 7e3a13a commit 80fec8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@

<rule ref="Required">
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
<exclude name="WordPress.Security.EscapeOutput.ExceptionNotEscaped"/>
</rule>

<!-- The minimum supported WordPress version for all sniffs which use it. -->
<config name="minimum_supported_wp_version" value="6.3"/>
<!-- The minimum PHP requirement. -->
<config name="testVersion" value="7.4-"/>

<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>/src/Plugin\.php</exclude-pattern>
<exclude-pattern>/res/deploy\.tpl\.php</exclude-pattern>
</rule>
<rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
<exclude-pattern>/src/Plugin\.php</exclude-pattern>
</rule>
Expand All @@ -20,7 +30,7 @@
<rule ref="Squiz.Commenting.FunctionCommentThrowTag.Missing">
<exclude-pattern>/src/Plugin\.php</exclude-pattern>
</rule>
<rule ref="WordPress.WP.CapitalPDangit.Misspelled">
<rule ref="WordPress.WP.CapitalPDangit.MisspelledInText">
<exclude-pattern>/res/deploy\.tpl\.php</exclude-pattern>
</rule>
</ruleset>
6 changes: 3 additions & 3 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function activate( Composer $composer, IOInterface $io ): void {

$config = $this->composer->getConfig();

$this->rootDir = dirname( $config->getConfigSource()->getName() );
$this->rootDir = \dirname( $config->getConfigSource()->getName() );
}

/**
Expand Down Expand Up @@ -116,14 +116,14 @@ public function copyDeployerConfig( PackageEvent $event ): void {
} elseif ( $operation instanceof UpdateOperation ) {
$package = $operation->getTargetPackage();
} else {
throw new \Exception( 'Unknown operation: ' . \get_class( $operation ) );
throw new \Exception( 'Unknown operation: ' . \get_class( $operation ) ); // phpcs:ignore SlevomatCodingStandard.Classes.ModernClassNameReference.ClassNameReferencedViaFunctionCall -- Switch to $operation::class when PHP 8.0 is minimum.
}

if ( self::PLUGIN_PACKAGE_NAME !== $package->getName() ) {
return;
}

$source = dirname( __DIR__ ) . '/res/deploy.tpl.php';
$source = \dirname( __DIR__ ) . '/res/deploy.tpl.php';
$dest = $this->rootDir . '/deploy.php';

$copied = copy( $source, $dest );
Expand Down

0 comments on commit 80fec8e

Please sign in to comment.