Skip to content

Composer: make PHP extension dependencies explicit - #2330

Merged
dingo-d merged 1 commit into
developfrom
feature/composer-make-extension-deps-explicit
Aug 11, 2023
Merged

dingo-d merged 1 commit into
developfrom
feature/composer-make-extension-deps-explicit

Conversation

@jrfnl

@jrfnl jrfnl commented Aug 11, 2023

Copy link
Copy Markdown
Member

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 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.

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.
@dingo-d
dingo-d merged commit 9cf9f24 into develop Aug 11, 2023
@dingo-d
dingo-d deleted the feature/composer-make-extension-deps-explicit branch August 11, 2023 08:05
@GaryJones

Copy link
Copy Markdown
Member

And well, the dependency on the Tokenizer extension should be obvious ;-)

Shouldn't PHPCS already have that as a dependency?

@jrfnl

jrfnl commented Aug 11, 2023

Copy link
Copy Markdown
Member Author

@GaryJones It does, but as we in the WPCS code directly reference token constants, it is also our dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants