From e86ba1c22449e6f53462bc4bfe82c189d2444e25 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 18 Mar 2026 14:08:06 +0100 Subject: [PATCH 1/5] Wiki/Requirements: add links to the docs for each PHP extension --- wiki/Requirements.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/wiki/Requirements.md b/wiki/Requirements.md index eac3823..b004902 100644 --- a/wiki/Requirements.md +++ b/wiki/Requirements.md @@ -1,19 +1,26 @@ -PHP_CodeSniffer 4.x requires PHP 7.2.0 or greater. +PHP_CodeSniffer 4.x requires PHP 7.2.0 or greater. _Prior to PHP_CodeSniffer 4.0.0, the minimum PHP requirement was 5.4.0._ Additionally, PHP_CodeSniffer requires the following PHP extensions to be enabled: -- Tokenizer: used by the core tokenizer to process PHP files -- SimpleXML: used to process ruleset XML files -- XMLWriter: used to create some report formats +- [Tokenizer][tokenizer]: used by the core tokenizer to process PHP files +- [SimpleXML][simplexml]: used to process ruleset XML files +- [XMLWriter][xmlwriter]: used to create some report formats The following PHP extensions are not required, but are strongly recommended: -- iconv: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. -- PCNTL: required for parallel processing via the `--parallel` CLI option. Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously. +- [iconv]: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. +- [PCNTL][pcntl]: required for parallel processing via the `--parallel` CLI option. Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously. Individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options) manual page for a list of these requirements. > [!WARNING] -> The gRPC PHP extension is known to cause PHP_CodeSniffer to hang when running with parallel processing enabled. If the gRPC extension is loaded, either do not use the `--parallel` CLI option or configure the extension's ini settings as follows: +> The [gRPC PHP extension][grpc] is known to cause PHP_CodeSniffer to hang when running with parallel processing enabled. If the gRPC extension is loaded, either do not use the `--parallel` CLI option or configure the extension's ini settings as follows: > ```text > phpcs -d grpc.enable_fork_support=1 -d grpc.poll_strategy=epoll1 [other options] > ``` + +[grpc]: https://grpc.io/docs/languages/php/ +[iconv]: https://www.php.net/book.iconv +[pcntl]: https://www.php.net/book.pcntl +[simplexml]: https://www.php.net/book.simplexml +[tokenizer]: https://www.php.net/book.tokenizer +[xmlwriter]: https://www.php.net/book.xmlwriter From 1db2835355d9ef08a03d178a81ca175d2e3799e6 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 18 Mar 2026 14:38:02 +0100 Subject: [PATCH 2/5] Wiki/Requirements: add information on additional PHP extensions Addresses some of the action points listed in PHPCSStandards/PHP_CodeSniffer 1392 --- wiki/Requirements.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wiki/Requirements.md b/wiki/Requirements.md index b004902..86e95ea 100644 --- a/wiki/Requirements.md +++ b/wiki/Requirements.md @@ -5,9 +5,12 @@ Additionally, PHP_CodeSniffer requires the following PHP extensions to be enable - [Tokenizer][tokenizer]: used by the core tokenizer to process PHP files - [SimpleXML][simplexml]: used to process ruleset XML files - [XMLWriter][xmlwriter]: used to create some report formats +- [libxml]: required by the SimpleXML and XMLWriter extensions The following PHP extensions are not required, but are strongly recommended: +- [DOM][dom]: used for displaying the sniff documentation via the `--generator=...` option. - [iconv]: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. +- [json]: required for the cache functionality, as well as for the JSON report output. - [PCNTL][pcntl]: required for parallel processing via the `--parallel` CLI option. Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously. Individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options) manual page for a list of these requirements. @@ -18,8 +21,11 @@ Individual sniffs may have additional requirements such as external applications > phpcs -d grpc.enable_fork_support=1 -d grpc.poll_strategy=epoll1 [other options] > ``` +[dom]: https://www.php.net/book.dom [grpc]: https://grpc.io/docs/languages/php/ [iconv]: https://www.php.net/book.iconv +[json]: https://www.php.net/book.json +[libxml]: https://www.php.net/book.libxml [pcntl]: https://www.php.net/book.pcntl [simplexml]: https://www.php.net/book.simplexml [tokenizer]: https://www.php.net/book.tokenizer From 159d41b915af2160d52ccada65a89ee5c876bed1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 18 Mar 2026 16:51:45 +0100 Subject: [PATCH 3/5] Wiki/Requirements: add more info about recommendations and links to other wiki docs --- wiki/Requirements.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wiki/Requirements.md b/wiki/Requirements.md index 86e95ea..36179d7 100644 --- a/wiki/Requirements.md +++ b/wiki/Requirements.md @@ -9,11 +9,11 @@ Additionally, PHP_CodeSniffer requires the following PHP extensions to be enable The following PHP extensions are not required, but are strongly recommended: - [DOM][dom]: used for displaying the sniff documentation via the `--generator=...` option. -- [iconv]: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. -- [json]: required for the cache functionality, as well as for the JSON report output. +- [iconv]: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. Additionally, the following reports may not work correctly without this extension: [Checkstyle][wiki-report-checkstyle], [JUnit][wiki-report-junit] and [XML][wiki-report-xml]. +- [json]: required for the cache functionality, as well as for the [JSON report][wiki-report-json] output. - [PCNTL][pcntl]: required for parallel processing via the `--parallel` CLI option. Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously. -Individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options) manual page for a list of these requirements. +Individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options][wiki-config] manual page for a list of these requirements. > [!WARNING] > The [gRPC PHP extension][grpc] is known to cause PHP_CodeSniffer to hang when running with parallel processing enabled. If the gRPC extension is loaded, either do not use the `--parallel` CLI option or configure the extension's ini settings as follows: @@ -30,3 +30,9 @@ Individual sniffs may have additional requirements such as external applications [simplexml]: https://www.php.net/book.simplexml [tokenizer]: https://www.php.net/book.tokenizer [xmlwriter]: https://www.php.net/book.xmlwriter + +[wiki-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options +[wiki-report-checkstyle]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Reporting#printing-a-checkstyle-report +[wiki-report-json]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Reporting#printing-a-json-report +[wiki-report-junit]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Reporting#printing-a-junit-report +[wiki-report-xml]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Reporting#printing-an-xml-report From c995eac7dbff4963fb6ec51b64ad06a05266fa76 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 18 Mar 2026 16:53:17 +0100 Subject: [PATCH 4/5] Wiki/Requirements: improve readability * Highlight (bold) PHP extension names * Force a few long bullet points to display as multiple lines. --- wiki/Requirements.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/wiki/Requirements.md b/wiki/Requirements.md index 36179d7..d05a007 100644 --- a/wiki/Requirements.md +++ b/wiki/Requirements.md @@ -1,22 +1,25 @@ -PHP_CodeSniffer 4.x requires PHP 7.2.0 or greater. +PHP_CodeSniffer 4.x requires **PHP 7.2.0 or greater**. _Prior to PHP_CodeSniffer 4.0.0, the minimum PHP requirement was 5.4.0._ Additionally, PHP_CodeSniffer requires the following PHP extensions to be enabled: -- [Tokenizer][tokenizer]: used by the core tokenizer to process PHP files -- [SimpleXML][simplexml]: used to process ruleset XML files -- [XMLWriter][xmlwriter]: used to create some report formats -- [libxml]: required by the SimpleXML and XMLWriter extensions +- **[Tokenizer][tokenizer]**: used by the core tokenizer to process PHP files +- **[SimpleXML][simplexml]**: used to process ruleset XML files +- **[XMLWriter][xmlwriter]**: used to create some report formats +- **[libxml]**: required by the SimpleXML and XMLWriter extensions -The following PHP extensions are not required, but are strongly recommended: -- [DOM][dom]: used for displaying the sniff documentation via the `--generator=...` option. -- [iconv]: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. Additionally, the following reports may not work correctly without this extension: [Checkstyle][wiki-report-checkstyle], [JUnit][wiki-report-junit] and [XML][wiki-report-xml]. -- [json]: required for the cache functionality, as well as for the [JSON report][wiki-report-json] output. -- [PCNTL][pcntl]: required for parallel processing via the `--parallel` CLI option. Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously. +The following PHP extensions are not required, but are **_strongly recommended_**: +- **[DOM][dom]**: used for displaying the sniff documentation via the `--generator=...` option. +- **[iconv]**: used for accurate character length calculation in files containing multibyte characters. + Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. + Additionally, the following reports may not work correctly without this extension: [Checkstyle][wiki-report-checkstyle], [JUnit][wiki-report-junit] and [XML][wiki-report-xml]. +- **[json]**: required for the cache functionality, as well as for the [JSON report][wiki-report-json] output. +- **[PCNTL][pcntl]**: required for parallel processing via the `--parallel` CLI option. + Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously. Individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options][wiki-config] manual page for a list of these requirements. > [!WARNING] -> The [gRPC PHP extension][grpc] is known to cause PHP_CodeSniffer to hang when running with parallel processing enabled. If the gRPC extension is loaded, either do not use the `--parallel` CLI option or configure the extension's ini settings as follows: +> The **[gRPC PHP extension][grpc]** is known to cause PHP_CodeSniffer to hang when running with parallel processing enabled. If the gRPC extension is loaded, either do not use the `--parallel` CLI option or configure the extension's ini settings as follows: > ```text > phpcs -d grpc.enable_fork_support=1 -d grpc.poll_strategy=epoll1 [other options] > ``` From 81680a0c9b83f2e208587c0d2cb7132d56642d51 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 20 Mar 2026 17:16:21 +0100 Subject: [PATCH 5/5] Wiki/Requirements: improve information about use of iconv in reports --- wiki/Requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki/Requirements.md b/wiki/Requirements.md index d05a007..62414e8 100644 --- a/wiki/Requirements.md +++ b/wiki/Requirements.md @@ -11,7 +11,7 @@ The following PHP extensions are not required, but are **_strongly recommended_* - **[DOM][dom]**: used for displaying the sniff documentation via the `--generator=...` option. - **[iconv]**: used for accurate character length calculation in files containing multibyte characters. Without this extension, some sniffs, like `Generic.Files.LineLength`, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations. - Additionally, the following reports may not work correctly without this extension: [Checkstyle][wiki-report-checkstyle], [JUnit][wiki-report-junit] and [XML][wiki-report-xml]. + Additionally, the following reports will not work without this extension if the project `encoding` is not UTF-8: [Checkstyle][wiki-report-checkstyle], [JUnit][wiki-report-junit] and [XML][wiki-report-xml]. - **[json]**: required for the cache functionality, as well as for the [JSON report][wiki-report-json] output. - **[PCNTL][pcntl]**: required for parallel processing via the `--parallel` CLI option. Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously.