Package Details: php-codesniffer-wordpress 3.1.0-1

Git Clone URL: https://aur.archlinux.org/php-codesniffer-wordpress.git (read-only, click to copy)
Package Base: php-codesniffer-wordpress
Description: PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
Upstream URL: https://github.com/WordPress/WordPress-Coding-Standards
Licenses: MIT
Submitter: matth
Maintainer: matth
Last Packager: matth
Votes: 3
Popularity: 0.098246
First Submitted: 2018-02-28 14:50 (UTC)
Last Updated: 2024-03-28 14:18 (UTC)

Latest Comments

matth commented on 2023-09-08 18:30 (UTC)

This is now updated to 3.0.0 and the workarounds for PHP 8 are no longer needed.

Bink commented on 2022-09-12 05:08 (UTC) (edited on 2022-09-12 05:11 (UTC) by Bink)

Just as a side note, pulling from the develop branch, which contains the fix for the previously mentioned Uncaught TypeError: vsprintf() issue, results in another long time unresolved error.

phpcs: Referenced sniff "PHPCSUtils" does not exist

The solution that's currently working for me (offered here), is to use the release version (ie, this package), but replace just one file, with one from the develop branch.

File I replaced: /usr/share/pear/PHP/CodeSniffer/Standards/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php

I replaced with: https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php

Bink commented on 2022-09-12 04:34 (UTC) (edited on 2022-09-12 04:35 (UTC) by Bink)

When using PHP 8.0 and running a command like this:

phpcs --standard=WordPress some-file.php

The following fatel error is thrown:

PHP Fatal error:  Uncaught TypeError: vsprintf(): Argument #2 ($values) must be of type array...

This is a known issue, documented here:

Bink commented on 2022-09-12 04:26 (UTC) (edited on 2022-09-12 04:27 (UTC) by Bink)

The WordPress standards were installed with this, but not added to PHP Code Sniffer's configuration.

To do that, I ran:

phpcs --config-set installed_paths /usr/share/pear/PHP/CodeSniffer/Standards/