chore(deps): update dependency wp-coding-standards/wpcs to v3 [security] - #616
Closed
renovate[bot] wants to merge 1 commit into
Closed
chore(deps): update dependency wp-coding-standards/wpcs to v3 [security]#616renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Contributor
Author
|
Owner
|
Closing leftover Renovate PR after switching this repo to dependencyDashboardApproval. Updates will stay on the dashboard until explicitly created. |
mirucon
deleted the
renovate/packagist-wp-coding-standards-wpcs-vulnerability
branch
August 15, 2026 10:22
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.3.0→3.4.1WordPress Coding Standards (WordPressCS) contains an arbitrary code execution vulnerability
CVE-2026-45293 / GHSA-3pwp-g2mj-5p3v
More information
Details
Impact
WordPress Coding Standards (WordPressCS) versions before 3.4.1 contain an arbitrary code execution vulnerability in the
WordPress.WP.EnqueuedResourceParameterssniff. As a result, running PHPCS with WordPressCS over untrusted PHP code, for example, in a CI pipeline that lints pull requests, or on a developer machine reviewing third-party code, could lead to arbitrary command execution on the scanning host.This affects users of the
WordPressandWordPress-Extrarulesets. TheWordPress-Coreruleset and theWordPress-Docsruleset are not affected.The vulnerability happens when the sniff checks whether the
$varargument passed to functions such aswp_enqueue_script()orwp_register_script()evaluates to a falsy value. The sniff'sis_falsy()method reconstructed the argument and ran it througheval(). Because of this, a maliciously crafted$verargument such as'system'('id')would be executed during the scan.Patches
This issue has been fixed in WordPressCS 3.4.1. We recommend all users upgrade to 3.4.1 or later.
Workaround
Users of the
WordPressandWordPress-Extrarulesets, who cannot upgrade immediately, can disable the affected sniff by adding an<exclude>tag to their custom ruleset (the<rule>refvalue might vary depending on the ruleset):To verify that the sniff has been disabled, run PHPCS with the
-eflag, which lists all the sniffs a standard will run.WordPress.WP.EnqueuedResourceParametersshould no longer appear in the output under theWordPresssection:Credits
Many thanks to @FORIMOC for responsibly disclosing this vulnerability.
How can I report a security bug?
Please report security vulnerabilities privately via the "Security and quality" tab on the WPCS repository.
Severity
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
WordPress/WordPress-Coding-Standards (wp-coding-standards/wpcs)
v3.4.1Compare Source
This is a security release and all users are advised to update their WordPressCS install as soon as possible.
Changed
PHPCSUtilsversion to 1.2.3 (was 1.2.2). #2770PHPCSExtraversion to 1.5.1 (was 1.5.0). #2770Fixed
WordPress.WP.EnqueuedResourceParameterssniff over untrusted PHP code, for example, in a CI pipeline that lints pull requests, or on a developer machine reviewing third-party code, could lead to arbitrary command execution on the scanning host. #2771This affects users of the
WordPressandWordPress-Extrarulesets. TheWordPress-Coreruleset and theWordPress-Docsruleset are not affected.For more details, see the security advisory.
Thanks to [@FORIMOC] for responsibly disclosing the vulnerability.
v3.4.0Compare Source
We're happy to welcome [@rodrigoprimo] as co-maintainer of WordPressCS as of this release.
Added
WordPress.Arrays.ArrayDeclarationSpacing: newallow_single_item_single_line_explicit_key_arraysproperty to replace the, now deprecated,allow_single_item_single_line_associative_arraysproperty. #2696WordPress.Arrays.ArrayDeclarationSpacing(props [@RafaelFunchal], [@mattgaldino] and [@rodrigoprimo], #2489, #2593, #2682),WordPress.CodeAnalysis.AssignmentInTernaryCondition(props [@Nic-Sevic] and [@rodrigoprimo], #2488, #2678),WordPress.DB.RestrictedClasses(props [@paulgibbs] and [@rodrigoprimo], #2455, #2689),WordPress.DB.DirectDatabaseQuery(props [@jaymcp] and [@rodrigoprimo], #2458, #2697),WordPress.DB.RestrictedFunctions(props [@paulgibbs] and [@rodrigoprimo], #2453, #2676),WordPress.DB.SlowDBQuery(props [@petitphp] and [@rodrigoprimo], #2464, #2699),WordPress.PHP.DevelopmentFunctions(props [@gogdzl] and [@rodrigoprimo], #2490, #2690),WordPress.PHP.NoSilencedErrors(props [@gogdzl] and [@rodrigoprimo], #2495, #2694),WordPress.PHP.PregQuoteDelimiter(props [@tikifez] and [@rodrigoprimo], #2487, #2677),WordPress.PHP.RestrictedPHPFunctions(props [@gogdzl] and [@rodrigoprimo], #2491, #2693),WordPress.Security.PluginMenuSlug(props [@jasonkenison], #2592),WordPress.WP.AlternativeFunctions(props [@pamprn09], [@bhubbard] and [@rodrigoprimo], #2496, #2588, #2687),WordPress.WP.DiscouragedConstants(props [@RafaelFunchal], [@paulopmt1] and [@rodrigoprimo], #2493, #2589, #2680),WordPress.WP.GlobalVariablesOverride(props [@paulopmt1] and [@rodrigoprimo], #2586, #2679).This documentation can be exposed via the
PHP_CodeSniffer--generator=...command-line argument.Changed
PHP_CodeSnifferversion to 3.13.5 (was 3.13.4). #2761PHPCSUtilsversion to 1.2.2 (was 1.1.0). #2761minimum_wp_version, as used by a number of sniffs detecting usage of deprecated WP features, has been updated to6.7. #2757WordPress.NamingConventions.PrefixAllGlobalshas been updated to recognize pluggable functions introduced in WP up to WP 7.0.0. #2747WordPress.WP.ClassNameCasehas been updated to recognize classes introduced in WP up to WP 7.0.0. #2747WordPress.WP.DeprecatedFunctionsnow detects functions deprecated in WordPress up to WP 7.0.0. #2747ConstantsHelper::is_use_of_global_constant()method will no longer flag a constant alias created via an importusestatement as it were the use of a global constant. #2579ConstantsHelper::is_in_function_call()method will now act fully case-agnostic for the function names being checked. #2706Previously, the
$valid_functionsparameter would need to be passed with the function names as keys in lowercase.WordPress.PHP.NoSilencedErrors: error silencing is no longer accepted for theparse_url()function. #2701WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound. #2688WordPress.PHP.RestrictedPHPFunctions. #2702Deprecated
WordPress.Arrays.ArrayDeclarationSpacing: theallow_single_item_single_line_associative_arraysproperty has been deprecated in favor of the newallow_single_item_single_line_explicit_key_arraysproperty. #2696This is a name change only. The functionality of these properties is the same.
Fixed
WordPress.DB.PreparedSQLandWordPress.DB.PreparedSQLPlaceholders: false positive for static method calls to a non-global class namedwpdb. #2753WordPress.Security.EscapeOutput: false positive forget_search_query()when the$escapedparameter was passed as fully qualified or non-lowercasetrue. #2618WordPress.Security.EscapeOutput: false negative for_deprecated_file()calls when thebasename( __FILE__ )pattern used non-standard casing for eitherbasename()and/or__FILE__. #2729WordPress.WP.AlternativeFunctions: false negative when class functions/constants/properties use the same name as select global WP constants/functions. #2617WordPress.WP.AlternativeFunctions: false positive for fully qualified references to the global PHP stream constants \STDIN, \STDOUT, and \STDERR. #2617WordPress.WP.CronInterval: false positive when the callback function reference used a different case than the function declaration, even though they are in the same file. #2730v3.3.0Compare Source
Added
readonlyanonymous classes (PHP 8.3) to theWordPress.Security.EscapeOutputsniff. Props [@rodrigoprimo]. #2559WordPress.Security.EscapeOutputsniff. #2563Universal.Attributes.BracketSpacingandUniversal.Attributes.DisallowAttributeParentheses. #2646Changed
PHP_CodeSnifferversion to 3.13.4 (was 3.13.0). #2630PHPCSExtraversion to 1.5.0 (was 1.4.0). #2646minimum_wp_version, as used by a number of sniffs detecting usage of deprecated WP features, has been updated to6.6. #2656WordPress.DB.DirectDatabaseQuerywill now recognize more caching functions, like thewp_cache_*_multiple()functions as added in WordPress 6.0 and thewp_cache_*_salted()functions as added in WordPress 6.9. #2654WordPress.NamingConventions.PrefixAllGlobalshas been updated to recognize pluggable functions introduced in WP up to WP 6.9.0. #2652WordPress.WP.ClassNameCasehas been updated to recognize classes introduced in WP up to WP 6.9.0. #2652WordPress.WP.DeprecatedFunctionsnow detects functions deprecated in WordPress up to WP 6.9.0. #2652WordPress.WP.DeprecatedParametersnow detects parameters deprecated in WordPress up to WP 6.9.0. #2652WordPress.Security.ValidatedSanitizedInput: improved the clarity of the error message for theInputNotValidatederror code. Props [@rodrigoprimo]. #2642testVersionrecommendations for PHPCompatibility. Props [@johnjago]. #2471minimum_wp_versionandtestVersionrecommendations. #2608Deprecated
Removed
wp_kses_allowed_html()from the list of escaping functions. #2566This affects the
WordPress.Security.EscapeOutputsniff.Fixed
WordPress.DB.DirectDatabaseQuery: false positive when function call to caching functions did not use the canonical function name. Props [@rodrigoprimo]. #2613WordPress.DB.DirectDatabaseQuery: potential false negative when a class property or constant would mirror the name of one of the caching functions. Props [@rodrigoprimo]. #2615WordPress.DB.PreparedSQL: false positive for correctly escaped SQL snippets when the function call did not use the canonical function name. Props [@rodrigoprimo]. #2570WordPress.DB.PreparedSQLPlaceholders: improved handling of fully qualified calls to global functions. Props [@rodrigoprimo]. #2569WordPress.Security.EscapeOutput: expanded protection against false positives for*::class. Props [@rodrigoprimo]. #2605WordPress.Security.NonceVerification: false positive when nonce checking function call did not use the canonical function name. Props [@rodrigoprimo]. #2572WordPress.WP.EnqueuedResourceParameters: the sniff could cause a PHP 8.5 deprecation notice if the code under scan contained one of the deprecated type casts. #2573WordPress.WP.EnqueuedResourceParameters: improved recognition of non-lowercase and fully qualifiedtrue/false/nullwhen passed as the$verparameter value. Props [@rodrigoprimo]. #2630v3.2.0Compare Source
Added
WordPress.WP.GetMetaSinglesniff to theWordPress-Extraruleset. Props [@rodrigoprimo]! #2465This sniff warns when
get_*_meta()andget_metadata*()functions are used with the$meta_key/$keyparam, but without the$singleparameter as this could lead to unexpected behavior due to the different return types.WordPress-Extra: the following additional sniffs have been added to the ruleset:Generic.Strings.UnnecessaryHeredocandGeneric.WhiteSpace.HereNowdocIdentifierSpacing. #2534rest_sanitize_boolean()functions to the list of known "sanitizing" functions. Props [@westonruter]. #2530WordPress.DB.PreparedSQL(props [@jaymcp], #2454),WordPress.NamingConventions.ValidFunctionName(props [@richardkorthuis] and [@rodrigoprimo], #2452, #2531),WordPress.NamingConventions.ValidVariableName(props [@richardkorthuis], #2457),WordPress.PHP.DontExtract(props [@aiolachiara], #2456).This documentation can be exposed via the
PHP_CodeSniffer--generator=...command-line argument.Changed
PHP_CodeSnifferversion to 3.13.0 (was 3.9.0). #2532PHPCSUtilsversion to 1.1.0 (was 1.0.10). #2532PHPCSExtraversion to 1.4.0 (was 1.2.1). #2532AbstractFunctionParameterSniffwill now call a dedicatedprocess_first_class_callable()method for PHP 8.1+ first class callables. Props [@rodrigoprimo], [@jrfnl]. #2518, #2544By default, the method won't do anything, but individual sniffs extending the
AbstractFunctionParameterSniffclass can choose to implement the method to handle first class callables.Previously, first class callables were treated as a function call without parameters and would trigger the
process_no_parameters()method.WordPress.NamingConventions.PrefixAllGlobalssniff has been changed from 3 to 4 characters. Props [@davidperezgar]. #2479minimum_wp_version, as used by a number of sniffs detecting usage of deprecated WP features, has been updated to6.5. #2553WordPress.NamingConventions.ValidVariableNamenow allows for PHP 8.4 properties in interfaces. #2532WordPress.NamingConventions.PrefixAllGlobalshas been updated to recognize pluggable functions introduced in WP up to WP 6.8.1. #2537WordPress.WP.Capabilitieshas been updated to recognize new capabilities introduced in WP up to WP 6.8.1. #2537WordPress.WP.ClassNameCasehas been updated to recognize classes introduced in WP up to WP 6.8.1. #2537WordPress.WP.DeprecatedFunctionsnow detects functions deprecated in WordPress up to WP 6.8.1. #2537WordPress.WP.DeprecatedParametersnow detects parameters deprecated in WordPress up to WP 6.8.1. #2537WordPress.WP.DeprecatedParameterValuesnow detects parameter values deprecated in WordPress up to WP 6.8.1. #2537composer.lockfile. Thanks [@fredden]! #2443Removed
Generic.Functions.CallTimePassByReferencehas been removed from theWordPress-Extraruleset. Props [@rodrigoprimo]. #2536This sniff was dated anyway and deprecated in PHP_CodeSniffer. If you need to check if your code is PHP cross-version compatible, use the [PHPCompatibility] standard instead.
Fixed
AbstractClassRestrictionsSniffcould previously run into a PHPCSInternal.Exception, leading to fixes not being made. #2500AbstractFunctionParameterSniffwill now bow out more often when it is sure the code under scan is not calling the target function and during live coding, preventing false positives. Props [@rodrigoprimo]. #2518v3.1.0Compare Source
Added
Universal.PHP.LowercasePHPTagsniff.Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedenceand theUniversal.CodeAnalysis.NoDoubleNegativesniffs.sanitize_locale_name()function to the list of known "escaping" functions. Props [@Chouby]sanitize_locale_name()function to the list of known "sanitize & unslash" functions. Props [@Chouby]Changed
PHP_CodeSnifferversion to 3.9.0 (was 3.7.2).PHPCSUtilsversion to 1.0.10 (was 1.0.8).PHPCSExtraversion to 1.2.1 (was 1.1.0).Please ensure you run
composer update wp-coding-standards/wpcs --with-dependenciesto benefit from these updates.usekeyword for closureusestatements will now consistently be checked. Props [@westonruter] for reporting.minimum_wp_version, as used by a number of sniffs detecting usage of deprecated WP features, has been updated to6.2.WordPress.NamingConventions.PrefixAllGlobalshas been updated to recognize pluggable functions introduced in WP 6.4 and 6.5.WordPress.NamingConventions.ValidPostTypeSlughas been updated to recognize reserved post types introduced in WP 6.4 and 6.5.WordPress.WP.ClassNameCasehas been updated to recognize classes introduced in WP 6.4 and 6.5.WordPress.WP.DeprecatedClassesnow detects classes deprecated in WordPress up to WP 6.5.WordPress.WP.DeprecatedFunctionsnow detects functions deprecated in WordPress up to WP 6.5.IsUnitTestTraitwill now recognize classes which extend the new WP CoreWP_Font_Face_UnitTestCaseclass as test classes.Fixed
WordPress.WP.PostsPerPagecould potentially result in anInternal.Exceptionwhen encountering a query string which doesn't include the value forposts_per_pagein the query string. Props [@anomiex] for reporting.v3.0.1Compare Source
Added
WordPress.Security.EscapeOutputsniff was updated to report unescaped message parameters passed to exceptions created inthrowstatements. This specific violation now has a separate error code:ExceptionNotEscaped. This will allow users to ignore or exclude that specific error code. Props [@anomiex].The error code(s) for other escaping issues flagged by the sniff remain unchanged.
Changed
Fixed
phpcs.xml.dist.samplefile (case-sensitive sniff name). Props [@dawidurbanski].v3.0.0Compare Source
Important information about this release:
At long last... WordPressCS 3.0.0 is here.
This is an important release which makes significant changes to improve the accuracy, performance, stability and maintainability of all sniffs, as well as making WordPressCS much better at handling modern PHP.
WordPressCS 3.0.0 contains breaking changes, both for people using ignore annotations, people maintaining custom rulesets, as well as for sniff developers who maintain a custom PHPCS standard based on WordPressCS.
If you are an end-user or maintain a custom WordPressCS based ruleset, please start by reading the Upgrade Guide to WordPressCS 3.0.0 for end-users which lists the most important changes and contains a step by step guide for upgrading.
If you are a maintainer of an external standard based on WordPressCS and any of your custom sniffs are based on or extend WordPressCS sniffs, please read the Upgrade Guide to WordPressCS 3.0.0 for Developers.
In all cases, please read the complete changelog carefully before you upgrade.
Added
While support in external sniffs used by WordPressCS has not be exhaustively verified, a lot of work has been done to try and add support for new PHP syntaxes to those as well.
WordPressCS native sniffs and utilities have received fixes for the following syntaxes:
falseandnulltypes.$object::classWordPress.CodeAnalysis.AssignmentInTernaryConditionsniff to theWordPress-Coreruleset which partially replaces the removedWordPress.CodeAnalysis.AssignmentInConditionsniff.WordPress.WhiteSpace.ObjectOperatorSpacingsniff which replaces the use of theSquiz.WhiteSpace.ObjectOperatorSpacingsniff in theWordPress-Coreruleset.WordPress.WP.ClassNameCasesniff to theWordPress-Coreruleset, to check that any class name references to WP native classes and classes from external dependencies use the case of the class as per the class declaration.WordPress.WP.Capabilitiessniff to theWordPress-Extraruleset. This sniff checks that valid capabilities are used, not roles or user levels. Props, amongst others, to [@grappler] and [@khacoder].Custom capabilities can be added to the sniff via a
custom_capabilitiesruleset property.The sniff also supports the
minimum_wp_versionproperty to allow the sniff to accurately determine how the use of deprecated capabilities should be flagged.WordPress.WP.CapitalPDangitsniff contains a new check to verify the correct spelling ofWordPressin namespace names.WordPress.WP.I18nsniff contains a newEmptyTextDomainerror code for an empty text string being passed as the text domain, which overrules the default value of the parameter and renders a text untranslatable.WordPress.DB.PreparedSQLPlaceholderssniff has been expanded with additional checks for the correct use of the%iplaceholder, which was introduced in WP 6.2. Props [@craigfrancis].The sniff now also supports the
minimum_wp_versionruleset property to determine whether the%iplaceholder can be used.WordPress-Core: the following additional sniffs (or select error codes from these sniffs) have been added to the ruleset:Generic.CodeAnalysis.AssignmentInCondition,Generic.CodeAnalysis.EmptyPHPStatement(replaces the WordPressCS native sniff),Generic.VersionControl.GitMergeConflict,Generic.WhiteSpace.IncrementDecrementSpacing,Generic.WhiteSpace.LanguageConstructSpacing,Generic.WhiteSpace.SpreadOperatorSpacingAfter,PSR2.Classes.ClassDeclaration,PSR2.Methods.FunctionClosingBrace,PSR12.Classes.ClassInstantiation,PSR12.Files.FileHeader(select error codes only),PSR12.Functions.NullableTypeDeclaration,PSR12.Functions.ReturnTypeDeclaration,PSR12.Traits.UseDeclaration,Squiz.Functions.MultiLineFunctionDeclaration(replaces part of theWordPress.WhiteSpace.ControlStructureSpacingsniff),Modernize.FunctionCalls.Dirname,NormalizedArrays.Arrays.ArrayBraceSpacing(replaces part of theWordPress.Arrays.ArrayDeclarationSpacingsniff),NormalizedArrays.Arrays.CommaAfterLast(replaces the WordPressCS native sniff),Universal.Classes.ModifierKeywordOrder,Universal.Classes.RequireAnonClassParentheses,Universal.Constants.LowercaseClassResolutionKeyword,Universal.Constants.ModifierKeywordOrder,Universal.Constants.UppercaseMagicConstants,Universal.Namespaces.DisallowCurlyBraceSyntax,Universal.Namespaces.DisallowDeclarationWithoutName,Universal.Namespaces.OneDeclarationPerFile,Universal.NamingConventions.NoReservedKeywordParameterNames,Universal.Operators.DisallowShortTernary(replaces the WordPressCS native sniff),Universal.Operators.DisallowStandalonePostIncrementDecrement,Universal.Operators.StrictComparisons(replaces the WordPressCS native sniff),Universal.Operators.TypeSeparatorSpacing,Universal.UseStatements.DisallowMixedGroupUse,Universal.UseStatements.KeywordSpacing,Universal.UseStatements.LowercaseFunctionConst,Universal.UseStatements.NoLeadingBackslash,Universal.UseStatements.NoUselessAliases,Universal.WhiteSpace.CommaSpacing,Universal.WhiteSpace.DisallowInlineTabs(replaces the WordPressCS native sniff),Universal.WhiteSpace.PrecisionAlignment(replaces the WordPressCS native sniff),Universal.WhiteSpace.AnonClassKeywordSpacing.WordPress-Extra: the following additional sniffs have been added to the ruleset:Generic.CodeAnalysis.UnusedFunctionParameter,Universal.Arrays.DuplicateArrayKey,Universal.CodeAnalysis.ConstructorDestructorReturn,Universal.CodeAnalysis.ForeachUniqueAssignment,Universal.CodeAnalysis.NoEchoSprintf,Universal.CodeAnalysis.StaticInFinalClass,Universal.ControlStructures.DisallowLonelyIf,Universal.Files.SeparateFunctionsFromOO.WordPress.Utils.I18nTextDomainFixer: theload_script_textdomain()function to the functions the sniff looks for.WordPress.WP.AlternativeFunctions: the following PHP native functions have been added to the sniff and will now be flagged when used:unlink()(in a newunlinkgroup) ,rename()(in a newrenamegroup),chgrp(),chmod(),chown(),is_writable()is_writeable(),mkdir(),rmdir(),touch(),fputs()(in the existingfile_system_operationsgroup, which was previously namedfile_system_read). Props [@sandeshjangam] and [@JDGrimes].PHPUnit_Adapter_TestCaseclass to the list of "known test (case) classes".antispambot()function to the list of known "formatting" functions.esc_xml()andwp_kses_one_attr()functions to the list of known "escaping" functions.wp_timezone_choice()andwp_readonly()functions to the list of known "auto escaping" functions.sanitize_url()andwp_kses_one_attr()functions to the list of known "sanitizing" functions.WordPress.WhiteSpace.ControlStructureSpacingsniff. These can be displayed using--report=infowhen theblank_line_checkproperty has been set totrue.WordPress.DateTime.RestrictedFunctions,WordPress.NamingConventions.PrefixAllGlobals(props [@Ipstenu]),WordPress.PHP.StrictInArray(props [@marconmartins]),WordPress.PHP.YodaConditions(props [@Ipstenu]),WordPress.WhiteSpace.ControlStructureSpacing(props [@ckanitz]),WordPress.WhiteSpace.ObjectOperatorSpacing,WordPress.WhiteSpace.OperatorSpacing(props [@ckanitz]),WordPress.WP.CapitalPDangit(props [@NielsdeBlaauw]),WordPress.WP.Capabilities,WordPress.WP.ClassNameCase,WordPress.WP.EnqueueResourceParameters(props [@NielsdeBlaauw]).This documentation can be exposed via the
PHP_CodeSniffer--generator=...command-line argument.Note: all sniffs which have been added from PHPCSExtra (Universal, Modernize, NormalizedArrays sniffs) are also fully documented.
Added (internal/dev-only)
ArrayWalkingFunctionsHelperConstantsHelper*ContextHelper*DeprecationHelper*FormattingFunctionsHelperListHelper*RulesetPropertyHelper*SnakeCaseHelper*UnslashingFunctionsHelperValidationHelperVariableHelper*WPGlobalVariablesHelperWPHookHelperEscapingFunctionsTraitIsUnitTestTraitMinimumWPVersionTraitPrintingFunctionsTraitSanitizationHelperTrait*WPDBTraitThese classes and traits mostly contain pre-existing functionality moved from the
Sniffclass.The classes marked with an
*are considered internal and do not have any promise of future backward compatibility.More information is available in the Upgrade Guide to WordPressCS 3.0.0 for Developers.
Changed
Installing in a different manner (git clone/PEAR/PHAR) is still possible, but no longer supported.
PHP_CodeSnifferversion to 3.7.2 (was 3.3.1).filter,libxmlandXMLReaderextensions are now explicitly required.It is recommended to also have the
Mbstringandiconvextensions enabled for the most accurate results.mastertomain.WordPress-ExtratoWordPress-Core: theGeneric.Files.OneObjectStructurePerFile(also changed fromwarningtoerror),Generic.PHP.BacktickOperator,PEAR.Files.IncludingFile,PSR2.Classes.PropertyDeclaration,PSR2.Methods.MethodDeclaration,Squiz.Scope.MethodScope,Squiz.WhiteSpace.ScopeKeywordSpacingsniffs. Props, amongst others, to [@desrosj].WordPress-Core: TheGeneric.Arrays.DisallowShortArraySyntaxsniff has been replaced by theUniversal.Arrays.DisallowShortArraySyntaxsniff.The new sniff will recognize short lists correctly and ignore them.
WordPress-Core: TheGeneric.Files.EndFileNewlinesniff has been replaced by the more comprehensivePSR2.Files.EndFileNewlinesniff.This could be done in two different ways:
minimum_supported_versionproperty for each sniff from a ruleset.--runtime-set minimum_supported_wp_version #.#on the command line.The names of the property and the CLI setting have now been aligned to both use
minimum_wp_versionas the name.Both ways of passing the value are still supported.
WordPress.NamingConventions.PrefixAllGlobals: thecustom_test_class_whitelistproperty has been renamed tocustom_test_classes.WordPress.NamingConventions.ValidVariableName: thecustomPropertiesWhitelistproperty has been renamed toallowed_custom_properties.WordPress.PHP.NoSilencedErrors: thecustom_whitelistproperty has been renamed tocustomAllowedFunctionsList.WordPress.PHP.NoSilencedErrors: theuse_default_whitelistproperty has been renamed tousePHPFunctionsList.WordPress.WP.GlobalVariablesOverride: thecustom_test_class_whitelistproperty has been renamed tocustom_test_classes.custom_test_classes(previouslycustom_test_class_whitelist) ruleset property.minimum_supported_wp_version, as used by a number of sniffs detecting usage of deprecated WP features, has been updated to6.0.WordPress.NamingConventions.PrefixAllGlobalsnow takes new pluggable constants into account as introduced in WordPress up to WP 6.3.WordPress.NamingConventions.ValidPostTypeSlugnow takes new reserved post types into account as introduced in WordPress up to WP 6.3.WordPress.WP.DeprecatedClassesnow detects classes deprecated in WordPress up to WP 6.3.WordPress.WP.DeprecatedFunctionsnow detects functions deprecated in WordPress up to WP 6.3.WordPress.WP.DeprecatedParametersnow detects parameters deprecated in WordPress up to WP 6.3.WordPress.WP.DeprecatedParameterValuesnow detects parameter values deprecated in WordPress up to WP 6.3.WordPress.Utils.I18nTextDomainFixer: the lists of recognized plugin and theme header tags has been updated based on the current information in the plugin and theme handbooks.WordPress.WP.AlternativeFunctions: the "group" namefile_system_read, which can be used with theexcludeproperty, has been renamed tofile_system_operations.This also means that the error codes for individual functions flagged via that group have changed from
WordPress.WP.AlternativeFunctions.file_system_read_*toWordPress.WP.AlternativeFunctions.file_system_operations_*.WordPress.WP.CapitalPDangit: theMisspellederror code has been split into two error codes -MisspelledInTextandMisspelledInComment- to allow for more modular exclusions/selectively turning off the auto-fixer for the sniff.WordPress.WP.I18nno longer throws both theMissingSingularPlaceholderand theMismatchedPlaceholdersfor the same code, as the errors have an overlap.WordPress-Core: previously only the spacing around commas in arrays, function declarations and function calls was checked. Now, the spacing around commas will be checked in all contexts.WordPress.Arrays.ArrayKeySpacingRestrictions: a newSpacesBetweenBracketserror code has been introduced for the spacing between square brackets for array assignments without key. Previously, this would throw aNoSpacesAroundArrayKeyserror with an unclear error message.WordPress.Files.FileNamenow recognizes more word separators, meaning that files using other word separators than underscores will now be flagged for not using hyphenation.WordPress.Files.FileNamenow checks if a file contains a test class and if so, will bow out.This change was made to prevent issues with PHPUnit 9.1+, which strongly prefers PSR4-style file names.
Whether something is test class or not is based on a pre-defined list of "known" test case classes which can be extended and, optionally, a list of user provided test case classes provided via setting the
custom_test_classesproperty in a custom ruleset or the complete test directory can be excluded via a custom ruleset.WordPress.NamingConventions.PrefixAllGlobalsnow allows for pluggable functions and classes, which should not be prefixed when "plugged".WordPress.PHP.NoSilencedErrors: the metric, which displays in theinforeport, has been renamed from "whitelisted function call" to "silencing allowed function call".WordPress.Security.EscapeOutputnow flags the use ofget_search_query( false )when generating output (as thefalseturns off the escaping).WordPress.Security.EscapeOutputnow also examines parameters passed for exception creation inthrowstatements and expressions for correct escaping.WordPress.Security.ValidatedSanitizedInputnow examines all superglobal (except for$GLOBALS). Previously, the$_SESSIONand$_ENVsuperglobals would not be flagged as needing validation/sanitization.WordPress.WP.I18nnow recognizes the new PHP 8.0+handHtype specifiers.WordPress.WP.PostsPerPagehas improved recognition for numbers prefixed with a unary operator and non-decimal numbers.WordPress.DB.PreparedSQLwill identify more precisely the code which is problematic.WordPress.DB.PreparedSQLPlaceholderswill identify more precisely the code which is problematic.WordPress.DB.SlowDBQuerywill identify more precisely the code which is problematic.WordPress.Security.PluginMenuSlug: the error will now be thrown more precisely on the code which triggered the error. Depending on code layout, this may mean that an error will now be thrown on a different line.WordPress.WP.DiscouragedConstants: the error will now be thrown more precisely on the code which triggered the error. Depending on code layout, this may mean that an error will now be thrown on a different line.WordPress.WP.EnqueuedResourceParameters: the error will now be thrown more precisely on the code which triggered the error. Depending on code layout, this may mean that an error will now be thrown on a different line.WordPress.WP.I18n: the errors will now be thrown more precisely on the code which triggered the error. Depending on code layout, this may mean that an error will now be thrown on a different line.WordPress.WP.PostsPerPagewill identify more precisely the code which is problematic.WordPress.PHP.TypeCasts.UnsetFoundhas been changed from awarningto anerroras the(unset)cast is no longer available in PHP 8.0 and higher.WordPress.WP.EnqueuedResourceParameters.MissingVersionhas been changed from anerrorto awarning.WordPress.Arrays.ArrayKeySpacingRestrictions: improved the clarity of the error messages for theTooMuchSpaceBeforeKeyandTooMuchSpaceAfterKeyerror codes.WordPress.CodeAnalysis.EscapedNotTranslated: improved the clarity of the error message.WordPress.PHP.IniSet: improved the clarity of the error messages for the sniff.WordPress.PHP.PregQuoteDelimiter: improved the clarity of the error message for theMissingerror code.WordPress.PHP.RestrictedFunctions: improved the clarity of the error messages for the sniff.WordPress.PHP.RestrictedPHPFunctions: improved the error message for thecreate_function_create_functionerror code.WordPress.PHP.TypeCast: improved the clarity of the error message for theUnsetFounderror code. It will no longer advise assigningnull.WordPress.Security.SafeRedirect: improved the clarity of the error message. (very minor)WordPress.Security.ValidatedSanitizedInput: improved the clarity of the error messages for theMissingUnslasherror code.WordPress.WhiteSpace.CastStructureSpacing: improved the clarity of the error message for theNoSpaceBeforeOpenParenthesiserror code.WordPress.WP.I18n: improved the clarity of the error messages for the sniff.WordPress.WP.I18n: the error messages will now use the correct parameter name.WordPress.CodeAnalysis.EscapedNotTranslated,WordPress.NamingConventions.PrefixAllGlobals,WordPress.NamingConventions.ValidPostTypeSlug,WordPress.PHP.IniSet, and theWordPress.PHP.NoSilencedErrorssniff will now display the code sample found without comments and extranuous whitespace.Changed (internal/dev-only)
finalwith the exception of the following four classes which are known toConfiguration
📅 Schedule: (in timezone Asia/Tokyo)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.