Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
ff19bbb
Disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
rebeccahum Jul 31, 2024
72ec09b
Merge pull request #824 from Automattic/rm/WordPress-security
rebeccahum Jul 31, 2024
0b496da
PHPStan: fix the build
jrfnl Aug 27, 2024
8db56ec
Merge pull request #825 from Automattic/feature/phpstan-fix
GaryJones Aug 27, 2024
12154a6
Docs: improve consistency and specificity [1]
jrfnl Nov 8, 2024
3a56af3
Docs: improve consistency and specificity [2]
jrfnl Nov 8, 2024
02b07fa
Docs: improve consistency and specificity [3]
jrfnl Nov 8, 2024
6ab21f8
Docs: improve consistency and specificity [4]
jrfnl Nov 8, 2024
b95dde7
DeclarationCompatibility::$checkClasses: improve type specificity
jrfnl Nov 8, 2024
97d83d5
Docs: improve specificity
jrfnl Nov 8, 2024
e2d48fa
GH Actions: always quote variables
jrfnl Oct 13, 2024
42a49a8
Composer: prevent a lock file from being created
jrfnl Aug 22, 2024
fe70595
Merge pull request #827 from Automattic/feature/ghactions-always-quot…
GaryJones Nov 8, 2024
6e53ed0
Merge pull request #828 from Automattic/feature/composer-no-lock
GaryJones Nov 8, 2024
ff4acee
Merge pull request #826 from Automattic/feature/docs-improve-specificity
GaryJones Nov 8, 2024
9771ef4
GH Actions: PHP 8.4 has been released
jrfnl Nov 21, 2024
7ed6c5d
Merge pull request #829 from Automattic/feature/ghactions-update-for-…
GaryJones Nov 22, 2024
ec3cc04
GH Actions: use the xmllint-validate action runner
jrfnl Mar 25, 2025
771cb52
GH Actions: add some additional XML validation checks
jrfnl Mar 25, 2025
5e62512
Remove the `bin/xml-lint` script
jrfnl Mar 25, 2025
ac9c5fc
Merge pull request #830 from Automattic/feature/ghactions-change-xmll…
GaryJones Mar 27, 2025
a843d6e
Rulesets: update schema URL
jrfnl May 19, 2025
a638170
PHPCS: silence deprecation notice for CS run
jrfnl May 19, 2025
a057a98
Fix RulesetTest
jrfnl May 19, 2025
058d2c2
Merge pull request #834 from Automattic/feature/phpcs-silence-depreca…
GaryJones May 20, 2025
828b752
Merge pull request #833 from Automattic/feature/fix-ruleset-test
GaryJones May 20, 2025
dc3f9dd
Merge pull request #835 from Automattic/feature/update-phpcs-xsd-sche…
GaryJones May 22, 2025
3921c7d
Composer: bump PHP Parallel Lint
jrfnl Jul 14, 2025
2d65008
Merge pull request #837 from Automattic/feature/composer-bump-php-par…
GaryJones Jul 14, 2025
2bdb193
AlwaysReturnInFilterUnitTest: remove PHPCS version toggle
jrfnl Jul 14, 2025
d7d1ce2
Merge pull request #838 from Automattic/feature/alwaysreturninfilter-…
GaryJones Jul 14, 2025
f0f80e0
Hard-deprecate all JS specific sniffs
jrfnl Jul 14, 2025
714bc00
Merge pull request #839 from Automattic/feature/deprecate-js-only-sniffs
GaryJones Jul 14, 2025
124863b
Fix dangerous use of contents of constants
jrfnl Jul 16, 2025
be6a932
Fix unnecessary comparison against token type
jrfnl Jul 16, 2025
b451c89
Security/Twig: sniff for all text string tokens
jrfnl Jul 16, 2025
b10aaeb
Security/Twig: bug fix - prevent false positives on interpolated expr…
jrfnl Jul 16, 2025
697e29a
Security/Mustache: sniff for all text string tokens
jrfnl Jul 16, 2025
daf17f0
Security/Mustache: improve tests
jrfnl Jul 16, 2025
95305d3
Security/Mustache: bug fix - potential false positives for delimiter …
jrfnl Jul 16, 2025
0aebe1f
Security/Mustache: prevent false positive on partial text
jrfnl Jul 16, 2025
a83f273
Merge pull request #842 from Automattic/feature/security-mustache-sni…
GaryJones Jul 17, 2025
af10c81
Merge pull request #841 from Automattic/feature/security-twig-sniff-i…
GaryJones Jul 17, 2025
fe2eaf3
Merge pull request #840 from Automattic/feature/fix-problematic-token…
GaryJones Jul 17, 2025
f79a41e
LICENSE: update information about included projects
jrfnl Jul 17, 2025
16f2828
Docs: standardize the sniff file docblocks
jrfnl Jul 17, 2025
f8f1d0b
Docs/Imported sniffs: add `@license` tag for the GPL v2 license
jrfnl Jul 17, 2025
6329f71
Docs: remove `@since` tags which are related to WPCS
jrfnl Jul 17, 2025
7fb7c7c
Merge pull request #844 from Automattic/feature/docs-remove-incorrect…
GaryJones Jul 17, 2025
b2ed777
Merge pull request #843 from Automattic/feature/fix-license-info-and-…
GaryJones Jul 17, 2025
9e92d4b
PHPCS ruleset: fix PHPCompatibility exclusions
jrfnl Jul 18, 2025
052706b
Merge pull request #845 from Automattic/feature/phpcs-ruleset-fix-bro…
GaryJones Jul 18, 2025
8581c40
Security/PHPFilterFunctions: improve the tests
jrfnl Jul 17, 2025
dafc562
Security/PHPFilterFunctions: remove redundant `strtoupper()` calls
jrfnl Jul 18, 2025
e953ac7
Security/PHPFilterFunctions: prevent some false positives
jrfnl Jul 18, 2025
e10dd27
Security/PHPFilterFunctions: add support for PHP 8.0+ named parameters
jrfnl Jul 18, 2025
c65e55c
Security/PHPFilterFunctions: report restricted filter on the correct …
jrfnl Jul 18, 2025
4febbf3
Security/PHPFilterFunctions: ignore function calls using PHP 5.6+ arg…
jrfnl Jul 18, 2025
824bb1b
Security/PHPFilterFunctions: document unsupported PHP feature
jrfnl Jul 18, 2025
497fbce
Security/StaticStrreplace: extend AbstractFunctionParameterSniff
jrfnl Jul 18, 2025
a14e531
Security/StaticStrreplace: add tests with optional fourth parameter
jrfnl Jul 18, 2025
26bddea
Security/StaticStrreplace: bug fix - false negatives for PHP 5.4+ sho…
jrfnl Jul 18, 2025
3cff693
Security/StaticStrreplace: use PHPCSUtils for array parsing
jrfnl Jul 18, 2025
45cb9d5
Security/StaticStrreplace: use pre-parsed function call argument info…
jrfnl Jul 18, 2025
b225a93
Security/StaticStrreplace: handle more "static" tokens
jrfnl Jul 18, 2025
c949fb6
Merge pull request #847 from Automattic/feature/security-staticstrrep…
GaryJones Jul 18, 2025
de77765
Merge pull request #846 from Automattic/feature/security-phpfilterfun…
GaryJones Jul 18, 2025
3f99877
Security/PHPFilterFunctions: change condition
jrfnl Jul 18, 2025
ecdc10c
Merge pull request #848 from Automattic/feature/security-phpfilterfun…
GaryJones Jul 18, 2025
0d5e1ec
Variables/ServerVariables: improve the tests
jrfnl Jul 19, 2025
6f8ebb6
Variables/ServerVariables: use the correct terminology
jrfnl Jul 19, 2025
97f62dd
Variables/ServerVariables: bug fix - incorrect quote stripping
jrfnl Jul 19, 2025
d0362ed
Variables/ServerVariables: bug fix - false positives on OO property a…
jrfnl Jul 19, 2025
5bbd1b9
Variables/ServerVariables: bug fix - faulty array key determination
jrfnl Jul 19, 2025
67bba57
Variables/ServerVariables: bug fix - false negatives for `$GLOBALS['_…
jrfnl Jul 19, 2025
5641bca
Constants/ConstantString: extend AbstractFunctionParameterSniff
jrfnl Jul 19, 2025
397990f
Constants/ConstantString: safeguard and document handling of various …
jrfnl Jul 19, 2025
68260d2
Constants/ConstantString: improve clarity of error message
jrfnl Jul 20, 2025
f55b244
Hooks/RestrictedHooks: improve the tests
jrfnl Jul 20, 2025
3608427
Hooks/RestrictedHooks: bug fix - disregard comments in hook name para…
jrfnl Jul 19, 2025
165aef3
Hooks/RestrictedHooks: add support for handling PHP 8.0+ function cal…
jrfnl Jul 20, 2025
d43835c
Hooks/RestrictedHooks: use PHPCSUtils MessageHelper
jrfnl Jul 20, 2025
c1f6aff
Hooks/RestrictedHooks: bug fix - hook names are case-sensitive
jrfnl Jul 20, 2025
52ee722
Hooks/RestrictedHooks: bug fix - false negatives due to incorrect tok…
jrfnl Jul 20, 2025
ef84c20
Hooks/RestrictedHooks: bug fix - false positives for dynamic name wit…
jrfnl Jul 20, 2025
32623e7
Hooks/RestrictedHooks: bug fix - quotes within a hook name would be s…
jrfnl Jul 20, 2025
b52dad5
Performance/LowExpiryCacheTime: move a parse error test to own test c…
jrfnl Jul 20, 2025
3043a9d
Performance/LowExpiryCacheTime: improve the tests
jrfnl Jul 20, 2025
7c5899b
Performance/LowExpiryCacheTime: add support for PHP 7.4+ numeric lite…
jrfnl Jul 20, 2025
38c0bdb
Performance/LowExpiryCacheTime: cleaner error message
jrfnl Jul 19, 2025
8acb4ae
Performance/LowExpiryCacheTime: add support for handling PHP 8.0+ fun…
jrfnl Jul 20, 2025
ff75da7
Merge pull request #850 from Automattic/feature/variables-servervaria…
GaryJones Jul 21, 2025
025a1e0
Merge pull request #851 from Automattic/feature/constants-constantstr…
GaryJones Jul 21, 2025
a30da72
Merge pull request #852 from Automattic/feature/hooks-restrictedhooks…
GaryJones Jul 21, 2025
05a0547
Merge pull request #853 from Automattic/feature/performance-lowexpiry…
GaryJones Jul 21, 2025
174a08b
Functions/StripTags: improve the tests
jrfnl Jul 17, 2025
ece1b1e
Functions/StripTags: always flag use of the function
jrfnl Jul 17, 2025
043943d
Functions/StripTags: document handling of PHP 5.6 argument unpacking
jrfnl Jul 17, 2025
1318d56
Functions/StripTags: add support for handling PHP 8.0+ function calls…
jrfnl Jul 17, 2025
914a244
Functions/StripTags: add support for handling PHP 8.1 first class cal…
jrfnl Jul 17, 2025
680aa31
Performance/FetchingRemoteData: extend AbstractFunctionParameterSniff
jrfnl Jul 20, 2025
4f190eb
Performance/FetchingRemoteData: add tests for PHP 5.6 arg unpacking a…
jrfnl Jul 20, 2025
d9f5955
Performance/FetchingRemoteData: add support for handling PHP 8.1 firs…
jrfnl Jul 20, 2025
01eff5c
Performance/FetchingRemoteData: bug fix - recognize use of __DIR__ as…
jrfnl Jul 21, 2025
11092fd
Performance/FetchingRemoteData: bug fix - examine all text string tok…
jrfnl Jul 21, 2025
7d23be5
Performance/FetchingRemoteData: bug fix - false negative for compound…
jrfnl Jul 21, 2025
dfe6a2c
Classes/RestrictedExtendClasses: improve the tests
jrfnl Jul 23, 2025
73f7080
Classes/RestrictedExtendClasses: efficiency fix
jrfnl Jul 23, 2025
cb553b0
Classes/RestrictedExtendClasses: minor tweak
jrfnl Jul 21, 2025
4f91688
Merge pull request #856 from Automattic/feature/classes-restrictedext…
GaryJones Jul 23, 2025
bef6b9a
Merge pull request #855 from Automattic/feature/performance-fetchingr…
GaryJones Jul 23, 2025
fd041e4
Merge pull request #854 from Automattic/feature/functions-striptags-s…
GaryJones Jul 23, 2025
a8b3078
Composer: raise the minimum supported versions of all CS dependencies
jrfnl Jul 14, 2025
af4f80d
Performance/FetchingRemoteData: remove redundant method
jrfnl Jul 25, 2025
1753c9f
Merge pull request #857 from Automattic/feature/composer-update-minim…
GaryJones Jul 25, 2025
5ed8cb3
Classes/DeclarationCompatibility: bug fix - incorrect method name
jrfnl Jul 24, 2025
e9ac45f
Classes/DeclarationCompatibility: improve the tests
jrfnl Jul 24, 2025
d029cf3
Classes/DeclarationCompatibility: don't listen outside classes
jrfnl Jul 24, 2025
8e6ac38
Classes/DeclarationCompatibility: normalize method signature
jrfnl Jul 24, 2025
5e2b887
Classes/DeclarationCompatibility: remove redundant property
jrfnl Jul 24, 2025
f4daea0
Classes/DeclarationCompatibility: code simplification [1] / deprecate…
jrfnl Jul 24, 2025
b6863bc
Classes/DeclarationCompatibility: code simplification [2] / deprecate…
jrfnl Jul 24, 2025
a4a1b8a
Classes/DeclarationCompatibility: rename some parameters
jrfnl Jul 24, 2025
5fc17c6
Classes/DeclarationCompatibility: remove duplicate calls to `count()`
jrfnl Jul 24, 2025
957c442
Classes/DeclarationCompatibility: bug fix - reference mismatch not re…
jrfnl Jul 24, 2025
735558f
Classes/DeclarationCompatibility: bug fix - false positives for valid…
jrfnl Jul 24, 2025
d960ea4
Classes/DeclarationCompatibility: bug fix - properly handle PHP 5.6+ …
jrfnl Jul 24, 2025
08a7195
Classes/DeclarationCompatibility: minor code consistency tweak
jrfnl Jul 24, 2025
54a1580
Classes/DeclarationCompatibility: bug fix - false negatives for error…
jrfnl Jul 24, 2025
931ec20
Classes/DeclarationCompatibility: bug fix - class and function names …
jrfnl Jul 24, 2025
724d67c
Classes/DeclarationCompatibility: move some variable declarations
jrfnl Jul 24, 2025
5b168fe
Classes/DeclarationCompatibility: bug fix - recognize extended class …
jrfnl Jul 24, 2025
e654379
Classes/DeclarationCompatibility: bug fix - false positives for neste…
jrfnl Jul 25, 2025
d9e13cc
Classes/DeclarationCompatibility: add support for PHP 7.0+ anonymous …
jrfnl Jul 25, 2025
a900e2f
Classes/DeclarationCompatibility: minor code stability tweaks
jrfnl Jul 25, 2025
632d810
Classes/DeclarationCompatibility: minor documentation improvements
jrfnl Jul 25, 2025
40b0dac
Ruleset: improve include/exclude patterns
jrfnl Jul 26, 2025
2338970
Security/EscapingVoidReturnFunctions: extend AbstractFunctionParamete…
jrfnl Jul 26, 2025
b01a801
Security/EscapingVoidReturnFunctions: document support for `$customPr…
jrfnl Jul 26, 2025
0193bee
Security/EscapingVoidReturnFunctions: bug fix - false negative with f…
jrfnl Jul 26, 2025
8bf925f
Security/EscapingVoidReturnFunctions: bug fix - false negative for `t…
jrfnl Jul 26, 2025
ab01e6f
Security/EscapingVoidReturnFunctions: bug fix - false positive for pr…
jrfnl Jul 26, 2025
e17d08b
Security/EscapingVoidReturnFunctions: add support for PHP 8.0+ named …
jrfnl Jul 26, 2025
b9f3242
Functions/DynamicCalls: move parse error test to own file
jrfnl Jul 27, 2025
0f6f71b
Functions/DynamicCalls: add extra test
jrfnl Jul 27, 2025
3a3da1a
Functions/DynamicCalls: remove unnecessary property
jrfnl Jul 27, 2025
3e73a96
Functions/DynamicCalls: minor tweak
jrfnl Jul 27, 2025
14e1be4
Functions/DynamicCalls: bug fix - better end of statement determination
jrfnl Jul 27, 2025
ce82266
Functions/RestrictedFunctions::is_targetted_token(): improve the method
jrfnl Jul 27, 2025
d01c0bc
Merge pull request #858 from Automattic/feature/classes-declarationco…
GaryJones Jul 28, 2025
b6ba453
Merge pull request #860 from Automattic/feature/ruleset-fix-in-exclud…
GaryJones Jul 28, 2025
31f6da9
Merge pull request #861 from Automattic/feature/security-escapingvoid…
GaryJones Jul 28, 2025
1438761
Merge pull request #862 from Automattic/feature/functions-dynamic-cal…
GaryJones Jul 28, 2025
e9d9698
Merge pull request #863 from Automattic/feature/functions-restrictedf…
GaryJones Jul 28, 2025
a9daba1
Remove unused `WordPressVIPMinimum.Security.Twig` sniff
jrfnl Jul 28, 2025
b76edcc
Hard-deprecate the WordPressVIPMinimum.Functions.DynamicCalls sniff
jrfnl Jul 28, 2025
e83cd1b
Merge pull request #864 from Automattic/feature/859-remove-twig-sniff
GaryJones Jul 28, 2025
3bc61bd
Merge pull request #865 from Automattic/feature/517-deprecate-functio…
GaryJones Jul 28, 2025
fe71096
UserExperience/AdminBarRemoval: add additional tests
jrfnl Jul 29, 2025
d2bfefd
UserExperience/AdminBarRemoval: bug fix - disregard comments in param…
jrfnl Jul 20, 2025
dda5e87
UserExperience/AdminBarRemoval: add support for handling PHP 8.0+ fun…
jrfnl Jul 21, 2025
2520ce5
UserExperience/AdminBarRemoval: bug fix - recognize `add_action()` as…
jrfnl Jul 29, 2025
ba6bce6
UserExperience/AdminBarRemoval: add support for recognizing PHP 8.1+ …
jrfnl Jul 29, 2025
25ce9df
UserExperience/AdminBarRemoval: bug fix - function names are case-ins…
jrfnl Jul 29, 2025
52c0e14
UserExperience/AdminBarRemoval: remove some redundant logic
jrfnl Jul 21, 2025
b42d405
UserExperience/AdminBarRemoval: bug fix - CSS file might be handled a…
jrfnl Jul 15, 2025
cd88a8b
UserExperience/AdminBarRemoval: minor simplification
jrfnl Jul 15, 2025
aef212e
Performance/CacheValueOverride: rename test case file
jrfnl Jul 30, 2025
4a88562
Performance/CacheValueOverride: extend AbstractFunctionRestrictionsSniff
jrfnl Jul 29, 2025
0cb596e
Performance/CacheValueOverride: bug fix - false negative with fully q…
jrfnl Jul 29, 2025
c7acb30
Performance/CacheValueOverride: bug fix - false positive for PHP 8.1+…
jrfnl Jul 30, 2025
336f566
Performance/CacheValueOverride: bug fix - false positives for variabl…
jrfnl Jul 30, 2025
3202749
Performance/CacheValueOverride: add some more defensive coding
jrfnl Jul 30, 2025
75113e0
Security/Underscorejs: start using the PHPCSUtils `FilePath` utility
jrfnl Jun 6, 2024
d5e5c27
Constants/RestrictedConstants: minor efficiency fix
jrfnl Jul 23, 2025
43e02ff
Constants/RestrictedConstants: fix nonsensical comparison
jrfnl Jul 20, 2025
169a74e
Constants/RestrictedConstants: use PHPCSUtils `TextStrings::stripQuot…
jrfnl Jul 23, 2025
57cf78e
CS: various minor fixes
jrfnl Jul 16, 2025
5fca17d
Docs: various minor fixes
jrfnl Jul 16, 2025
16c798e
Performance/TaxonomyMetaInOptions: extend AbstractFunctionParameterSniff
jrfnl Jul 30, 2025
1f24aad
Performance/TaxonomyMetaInOptions: add support for handling PHP 8.0+ …
jrfnl Jul 30, 2025
ae8557a
Performance/TaxonomyMetaInOptions: add support for handling PHP 8.0+ …
jrfnl Jul 30, 2025
45bf583
Merge pull request #867 from Automattic/feature/performance-cachevalu…
GaryJones Jul 30, 2025
7f4c63d
Merge pull request #868 from Automattic/feature/security-underscorejs…
GaryJones Jul 30, 2025
eb9b206
Merge pull request #869 from Automattic/feature/constants-restrictedc…
GaryJones Jul 30, 2025
cb16f87
Merge pull request #870 from Automattic/feature/various-minor-cs-fixes
GaryJones Jul 30, 2025
70e5569
Merge pull request #871 from Automattic/WIP/feature/various-doc-fixes
GaryJones Jul 30, 2025
7b288b2
Merge pull request #872 from Automattic/feature/performance-taxonomym…
GaryJones Jul 30, 2025
d9eb263
Merge pull request #866 from Automattic/feature/userexperience-adminb…
GaryJones Jul 30, 2025
9f97da2
Update WPQueryParamsSniff.php
mujuonly Oct 6, 2025
54ff2f3
Merge pull request #875 from mujuonly/patch-1
GaryJones Oct 6, 2025
f7fdd19
GH Actions: Bump actions/checkout from 4 to 6
dependabot[bot] Nov 24, 2025
d14c4c5
Merge pull request #877 from Automattic/dependabot/github_actions/act…
GaryJones Nov 24, 2025
853dd1a
ci: update PHPCS dev branch from master to 3.x
GaryJones Mar 22, 2026
dbe0fc0
ci: bump minimum PHP version from 5.4 to 7.4
GaryJones Mar 22, 2026
fdd5a4c
ci: drop PHPUnit 8 support
GaryJones Mar 22, 2026
96781d6
Merge pull request #880 from Automattic/GaryJones/fix-ci-879
GaryJones Mar 22, 2026
840d1a8
GH Actions: Bump ramsey/composer-install from 3 to 4
dependabot[bot] Mar 22, 2026
b19c94b
Merge pull request #879 from Automattic/dependabot/github_actions/ram…
GaryJones Mar 22, 2026
74ba5b6
fix: resolve bugs and adopt PHPCSUtils in AlwaysReturnInFilterSniff
GaryJones Mar 22, 2026
208c4c4
Merge pull request #881 from Automattic/GaryJones/fix-always-return
GaryJones Mar 22, 2026
67c8068
feat: flag posts_per_page/numberposts set to -1
GaryJones Mar 22, 2026
af54d9b
Merge pull request #882 from Automattic/GaryJones/nopaging-review
GaryJones Mar 22, 2026
0f4de98
feat: warn on exit/die/throw in filter callbacks
GaryJones Mar 22, 2026
3513402
Merge pull request #883 from Automattic/GaryJones/exit-die-throw-in-f…
GaryJones Mar 22, 2026
3950f81
chore: pin third-party GitHub Actions to commit SHAs
mahangu Jun 4, 2026
5bdc5a1
Merge pull request #884 from Automattic/chore/devprod-1072-pin-action…
GaryJones Jun 4, 2026
d203601
GH Actions: Bump shivammathur/setup-php from 2.37.1 to 2.37.2
dependabot[bot] Jun 15, 2026
1204a42
Merge pull request #885 from Automattic/dependabot/github_actions/shi…
GaryJones Jun 15, 2026
b3c1f8b
ci: pin composer-install to 4.0.0 and checkout to 6.0.3
GaryJones Jun 15, 2026
ca79ef8
Merge pull request #887 from Automattic/GaryJones/vipcs-pin-action-ve…
GaryJones Jun 15, 2026
bba2ad7
GH Actions: Bump actions/checkout from 6.0.3 to 7.0.0
dependabot[bot] Jun 22, 2026
007419f
GH Actions: Bump phpcsstandards/xmllint-validate from 1.0.1 to 2.0.0
dependabot[bot] Jun 22, 2026
1bd8b03
Merge pull request #889 from Automattic/dependabot/github_actions/php…
GaryJones Jun 26, 2026
7e8d226
Merge pull request #888 from Automattic/dependabot/github_actions/act…
GaryJones Jun 26, 2026
ad57653
Refactor tests and test runner, add BOM sniff, add bom specific rules…
mchanDev Jul 7, 2026
06c8983
test: preserve BOM in ruleset test fixtures via EditorConfig
GaryJones Jul 7, 2026
7592044
test: report discrepancies from both ruleset tests
GaryJones Jul 7, 2026
c4531d7
Merge pull request #890 from Automattic/add/BOM-sniff
GaryJones Jul 7, 2026
7b2e08d
GH Actions: Bump actions/checkout from 7.0.0 to 7.0.1
dependabot[bot] Jul 27, 2026
0152175
Merge pull request #891 from Automattic/dependabot/github_actions/act…
GaryJones Jul 27, 2026
c198d3e
build: raise minimum WordPressCS to 3.4.1
GaryJones Jul 27, 2026
0ecf92e
Merge pull request #892 from Automattic/GaryJones/update-wpcs-depende…
GaryJones Jul 27, 2026
e9b8992
docs: add changelog for 3.1.0 release
GaryJones Jul 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@

[*.md]
trim_trailing_whitespace = false

# Preserve the UTF-8 byte order mark in the BOM ruleset test fixtures, so that
# editors honouring EditorConfig do not silently strip it (which would
# invalidate the Generic.Files.ByteOrderMark ruleset test).
[*-bom.inc]
charset = utf-8-bom
16 changes: 10 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This package contains Composer scripts to quickly run the developer checks which

After `composer install`, you can do:

- `composer lint`: Lint PHP and XML files in against parse errors.
- `composer lint`: Lint PHP files against parse errors.
- `composer cs`: Check the code style and code quality of the codebase via PHPCS.
- `composer test`: Run the unit tests for the VIPCS sniffs.
- `composer test-coverage`: Run the unit tests for the VIPCS sniffs with coverage enabled.
Expand Down Expand Up @@ -91,6 +91,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class
### Pre-requisites
* VIP Coding Standards
* WordPress-Coding-Standards
* VariableAnalysis
* PHPCSUtils 1.x
* PHP_CodeSniffer 3.x
* PHPUnit 4.x - 9.x
Expand Down Expand Up @@ -144,15 +145,18 @@ The easiest way to do this is to add a `phpunit.xml` file to the root of your VI

Expected output:
```
PHPUnit 9.6.15 by Sebastian Bergmann and contributors.
Note: Tests are running in "CS" mode

........................................ 40 / 40 (100%)
PHPUnit 9.6.23 by Sebastian Bergmann and contributors.

45 sniff test files generated 175 unique error codes; 0 were fixable (0%)
Runtime: PHP 8.4.10
Configuration: phpunit.xml.dist

Time: 150 ms, Memory: 20.00 MB
....................................... 39 / 39 (100%)

OK (40 tests, 0 assertions)
52 sniff test files generated 172 unique error codes; 0 were fixable (0%)

Time: 00:00.862, Memory: 58.00 MB
```

### Unit Testing conventions
Expand Down
64 changes: 39 additions & 25 deletions .github/workflows/basics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,65 @@ jobs:
name: 'Basic CS and QA checks'
runs-on: ubuntu-latest

env:
XMLLINT_INDENT: ' ' # This is a tab character.

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1

- name: Install PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: 'latest'
coverage: none
tools: cs2pr

# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
# This should not be blocking for this job, so ignore any errors from this step.
# Ref: https://github.com/dotnet/core/issues/4167
- name: Update the available packages list
continue-on-error: true
run: sudo apt-get update

- name: Install xmllint
run: sudo apt-get install --no-install-recommends -y libxml2-utils

# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- name: Enable showing XML issues inline
uses: korelstar/xmllint-problem-matcher@v1

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict

- name: 'Composer: adjust dependencies'
# Using PHPCS `master` as an early detection system for bugs upstream.
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"dev-master" --no-interaction
# Using PHPCS `3.x` as an early detection system for bugs upstream.
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"3.x-dev" --no-interaction

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: 'Validate XML against schema and check code style'
run: ./bin/xml-lint
# Validate the XML file.
- name: Validate rulesets against schema
uses: phpcsstandards/xmllint-validate@5189514594c8d5f4cf21b7e5af50f54d697973d7 # v2.0.0
with:
pattern: "./*/ruleset.xml"
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"

# Check the code-style consistency of the XML file.
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner in the previous step.
- name: Check XML code style
run: |
diff -B --tabsize=4 ./WordPressVIPMinimum/ruleset.xml <(xmllint --format "./WordPressVIPMinimum/ruleset.xml")
diff -B --tabsize=4 ./WordPress-VIP-Go/ruleset.xml <(xmllint --format "./WordPress-VIP-Go/ruleset.xml")

# Validate dev tool related XML files.
- name: Validate Project PHPCS ruleset against schema
uses: phpcsstandards/xmllint-validate@5189514594c8d5f4cf21b7e5af50f54d697973d7 # v2.0.0
with:
pattern: ".phpcs.xml.dist"
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"

# Note: PHPUnit 9.3 introduced some new configuration options and deprecated the old versions of those.
# For cross-version compatibility, the validation is done against the PHPUnit 9.2 schema.
- name: "Validate PHPUnit config for use with PHPUnit 9"
uses: phpcsstandards/xmllint-validate@5189514594c8d5f4cf21b7e5af50f54d697973d7 # v2.0.0
with:
pattern: "phpunit.xml.dist"
xsd-file: "vendor/phpunit/phpunit/schema/9.2.xsd"

# Check the code-style consistency of the PHP files.
- name: Check PHP code style
Expand All @@ -90,10 +104,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1

- name: Install PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: 'latest'
coverage: none
Expand All @@ -103,7 +117,7 @@ jobs:
# Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
strategy:
matrix:
include:
- php: '5.4'
- php: '7.4'
dependencies: 'stable'
- php: '5.4'
- php: '7.4'
dependencies: 'lowest'

- php: 'latest'
Expand All @@ -40,21 +40,25 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1

- name: Set up PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
# With stable PHPCS dependencies, allow for PHP deprecation notices.
# Unit tests shouldn't fail on those for stable releases where those issues won't get fixed anymore.
ini-values: error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On
coverage: none

- name: Enable creation of `composer.lock` file
if: ${{ matrix.dependencies == 'lowest' }}
run: composer config --unset lock

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
Expand Down
43 changes: 20 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ jobs:

strategy:
matrix:
php: ['5.4', 'latest', '8.4']
php: ['7.4', 'latest', '8.5']

name: "Lint: PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.php == '8.4' }}
continue-on-error: ${{ matrix.php == '8.5' }}

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1

- name: Install PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr

- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
Expand All @@ -64,50 +64,43 @@ jobs:
# - php: The PHP versions to test against.
# - dependencies: The PHPCS dependencies versions to test against.
# IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version.
# - PHPCS will run without errors on PHP 5.4 - 7.4 on any supported version.
# - PHP 8.0 needs PHPCS 3.5.7+ to run without errors, and we require a higher minimum version.
# - PHP 8.1 needs PHPCS 3.6.1+ to run without errors, but works best with 3.7.1+, and we require at least this minimum version.
# - PHP 8.2 and 8.3 need PHPCS 3.8.0+ to run without errors (though the errors don't affect the tests).
# - PHP 8.2, 8.3 and 8.4 need PHPCS 3.8.0+ to run without errors (though the errors don't affect the tests).
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
dependencies: ['lowest', 'stable']

include:
# Test against dev versions of all dependencies with select PHP versions for early detection of issues.
- php: '5.4'
dependencies: 'dev'
- php: '7.0'
dependencies: 'dev'
- php: '7.4'
dependencies: 'dev'
- php: '8.3'
- php: '8.4'
dependencies: 'dev'

# Test against upcoming PHP version.
- php: '8.4'
- php: '8.5'
dependencies: 'dev'

name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}"

continue-on-error: ${{ matrix.php == '8.4' }}
continue-on-error: ${{ matrix.php == '8.5' }}

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1

# With stable PHPCS dependencies, allow for PHP deprecation notices.
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
- name: Setup ini config
id: set_ini
run: |
if [[ "${{ matrix.dependencies }}" != "dev" ]]; then
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
else
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
fi

- name: Install PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
Expand All @@ -117,16 +110,20 @@ jobs:
if: ${{ matrix.dependencies == 'dev' }}
run: >
composer require --no-update --no-scripts --no-interaction
squizlabs/php_codesniffer:"dev-master"
squizlabs/php_codesniffer:"3.x-dev"
phpcsstandards/phpcsutils:"dev-develop"
phpcsstandards/phpcsextra:"dev-develop"
sirbrillig/phpcs-variable-analysis:"2.x"
wp-coding-standards/wpcs:"dev-develop"

