Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Bump WP Coding Standards Dependency from ^2.3 → ^3.0 #10

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

ggwicz
Copy link

@ggwicz ggwicz commented Dec 8, 2023

The 2.x versions of the WP Coding Standards are often producing the following errors when you run phpcs, which pollutes the output:

FILE: stellarwp-web-common/Plugin.php
------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
 1 | ERROR | Missing file doc comment (Squiz.Commenting.FileComment.Missing)
 1 | ERROR | An error occurred during processing; checking has been aborted. The error message
   |       | was: trim(): Passing null to parameter #1 ($string) of type string is deprecated
   |       | in
   |       | /Users/stellarwp/Sites/orderable-website/wp-content/mu-plugins/stellarwp-web-common/stellarwp-web-common/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php
   |       | on line 194 (Internal.Exception)
------------------------------------------------------------------------------------------------

The line of code in I18nSniff.php that they mention is this:

// Allow overruling the text_domain set in a ruleset via the command line.
$cl_text_domain = trim( PHPCSHelper::get_config_data( 'text_domain' ) );

I was hoping there was a way we could fix this by reconfiguring how we were setting our text domain in our PHPCS XML config files, but the format we are using is correct:

<rule ref="WordPress.WP.I18n">
    <properties>
        <property name="text_domain" type="array">
            <element value="stellarwp-web-common"/>
        </property>
    </properties>
</rule>

Using a more up-to-date version of WPCS resolves this issue.

@ggwicz ggwicz requested a review from borkweb December 8, 2023 00:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant