Skip to content

Commit

Permalink
chore: update ruleset and annotations for wpcs 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Nov 27, 2023
1 parent ff4901a commit 2aedf54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
20 changes: 6 additions & 14 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<!-- This should be excluded upstream in the ruleset-->
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase" />
<!-- These maybe should be added back later -->
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint" />
</rule>

<!-- Individual rule configuration -->
Expand All @@ -65,19 +70,6 @@
</properties>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint" />
</rule>

<rule ref="WordPress.WP.I18n">
<properties>
<!-- Value: replace the text domain used. -->
Expand Down Expand Up @@ -152,4 +144,4 @@
<exclude-pattern>/tests/</exclude-pattern>
</rule>

</ruleset>
</ruleset>
2 changes: 1 addition & 1 deletion includes/Data/ContentBlocksResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static function ( $parsed_block ) {
);

// Flatten block list here if requested or if 'flat' value is not selected (default)
if ( ! isset( $args['flat'] ) || 'true' == $args['flat'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( ! isset( $args['flat'] ) || 'true' == $args['flat'] ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
$parsed_blocks = self::flatten_block_list( $parsed_blocks );
}

Expand Down
3 changes: 1 addition & 2 deletions includes/WPGraphQLContentBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ public function init_block_editor_registry( \WPGraphQL\Registry\TypeRegistry $ty
*/
private function define( string $name, $value ): void {
if ( ! defined( $name ) ) {
// phpcs:ignore
define($name, $value);
define( $name, $value ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.VariableConstantNameFound
}
}
}

0 comments on commit 2aedf54

Please sign in to comment.