Skip to content

Commit e053917

Browse files
committed
Update standards for PHP8
1 parent 75bce86 commit e053917

File tree

4 files changed

+48
-40
lines changed

4 files changed

+48
-40
lines changed

README.md

+35-30
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rules for use primarily with the [SquareOne](https://github.com/moderntribe/squa
55

66
## Requirements
77

8-
- PHP7.4+
8+
- PHP ^8.0
99

1010
## Install
1111

@@ -34,40 +34,45 @@ And `require-dev`:
3434

3535
## Project ruleset
3636

37+
> Ensure you're running PHP 8.0 locally!
38+
3739
To use this ruleset, create a `phpcs.xml.dist` in the root of the project and add the following content:
3840
3941
```xml
4042
<?xml version="1.0"?>
4143
<ruleset>
42-
<arg name="basepath" value="."/>
43-
<arg name="extensions" value="php"/>
44-
<arg name="severity" value="4"/>
45-
<arg name="tab-width" value="4"/>
46-
<arg name="parallel" value="80"/>
47-
<arg name="colors"/>
48-
49-
<!-- Update to the PHP version your production/local docker container runs on -->
50-
<config name="testVersion" value="7.4"/>
51-
<!-- php -r 'echo PHP_VERSION_ID;' -->
52-
<config name="php_version" value="70407"/>
53-
54-
<!-- Ignore warnings, show progress of the run and show sniff names -->
55-
<arg value="nps"/>
56-
57-
<!-- Directories to be checked -->
58-
<file>./wp-content/plugins/core</file>
59-
<file>./wp-content/themes/core</file>
60-
<file>./wp-content/mu-plugins</file>
61-
62-
<!-- Exclude files -->
63-
<exclude-pattern>*-config.php</exclude-pattern>
64-
<exclude-pattern>*vendor/</exclude-pattern>
65-
<exclude-pattern>*tests/*</exclude-pattern>
66-
<exclude-pattern>*.twig</exclude-pattern>
67-
<exclude-pattern>*webpack/</exclude-pattern>
68-
69-
<!-- Include the Modern Tribe coding standard -->
70-
<rule ref="ModernTribe"/>
44+
<arg name="basepath" value="." />
45+
<arg name="extensions" value="php" />
46+
<arg name="severity" value="4" />
47+
<arg name="tab-width" value="4" />
48+
<arg name="parallel" value="80" />
49+
<arg name="colors" />
50+
51+
<!-- Update to the PHP version your production/local docker container runs on -->
52+
<config name="testVersion" value="8.0" />
53+
<!-- php -r 'echo PHP_VERSION_ID;' -->
54+
<config name="php_version" value="80022" />
55+
56+
<!-- Fix WordPress's terrible typing breaking PHPCS -->
57+
<config name="minimum_supported_wp_version" value="5.6.0" />
58+
59+
<!-- Ignore warnings, show progress of the run and show sniff names -->
60+
<arg value="nps" />
61+
62+
<!-- Directories to be checked -->
63+
<file>./wp-content/plugins/core</file>
64+
<file>./wp-content/themes/core</file>
65+
<file>./wp-content/mu-plugins</file>
66+
67+
<!-- Exclude files -->
68+
<exclude-pattern>*-config.php</exclude-pattern>
69+
<exclude-pattern>*vendor/</exclude-pattern>
70+
<exclude-pattern>*tests/*</exclude-pattern>
71+
<exclude-pattern>*.twig</exclude-pattern>
72+
<exclude-pattern>*webpack/</exclude-pattern>
73+
74+
<!-- Include the Modern Tribe coding standard -->
75+
<rule ref="ModernTribe" />
7176
</ruleset>
7277
```
7378

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"license": "MIT",
1818
"require": {
19-
"php": ">=7.4",
19+
"php": "^8.0",
2020
"automattic/vipwpcs": "^2.3",
2121
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
2222
"cweagans/composer-patches": "^1.7",

composer.lock

+9-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ModernTribe/ruleset.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@
143143
</properties>
144144
</rule>
145145
<!-- Checks for missing return typehints in case they can be declared natively -->
146-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint" />
146+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
147+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
148+
</rule>
147149

148150
<!-- Require space around colon in return types -->
149151
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">

0 commit comments

Comments
 (0)