Closed akshitsethi closed 9 months ago
No release has been made yet but a tagged version in wpcs
repo has this issue resolved.
https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/2.3.0-fix-vsprintf
@akshitsethi I am seeing the same thing. Do you have a temporary workaround in your project to get past this?
Long term solution might be to version control the wpcs
package in the composer.json file but that would require a release by this repository. I'm hoping there is something more temporary we can do right now.
@claytoncollie Unfortunately, I'm stuck as well atm. If you want something to be fixed locally for you, then I suggest you make the changes as done in this PR - https://github.com/WordPress/WordPress-Coding-Standards/pull/1935/files
@akshitsethi @claytoncollie One solution would be to exclude the broken sniff from the 10up ruleset and add the updated version from that PR as a custom sniff in the 10up ruleset.
I tried to create a branch in this repository with the tag created by Gary Jones. But since it is on the develop
branch and not published to packagist, I am having a hard time sourcing it with the command composer require wp-coding-standards/wpcs:dev-develop#2.3.0-fix-vsprintf -W
and that is after adding a repo reference to the composer.json file seen below.
"repositories": [
{
"type": "git",
"url": "https://github.com/WordPress/WordPress-Coding-Standards"
}
],
Running the require command produces an error related to the automatic vipcs package.
Problem 1
- automattic/vipwpcs is locked to version 2.3.3 and an update of this package was not requested.
- automattic/vipwpcs 2.3.3 requires wp-coding-standards/wpcs ^2.3 -> found wp-coding-standards/wpcs[2.3.0] but it conflicts with your root composer.json require (dev-develop#2.3.0-fix-vsprintf).
I think the easiest fix is what @johnwatkins0 suggested.
@claytoncollie your idea worked great for me after a long struggle trying other solutions. Thanks! Here's my composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/WordPress/WordPress-Coding-Standards"
}
],
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-coding-standards/wpcs": "dev-develop#2.3.0-fix-vsprintf"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
The official roadmap for WPCS v3.0, which adds support for PHP 8.0 can be read here: https://github.com/WordPress/WordPress-Coding-Standards/issues/1877
The workaround I used for this was to upgrade to PHP 8.1 (8.0 is approaching EOL in a couple months anyway) and then add the following to your phpcs.xml file: <ini name="error_reporting" value="E_ALL & ~E_DEPRECATED" />
. If you don't add that to your phpcs.xml you will see an error like this "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..."
WPCS 3.0.0 was released on 8/21. You can either wait for this repository to be updated or you can use the composer.json example above to require the latest tag.
https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.0
I've just tagged a 3.0.0-RC1
release that updates the ruleset to use PHPCS 3.0.0.
You can try it out by using:
composer require 10up/phpcs-composer:~3@RC
If you have any issues, please log them in #49 or open an issue and reference that PR.
Describe the bug
There is an error when running
phpcs
with the current release ofwpcs
which isv2.3.0
. The error which occurs forPHP 8.0
only is as under:Related issues:
Steps to Reproduce
v8.0
composer lint
for any project usingphpcs-composer
packageScreenshots, screen recording, code snippet
Environment information
v8.0.26
dev-master
v2.3.0
WordPress information
No response
Code of Conduct