Skip to content

Commit 5eef494

Browse files
authored
Merge pull request #12 from inpsyde/docs
Fix and improve docs
2 parents 01df6cf + 8632829 commit 5eef494

File tree

3 files changed

+35
-33
lines changed

3 files changed

+35
-33
lines changed

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@ The Syde PHP Coding Standards package requires:
3939

4040
- PHP 8.1+
4141
- [Composer](https://getcomposer.org/)
42-
- [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/) 3.11+
43-
- [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/PHPCSStandards/composer-installer/) 1.0+
44-
- [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility/) 10+ (`dev-develop`)
45-
- [PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra/) 1.2+
46-
- [PHPCSUtils](https://github.com/PHPCSStandards/PHPCSUtils/) 1.0+
47-
- [Slevomat Coding Standard](https://github.com/slevomat/coding-standard/) 8.15
48-
- [VariableAnalysis](https://github.com/sirbrillig/phpcs-variable-analysis/) 2.11+
49-
- [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards/) 3.1+
50-
- [WordPress VIP Coding Standards](https://github.com/Automattic/VIP-Coding-Standards/) 3.0+
42+
- [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/)
43+
- [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/PHPCSStandards/composer-installer/)
44+
- [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility/) (`dev-develop`)
45+
- [PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra/)
46+
- [PHPCSUtils](https://github.com/PHPCSStandards/PHPCSUtils/)
47+
- [Slevomat Coding Standard](https://github.com/slevomat/coding-standard/)
48+
- [VariableAnalysis](https://github.com/sirbrillig/phpcs-variable-analysis/)
49+
- [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards/)
50+
- [WordPress VIP Coding Standards](https://github.com/Automattic/VIP-Coding-Standards/)
5151

5252
When installed for local development, these packages will be installed as well:
5353

54-
- [PHPStan](https://github.com/phpstan/phpstan/) 2.1+
55-
- [PHPStan Deprecation Rules Extension](https://github.com/phpstan/phpstan-deprecation-rules) 2.0+
56-
- [PHPStan No-Private Extension](https://github.com/swissspidy/phpstan-no-private) 1.0+
57-
- [PHPUnit](https://github.com/sebastianbergmann/phpunit/) 10.5+
54+
- [PHPStan](https://github.com/phpstan/phpstan/)
55+
- [PHPStan Deprecation Rules Extension](https://github.com/phpstan/phpstan-deprecation-rules)
56+
- [PHPStan No-Private Extension](https://github.com/swissspidy/phpstan-no-private)
57+
- [PHPUnit](https://github.com/sebastianbergmann/phpunit/)
5858

5959
## Installation
6060

@@ -128,6 +128,7 @@ A minimum working example could look like so:
128128
```xml
129129
<?xml version="1.0"?>
130130
<ruleset>
131+
131132
<!-- Minimum required Syde PHP Coding Standard rules. -->
132133
<rule ref="Syde-Core" />
133134

@@ -150,6 +151,7 @@ Here is a real-world example including files and folders to check, as well as so
150151
```xml
151152
<?xml version="1.0"?>
152153
<ruleset>
154+
153155
<!-- Check for cross-version support for PHP 8.1 and higher. -->
154156
<config name="testVersion" value="8.1-" />
155157

@@ -178,16 +180,16 @@ Here is a real-world example including files and folders to check, as well as so
178180

179181
<!-- Do not report on function length for tests. -->
180182
<rule ref="Syde.Functions.FunctionLength">
181-
<exclude-pattern>*/tests/cases/*</exclude-pattern>
183+
<exclude-pattern>*/tests/*</exclude-pattern>
182184
</rule>
183185

184186
<!-- PSR-4 namespace configuration. -->
185187
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
186188
<properties>
187189
<property name="rootNamespaces" type="array">
188190
<element key="src" value="MyCompany\MyProject" />
189-
<element key="tests/cases" value="MyCompany\MyProject\Tests" />
190191
<element key="tests/src" value="MyCompany\MyProject\Tests" />
192+
<element key="tests/unit" value="MyCompany\MyProject\Tests" />
191193
</property>
192194
</properties>
193195
</rule>

docs/Migration.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ sed -i -f /path/to/phpcs.sed -- $(grep -nrl -e 'Inpsyde.CodeQuality' -e 'Inpsyde
131131
```
132132

133133
> [!TIP]
134-
> The command mentioned above may result in an error on a Mac. In most cases, the -i flag can be specified as an empty string (e.g. `sed -i ''`) to resolve the issue.
134+
> The above command may result in an error on a Mac. If this is the case for you, try passing an empty string as argument for the `-i` flag to prevent this error from happening (e.g., `sed -i '' ...`).
135135
136136
The above command will first retrieve the list of files that include `Inpsyde.CodeQuality` or `InpsydeTemplates.Formatting`, ignoring the `vendor` directory, and then execute all substitution commands in the `phpcs.sed` file for each of the found files.
137137

@@ -151,7 +151,7 @@ Wherever you were previously referencing the `Inpsyde` standard, you may want to
151151

152152
If you are using `InpsydeTemplates`, this would now be `Syde-Templates`.
153153

154-
### PHP_CodeSniffer Rulesets
154+
### PHP_CodeSniffer Rulesets
155155

156156
In addition to the changes to the rule names, there are also changes regarding sniff configuration.
157157

@@ -163,12 +163,12 @@ The `Inpsyde.CodeQuality.Psr4` sniff has a public `array` property, `$psr4`, tha
163163

164164
```xml
165165
<rule ref="Inpsyde.CodeQuality.Psr4">
166-
<properties>
167-
<property name="psr4" type="array">
168-
<element key="MyCompany\MyProject" value="src"/>
169-
<element key="MyCompany\MyProject\Tests" value="tests/src|tests/e2e|tests/unit"/>
170-
</property>
171-
</properties>
166+
<properties>
167+
<property name="psr4" type="array">
168+
<element key="MyCompany\MyProject" value="src"/>
169+
<element key="MyCompany\MyProject\Tests" value="tests/src|tests/e2e|tests/unit"/>
170+
</property>
171+
</properties>
172172
</rule>
173173
```
174174

@@ -178,14 +178,14 @@ An example configuration that matches the above behavior looks like so:
178178

179179
```xml
180180
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
181-
<properties>
182-
<property name="rootNamespaces" type="array">
183-
<element key="src" value="MyCompany\MyProject" />
184-
<element key="tests/src" value="MyCompany\MyProject\Tests" />
185-
<element key="tests/e2e" value="MyCompany\MyProject\Tests" />
186-
<element key="tests/unit" value="MyCompany\MyProject\Tests" />
187-
</property>
188-
</properties>
181+
<properties>
182+
<property name="rootNamespaces" type="array">
183+
<element key="src" value="MyCompany\MyProject" />
184+
<element key="tests/src" value="MyCompany\MyProject\Tests" />
185+
<element key="tests/e2e" value="MyCompany\MyProject\Tests" />
186+
<element key="tests/unit" value="MyCompany\MyProject\Tests" />
187+
</property>
188+
</properties>
189189
</rule>
190190
```
191191

docs/Sniffs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ There are some exceptions:
206206
- PHP native double underscore method;
207207
- WordPress hook callbacks;
208208
- select PHP methods: `seek`, `unserialize`.
209-
209+
210210
Via the `allowedMethodNames` property, you can specify method names that are allowed to bypass the argument type checks:
211211

212212
```xml
@@ -283,7 +283,7 @@ This is optional, and you may want to move the curly brace up and add a blank li
283283
This sniff triggers an error if a function is longer than the maximum allowed length (default: 50 lines).
284284

285285
By default, the following is ignored when counting lines:
286-
286+
287287
- blank lines;
288288
- comments;
289289
- doc block **inside** function block.

0 commit comments

Comments
 (0)