Skip to content

Commit c75af83

Browse files
committed
4.0 user upgrade guide: minor formatting tweaks
1 parent 876395b commit c75af83

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

wiki/Version-4.0-User-Upgrade-Guide.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ There is a separate [[Upgrade Guide for Sniff Developers and Integrators|Version
3636

3737
It is highly recommended to upgrade as soon as you are able.
3838

39-
The PHP_CodeSniffer 3.x branch will no longer receive updates, with the exception of security fixes and runtime compatibility fixes for new PHP versions.
40-
This "limited support" will last a maximum of one year from the date of the PHP_Codesniffer 4.0.0 release.
39+
The PHP_CodeSniffer 3.x branch will no longer receive updates, with the exception of security fixes and runtime compatibility fixes for new PHP versions.
40+
This "limited support" will last a maximum of one year from the date of the PHP_CodeSniffer 4.0.0 release.
4141

4242
### External Standards
4343

@@ -72,7 +72,7 @@ If you want, you can even silence them by running PHP_CodeSniffer in quiet mode
7272

7373
### The minimum PHP version is now PHP 7.2.0
7474

75-
This has no impact on the "code under scan", it just means that when running PHP_CodeSniffer, the minimum PHP version needs to be PHP 7.2.
75+
This has no impact on the "code under scan", it just means that when running PHP_CodeSniffer, the minimum PHP version needs to be PHP 7.2.
7676
As an example, you can run PHP_CodeSniffer on PHP 8.4 to scan a code base which is supposed to run on PHP 5.6.
7777

7878
<p align="right"><a href="#table-of-contents">back to top</a></p>
@@ -112,25 +112,25 @@ To continue running code style and code quality checks on JS and/or CSS files, u
112112
#### Upgrading
113113

114114
There are two kinds of sniffs which are affected by this:
115-
1. Sniffs which are specific to JS/CSS and only target JS/CSS code.
115+
1. Sniffs which are specific to JS/CSS and only target JS/CSS code.
116116
If you use JS/CSS specific sniffs from either PHP_CodeSniffer itself or from an external standard, remove references to these sniffs from your ruleset.
117-
2. "Mixed" sniffs, i.e. sniffs which target both PHP as well as JS and/or CSS code.
117+
2. "Mixed" sniffs, i.e. sniffs which target both PHP as well as JS and/or CSS code.
118118
If an external standard you include in your ruleset contains these type of "mixed" sniffs, contact the maintainer of that standard about making the sniff compatible with PHP_CodeSniffer 4.0.
119119

120120
PHP_CodeSniffer >= 3.13.0 will show you deprecation notices for these sniffs to help you find them.
121121

122122
Secondly, review your `extensions` settings.
123-
* If you have `extensions` set in a ruleset, like `<arg name="extensions" value="php,inc/php" />`, be sure to remove any non-PHP extensions.
123+
* If you have `extensions` set in a ruleset, like `<arg name="extensions" value="php,inc/php" />`, be sure to remove any non-PHP extensions.
124124
You can also remove the language part, i.e. `php,inc/php` becomes `php,inc`.
125-
* Next, make sure to also check for any hard-coded commands which pass the `--extensions=...` CLI argument, like in continuous integration scripts.
125+
* Next, make sure to also check for any hard-coded commands which pass the `--extensions=...` CLI argument, like in continuous integration scripts.
126126
The same applies there: remove any non-PHP extensions and remove any potential language settings.
127127

128128
<p align="right"><a href="#table-of-contents">back to top</a></p>
129129

130130

131131
### Setting array properties for sniffs
132132

133-
PHP_CodeSniffer 3.3.0 introduced a new syntax to set the value of array properties for sniffs by specifying array elements using a new `element` tag with `key` and `value` attributes. The old syntax was deprecated in the same PHP_CodeSniffer version.
133+
PHP_CodeSniffer 3.3.0 introduced a new syntax to set the value of array properties for sniffs by specifying array elements using a new `element` tag with `key` and `value` attributes. The old syntax was deprecated in the same PHP_CodeSniffer version.
134134
Support for the old syntax has been removed in PHP_CodeSniffer 4.0.0.
135135

136136
#### Upgrading
@@ -190,7 +190,7 @@ If you haven't done so already, search your `[.]phpcs.xml[.dist]` file for...
190190

191191
### Removed error codes
192192

193-
As of PHP_CodeSniffer 4.0, PHP_CodeSniffer will no longer throw warnings about potential parse errors.
193+
As of PHP_CodeSniffer 4.0, PHP_CodeSniffer will no longer throw warnings about potential parse errors.
194194
This was only done in a few places anyway, while the vast majority of sniffs would try to silently ignore code with parse errors.
195195

196196
> [!NOTE]
@@ -291,7 +291,7 @@ If you haven't done so already, execute a search & replace on your code base.
291291

292292
The exit codes used by PHP_CodeSniffer have changed. This change was made primarily to allow for `phpcbf` to exit with a `0` exit code if all fixable issues were fixed and there are no non-auto-fixable issues remaining.
293293

294-
The pre-existing [`ignore_warnings_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-warnings-when-generating-the-exit-code) and [`ignore_errors_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-errors-when-generating-the-exit-code) config flags will still be respected.
294+
The pre-existing [`ignore_warnings_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-warnings-when-generating-the-exit-code) and [`ignore_errors_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-errors-when-generating-the-exit-code) config flags will still be respected.
295295
Additionally, you can now use the new `ignore_non_auto_fixable_on_exit` config flag to ignore non-auto-fixable issues when the exit code is generated.
296296

297297
#### Upgrading
@@ -309,8 +309,8 @@ Just before the final 4.0.0 release, the PHP_CodeSniffer `master` branch will be
309309

310310
##### Referencing the PHP_CodeSniffer XSD file for rulesets
311311

312-
If your ruleset includes a reference to the PHP_CodeSniffer XSD file via a URL, that URL will become invalid.
313-
As of mid May 2025, the current PHP_CodeSniffer ruleset XSD file can be referenced via the following permalink: `https://schema.phpcodesniffer.com/phpcs.xsd`.
312+
If your ruleset includes a reference to the PHP_CodeSniffer XSD file via a URL, that URL will become invalid.
313+
As of mid May 2025, the current PHP_CodeSniffer ruleset XSD file can be referenced via the following permalink: `https://schema.phpcodesniffer.com/phpcs.xsd`.
314314
Permalinks to the XSD file for specific minors are also available in the following format: `https://schema.phpcodesniffer.com/#.#/phpcs.xsd`.
315315

316316
Example changeset:
@@ -325,7 +325,7 @@ Relative file references like `xsi:noNamespaceSchemaLocation="./vendor/squizlabs
325325

326326
##### Referencing the main branches in the repo
327327

328-
If you reference a development version of PHP_CodeSniffer in your `composer.json` file or in CI scripts, those references will need to be updated.
328+
If you reference a development version of PHP_CodeSniffer in your `composer.json` file or in CI scripts, those references will need to be updated.
329329
What to update these to, depends on your use-case.
330330

331331
* If you want to use the latest development version of PHP_CodeSniffer, use the `4.x` branch. For Composer, references to the branch will need to look like this: `4.x-dev`.
@@ -367,7 +367,7 @@ Previously a ruleset could already "extend" an array property for a sniff set by
367367

368368
As of PHP_CodeSniffer 4.0, a ruleset can also "extend" the default value of an array property as set in the sniff itself.
369369

370-
The upside of this is, that if you want to default value + some extras, you no longer need to duplicate the default values from sniff array properties in your ruleset.
370+
The upside of this is, that if you want to default value + some extras, you no longer need to duplicate the default values from sniff array properties in your ruleset.
371371
The downside is, of course, that if the default value of the property in the sniff changes, your scans may start failing without warning.
372372

373373
#### Upgrading
@@ -403,7 +403,7 @@ Now you can "inherit" the default value and add to it by using `extend="true"`:
403403
<p align="right"><a href="#table-of-contents">back to top</a></p>
404404

405405

406-
### My scans are failing on a "No files were checked" error...
406+
### My scans are failing on a "No files were checked" error
407407

408408
Between the extension filtering via `--extensions=...` (CLI) / `<arg name="extensions" value="..."/>` (ruleset), potential `--ignore=...` (CLI) / `<exclude-pattern>...` (ruleset) directives being followed, and potential `--filter=...` directives, there are no files eligible for scanning.
409409

0 commit comments

Comments
 (0)