Skip to content

Commit a025c6d

Browse files
committed
Composer: make PHP extension dependencies explicit
PR 1856, which was included in WPCS 2.3.0, introduced a check for strings wrapped in HTML in the `WordPress.WP.I18n` sniff. The underlying code for this check uses the PHP XMLReader extension unconditionally. This means that the PHP [`XMLReader` extension](https://www.php.net/manual/en/xmlreader.installation.php) and `libxml` are hard requirements for WPCS, but this was not yet annotated as such in the `composer.json` `require` section. Along the same lines, `iconv` is used conditionally in the `PrefixAllGlobals` sniff, so should be listed as `suggest`. And well, the dependency on the Tokenizer extension should be obvious ;-) Fixed now. Checked using the ComposerRequireChecker tooling: https://github.com/maglnet/ComposerRequireChecker Note: as this tool relies on an `autoload` requirement in the `composer.json` file, we cannot add it to CI as we use the PHPCS autoloader and should not have the `autoload` directive in our `composer.json` to prevent interference.
1 parent efbaa1d commit a025c6d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
"require": {
1919
"php": ">=5.4",
2020
"ext-filter": "*",
21+
"ext-libxml": "*",
22+
"ext-tokenizer": "*",
23+
"ext-xmlreader": "*",
2124
"squizlabs/php_codesniffer": "^3.7.2",
2225
"phpcsstandards/phpcsutils": "^1.0.8",
2326
"phpcsstandards/phpcsextra": "^1.1.0"
@@ -30,6 +33,7 @@
3033
"php-parallel-lint/php-console-highlighter": "^1.0.0"
3134
},
3235
"suggest": {
36+
"ext-iconv": "For improved results",
3337
"ext-mbstring": "For improved results"
3438
},
3539
"config": {

0 commit comments

Comments
 (0)