- name: Enable creation of `composer.lock` file
if: ${{ matrix.dependencies == 'lowest' }}
run: composer config --unset lock

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ phpunit.xml
phpcs.cache
phpstan.neon
.phpunit.result.cache
ruleset-tests-report.json
40 changes: 26 additions & 14 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="VIP Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="VIP Coding Standards" xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd">
<description>The custom ruleset for the VIP Coding Standards itself.</description>

<file>.</file>
Expand All @@ -21,6 +21,7 @@
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
<exclude name="WordPress.PHP.YodaConditions"/>
<exclude name="Generic.Functions.CallTimePassByReference"/>
</rule>

<rule ref="WordPress-Docs"/>
Expand All @@ -43,21 +44,32 @@
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>

<!-- Check code for cross-version PHP compatibility. -->
<config name="testVersion" value="5.4-"/>
<config name="testVersion" value="7.4-"/>
<rule ref="PHPCompatibility">
<!-- Exclude PHP constants back-filled by PHPCS. -->
<exclude name="PHPCompatibility.PHP.NewConstants.t_finallyFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_yieldFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_ellipsisFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_powFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_pow_equalFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_spaceshipFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_coalesceFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_coalesce_equalFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.t_yield_fromFound"/>

<!-- Unclear how, but appears to be back-filled anyhow, could be that PHP did so before the token was in use. -->
<exclude name="PHPCompatibility.PHP.NewConstants.t_traitFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_finallyFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_yieldFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_ellipsisFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_powFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_pow_equalFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_spaceshipFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesceFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesce_equalFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_yield_fromFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_bad_characterFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_fnFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_attributeFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_matchFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_nullsafe_object_operatorFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_name_fully_qualifiedFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_name_qualifiedFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_name_relativeFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_readonlyFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_enumFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_public_setFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_protected_setFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_private_setFound"/>
<exclude name="PHPCompatibility.Constants.RemovedConstants.t_bad_characterFound"/>
</rule>

</ruleset>
Loading