Skip to content

Commit 88b27c5

Browse files
authored
Merge pull request #4 from justlevine/release/2.0.0-beta.2
release: 2.0.0 beta.2
2 parents c576c6b + 18a0713 commit 88b27c5

File tree

8 files changed

+95
-43
lines changed

8 files changed

+95
-43
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file.
44

55
This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).
66

7+
## [2.0.0-beta.2] - 2023-11-5
8+
9+
This release updates the ruleset based on the latest changes to WPGraphQL core (v1.18.0). Specifically:
10+
11+
### WPGraphQL-Minimum
12+
- Added `PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.objectFound`.
13+
- Moved `SlevomatCodingStandard.Classes.RequireSelfReference` from `WPGraphQL-Strict`.
14+
- Moved `SlevomatCodingStandard.TypeHints.ReturnTypeHint.LessSpecificNativeTypeHint` from `WPGraphQL-Extra` and made explicit.
15+
- Moved `SlevomatCodingStandard.Variables.UselessVariable` from `WPGraphQL-Extra`.
16+
17+
### WPGraphQL-Strict
18+
- Moved `SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses` from `WPGraphQL-Extra`.
19+
- Added `SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue`.
20+
- Added `SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition`.
21+
- Moved `SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint` from `WPGraphQL-Extra` and made explicit.
22+
- Moved `SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint` from `WPGraphQL-Extra` and made explicit.
23+
- Moved `SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint` from `WPGraphQL-Extra` and made explicit.
24+
25+
### WPGraphQL-Docs
26+
- Added`Squiz.Commenting` subset of `WordPress-Docs`.
27+
- Added `SlevomatCodingStandard.TypeHints.LongTypeHints`.
28+
- Moved `SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification` from `WPGraphQL-Extra` and made explicit.
29+
- Moved `SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation` from `WPGraphQL-Extra` and made explicit.
30+
- Moved `SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessSuppress` from `WPGraphQL-Extra` and made explicit.
31+
- Moved `SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing` from `WPGraphQL-Extra`.
32+
- Moved `SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification` from `WPGraphQL-Extra` and made explicit.
33+
- Moved `SlevomatCodingStandard.TypeHints.PropertyTypeHint.UselessSuppress` from `WPGraphQL-Extra` and made explicit.
34+
- Moved `SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification` from `WPGraphQL-Extra` and made explicit.
35+
- Moved `SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation` from `WPGraphQL-Extra` and made explicit.
36+
- Moved `SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessSuppress` from `WPGraphQL-Extra` and made explicit.
37+
- Moved `SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing` from `WPGraphQL-Extra`.
38+
39+
### WPGraphQL-Core
40+
- Added `WPGraphQL-Docs` with some exceptions.
41+
742
## [2.0.0-beta.1] - 2023-09-17
843

944
This release requires WPCS 3.0.0 or higher. Please read the [WordPressCS 3.0 upgrade guide](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-ruleset-maintainers) for instructions on how to update your local rulesets and code annotations.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ You can use the following standard names when invoking `phpcs` to select the sni
2525
* [`WPGraphQL`](./WPGraphQL/ruleset.xml) - complete set with all of the sniffs in the project.
2626
- [`WPGraphQL-Minimum`](./WPGraphQL-Minimum/ruleset.xml): basic ruleset for WPGraphQL projects.
2727
- [`WPGraphQL-Strict`](./WPGraphQL-Strict/ruleset.xml): includes all the sniffs in the `WPGraphQL-Minimum` ruleset, plus additional functional sniffs to help you produce enterprise-ready code.
28-
- [`WPGraphQL-Core`](./WPGraphQL-Core/ruleset.xml): includes all the sniffs currently used by the [WPGraphQL core project](https://github.com/wp-graphql/wp-graphql/blob/develop/phpcs.xml.dist). Currently this is the same as the `WPGraphQL-Strict` ruleset, with a few sniffs disabled.
29-
- [`WPGraphQL-Extra`](./WPGraphQL-Extra/ruleset.xml): includes all the sniffs in the `WPGraphQL-Strict` ruleset, plus additional formatting sniffs to keep your code looks consistent across your project.
28+
- [`WPGraphQL-Extra`](./WPGraphQL-Extra/ruleset.xml): includes all the sniffs in the `WPGraphQL-Strict` ruleset, plus additional sniffs to keep your code consistent across your project.
3029
- [`WPGraphQL-Docs`](./WPGraphQL-Docs/ruleset.xml): includes sniffs for doc-blocks and inline comments.
30+
* [`WPGraphQL-Core`](./WPGraphQL-Core/ruleset.xml): includes all the sniffs currently used by the [WPGraphQL core project](https://github.com/wp-graphql/wp-graphql/blob/develop/phpcs.xml.dist). This includes the `WPGraphQL-Strict` and `WPGraphQL-Docs` ruleset, with a few sniffs disabled.
3131

3232
## Installation
3333

@@ -51,7 +51,7 @@ The best way to use these sniffs in your project is to create a [local configura
5151

5252
In this file, you will want to configure the following:
5353

54-
- [`testVersion`](./phpcs.xml.dist.example#L33) - The minimum PHP version you want to test against. This should be the lowest version of PHP that you want to support. While WPGraphQL officially supports PHP 7.1+, we recommend testing against PHP 7.3 (the current lowest version actively [tested against](https://github.com/wp-graphql/wp-graphql/blob/develop/.github/workflows/testing-integration.yml)) or higher.
54+
- [`testVersion`](./phpcs.xml.dist.example#L33) - The minimum PHP version you want to test against. This should be the _lowest version of PHP that you want to support_. While WPGraphQL officially supports PHP 7.1+, we recommend testing against PHP 7.3 (the current lowest version actively [tested against](https://github.com/wp-graphql/wp-graphql/blob/develop/.github/workflows/testing-integration.yml)) or higher.
5555
- [`minimum_wp_version`](./phpcs.xml.dist.example#L43) - The minimum WordPress version you want to test against. This should be the lowest version of WordPress that you want to support. While WPGraphQL officially supports WordPress 5.0+, we recommend testing against WordPress 5.6 (the current lowest version actively [tested against](https://github.com/wp-graphql/wp-graphql/blob/develop/.github/workflows/testing-integration.yml)) or higher.
5656
- [`WordPress.WP.I18n.text_domain`](./phpcs.xml.dist.example#L63) - The text domain used in your project. This is used by the `WordPress.WP.I18n` sniff to check that all translatable strings are assigned to a text domain. We recommend using the format `wp-graphql-<project-name>`.
5757
- [`WordPress.NamingConventions.PrefixAllGlobals`](./phpcs.xml.dist.example#L57) - The list of prefixes used in your project. This is used by the `WordPress.NamingConventions.PrefixAllGlobals` sniff to check that all global functions, classes, constants, and variables are prefixed.

WPGraphQL-Core/ruleset.xml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,31 @@
66

77
<!-- Load WordPress Coding standards -->
88
<rule ref="WPGraphQL-Strict" >
9-
<!-- Conflicts with b/c in AbstractConnectionResolver -->
10-
<exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" />
119
<!-- This would be a breaking change to fix in Core -->
1210
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
1311
<!-- Most capabilities are referenced via variable -->
1412
<exclude name="WordPress.WP.Capabilities.Undetermined" />
1513
<!-- Most would require breaking changes to fix in core. Tracking: https://github.com/wp-graphql/wp-graphql/issues/2925 -->
1614
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter" />
15+
16+
<!-- Depends on Squiz.Commenting.FunctionComment.MissingParamComment -->
17+
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation" />
18+
19+
<!-- Should probably be added back. -->
20+
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue.NullabilityTypeMissing" />
1721
</rule>
1822

23+
<rule ref="WPGraphQL-Docs" />
24+
<!-- Conflicts with b/c in AbstractConnectionResolver -->
25+
<exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" />
26+
27+
<!-- Should probably be added back -->
28+
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
29+
<exclude name="Squiz.Commenting.ClassComment.Missing" />
30+
<exclude name="Squiz.Commenting.FileComment.Missing" />
31+
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
32+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
33+
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
34+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
35+
<rule />
1936
</ruleset>

WPGraphQL-Docs/ruleset.xml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,29 @@
44

55
<!-- The rules below are the changes from between the original sniff or parent ruleset, and what should be applied for this Standard. -->
66

7-
<rule ref="Squiz.Commenting">
7+
<rule ref="WordPress-Docs">
88
<severity>5</severity>
9-
<!-- This is an uncommon pattern. -->
10-
<exclude name="Squiz.Commenting.LongConditionClosingComment" />
11-
<!-- This is a fairly common pattern. -->
12-
<exclude name="Squiz.Commenting.PostStatementComment.Found" />
13-
<!-- Not necessary if the var is typed inline. -->
14-
<exclude name="Squiz.Commenting.VariableComment.MissingVar" />
9+
<!-- Conflicts with FQCN -->
10+
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint" />
11+
<!-- Conflicts with b/c in AbstractConnectionResolver -->
12+
<exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" />
13+
</rule>
14+
<rule ref="Squiz.Commenting.FunctionComment">
15+
<properties>
16+
<property name="skipIfInheritdoc" value="true" />
17+
</properties>
1518
</rule>
1619

20+
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" />
21+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
22+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation" />
23+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessSuppress" />
24+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing" />
25+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
26+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.UselessSuppress" />
27+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
28+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation" />
29+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessSuppress" />
30+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" />
1731

1832
</ruleset>

WPGraphQL-Extra/ruleset.xml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,9 @@
3030

3131
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator" />
3232

33-
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
34-
<properties>
35-
<property name="caseSensitive" value="true"/>
36-
</properties>
37-
</rule>
38-
3933
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration" />
4034
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction" />
4135

4236
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon" />
4337

44-
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
45-
<!-- WP dependencies are too loosely typed to implement this safely. -->
46-
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint" />
47-
</rule>
48-
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing" />
49-
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
50-
<!-- WP dependencies are too loosely typed to implement this safely. -->
51-
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint" />
52-
<!-- Conflicts with Squiz.Commenting.-->
53-
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.UselessAnnotation" />
54-
</rule>
55-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
56-
<!-- WP dependencies are too loosely typed to implement this safely. -->
57-
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint" />
58-
</rule>
59-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" />
60-
61-
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />
62-
6338
</ruleset>

WPGraphQL-Minimum/ruleset.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
2323

2424
<!-- Should probably not be added back -->
25-
<exclude name="PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.objectFound"/>
2625
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores"/>
2726

2827
<!-- Added back in WPGraphQL-Strict -->
@@ -31,8 +30,6 @@
3130
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
3231
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
3332
<exclude name="WordPress.WP.Capabilities.Undetermined" />
34-
35-
<!-- This would be a breaking change to fix in Core -->
3633
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
3734
</rule>
3835

@@ -57,8 +54,9 @@
5754
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" />
5855
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" />
5956
<rule ref="SlevomatCodingStandard.Classes.DisallowStringExpressionPropertyFetch" />
57+
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference" />
6058
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
61-
59+
6260
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
6361

6462
<rule ref="SlevomatCodingStandard.Functions.StaticClosure" />
@@ -71,6 +69,9 @@
7169
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
7270
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
7371

72+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.LessSpecificNativeTypeHint" />
73+
7474
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
75+
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />
7576

7677
</ruleset>

WPGraphQL-Strict/ruleset.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,24 @@
5959
<property name="enableOnObjects" value="false"/>
6060
</properties>
6161
</rule>
62-
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference" />
6362

6463
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
6564
<rule ref="SlevomatCodingStandard.Exceptions.DisallowNonCapturingCatch" />
6665
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />
6766

67+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
68+
<properties>
69+
<property name="caseSensitive" value="true"/>
70+
</properties>
71+
</rule>
6872
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
6973

74+
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" />
75+
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition" />
76+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint" />
77+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint" />
78+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint" />
79+
7080
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable" >
7181
<properties>
7282
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "axepress/wp-graphql-cs",
33
"type": "phpcodesniffer-standard",
44
"description": "PHP_CodeSniffer rules (sniffs) for the WPGraphQL ecosystem.",
5-
"version": "2.0.0-beta.1",
5+
"version": "2.0.0-beta.2",
66
"keywords": [
77
"phpcs",
88
"wpcs",

0 commit comments

Comments
 (0)