Repository navigation
Composer: make PHP extension dependencies explicit - #2330
Merged
Merged
Conversation
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.
GaryJones
approved these changes
Aug 11, 2023
GaryJones
approved these changes
Aug 11, 2023
dingo-d
approved these changes
Aug 11, 2023
Member
Shouldn't PHPCS already have that as a dependency? |
Member
Author
|
@GaryJones It does, but as we in the WPCS code directly reference token constants, it is also our dependency. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #1856, which was included in WPCS 2.3.0, introduced a check for strings wrapped in HTML in the
WordPress.WP.I18nsniff. The underlying code for this check uses the PHP XMLReader extension unconditionally.This means that the PHP
XMLReaderextension andlibxmlare hard requirements for WPCS, but this was not yet annotated as such in thecomposer.jsonrequiresection.Along the same lines,
iconvis used conditionally in thePrefixAllGlobalssniff, so should be listed assuggest.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
autoloadrequirement in thecomposer.jsonfile, we cannot add it to CI as we use the PHPCS autoloader and should not have theautoloaddirective in ourcomposer.jsonto prevent interference.