Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpcbf throwing a fatal error #749

Closed
2 tasks
fclaussen opened this issue Mar 2, 2023 · 3 comments
Closed
2 tasks

phpcbf throwing a fatal error #749

fclaussen opened this issue Mar 2, 2023 · 3 comments

Comments

@fclaussen
Copy link

Bug Description

When running phpcbf on a file it throws the following fatal error

Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/trewknowledge002/test-wp-prettier copy/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php on line 194 in /Users/trewknowledge002/test-wp-prettier copy/vendor/squizlabs/php_codesniffer/src/Runner.php:608

This seems to be a known bug over on the wpcs repository that was already fixed. I'm wondering if maybe the version that ships with vipcs needs updating?
There were several tickets open about the same issue over there: https://github.com/WordPress/WordPress-Coding-Standards/issues?q=phpcbf

Minimal Code Snippet

I'm tweaking with my configs to have the WordPress-Core and WordPress-VIP-Go standards at the same time. Here's a simple function with missing spaces around the argument. PHPCS captured the error correctly, the problem is really just with phpcbf.

function snake_case($foo) {
    echo 'test';
}

Environment

Use php -v and composer show to get versions.

Question Answer
PHP version 8.1.3
PHP_CodeSniffer version 3.7.2
VIPCS version 2.3.0

Tested Against master branch?

Not sure how I would test that using composer. I really just ran the commands on the installation section of the readme.

  • I have verified the issue still exists in the master branch of VIPCS.
  • I have verified the issue still exists in the develop branch of VIPCS.
@GaryJones
Copy link
Contributor

Once WPCS 3.0 is released, then the next major version of VIPCS will use it as a dependency, meaning the issue you found will be resolved.

In the meantime, you can run PHPCS with PHP 7.4 (even if checking code that needs to run under PHP 8.x) and the issue won't appear.

@fclaussen
Copy link
Author

Hi @GaryJones
I appreciate the response.

Is there a timeline for when this will be the case?

@GaryJones
Copy link
Contributor

WPCS should be out in a couple of months. VIPCS will be out after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants