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

[THEME-3651] Update the PHPCS rules #2

Merged
merged 1,138 commits into from
Apr 18, 2024
Merged

[THEME-3651] Update the PHPCS rules #2

merged 1,138 commits into from
Apr 18, 2024

Conversation

KamilBaczkowski
Copy link

  • WP.AlternativeFunctions: Order filesystem function list alphabetically
  • WP.AlternativeFunctions: Add more functions to filesystem functions list
  • Composer/Travis: change the minimum PHPCS version
  • Composer: add PHPCSUtils and PHPCSExtra as dependencies
  • Travis: simplify the script
  • Tests: add a bootstrap file
  • Remove deprecated Sniff::has_whitelist_comment() method and all references to it
  • Remove the WordPress.WP.TimezoneChange sniff
  • Replace the WordPress.CodeAnalysis.EmptyStatement sniff
  • Replace the WordPress.PHP.DisallowShortTernary sniff
  • Replace the WordPress.WhiteSpace.DisallowInlineTabs sniff
  • Tests/RestrictedClasses: compatibility with PHPCS 4.x
  • TypeCasts: remove sniffing for T_STRING_CAST
  • Tests: improve language used in inline comments
  • CONTRIBUTING: remove section about the WPCS native selective ignore comments
  • README: fix language of header referring to ignore comments
  • Replace the WordPress.PHP.StrictComparisons sniff
  • .gitattributes: minor update
  • PHPCSHelper: deprecate the class and all the methods in it
  • PHPCSHelper::get_version(): remove call to the function
  • PHPCSHelper::get_config_data(): switch over to the PHPCSUtils version
  • PHPCSHelper::get_tab_width(): switch over to the PHPCSUtils version
  • Remove the PHPCSHelper.php file
  • Core: replace Generic.Arrays.DisallowShortArraySyntax with Universal version
  • Extra: replace the Squiz.WhiteSpace.LanguageConstructSpacing sniff with the Generic one
  • Core ruleset: add PHPCSUtils requirement
  • Sniff: deprecate everything which has moved to PHPCSUtils
  • Sniff::strip_quotes(): switch over to the PHPCSUtils version
  • Sniff::strip_quotes(): remove the function
  • Sniff::get_use_type(): switch over to a PHPCSUtils alternative
  • Sniff::get_use_type(): remove the function
  • Sniff::does_function_call_have_parameters(): remove the function
  • Sniff::get_function_call_parameter_count(): switch over to the PHPCSUtils version
  • Sniff::get_function_call_parameter_count(): remove the function
  • Sniff::get_function_call_parameters(): switch over to the PHPCSUtils version
  • Sniff::get_function_call_parameters(): remove the function
  • Sniff::get_function_call_parameter(): switch over to the PHPCSUtils version
  • Sniff::get_function_call_parameter(): remove the function
  • Sniff::find_array_open_close(): switch over to the PHPCSUtils version
  • Sniff::find_array_open_close(): remove the function
  • Sniff::find_list_open_close(): switch over to the PHPCSUtils version
  • Sniff::find_list_open_close(): remove the function
  • Sniff::determine_namespace(): switch over to the PHPCSUtils version
  • Sniff::determine_namespace(): remove the function
  • Sniff::get_declared_namespace_name(): switch over to the PHPCSUtils version
  • Sniff::get_declared_namespace_name(): remove the function
  • Sniff::is_class_constant(): switch over to the PHPCSUtils version
  • Sniff::is_class_constant(): remove the function
  • Sniff::is_class_property(): switch over to the PHPCSUtils version
  • Sniff::is_class_property(): remove the function
  • Sniff::valid_direct_scope(): remove the function
  • Sniff::is_short_list(): switch over to a PHPCSUtils alternative
  • Sniff::is_short_list(): remove the function
  • PHPCS 4.x compatibility: allow for the JS/CSS tokenizer being dropped in PHPCS 4.x
  • Tests: move ruleset check file to tests directory
  • CastStructureSpacing: minor error message improvement
  • OperatorSpacing: defer to upstream for "instanceof"
  • ValidFunctionName: implement PHPCSUtils
  • ValidFunctionName: use PHPCSUtils isMagicFunctionName()
  • ValidFunctionName: use PHPCSUtils isMagicMethodName()
  • ValidFunctionName: decouple from the PEAR sniff
  • ValidFunctionName: (re)move some code duplication
  • ValidFunctionName: don't throw "DoubleUnderscore" error for triple underscore
  • ValidFunctionName: small efficiency fix
  • CI: use Parallel-Lint
  • CapitalPDangit: implement PHPCSUtils and other improvements
  • CapitalPDangit: check namespace names
  • CapitalPDangit: minor efficiency tweak
  • CapitalPDangit: minor code layout tweak
  • CapitalPDangit: fix misspelling of "misspelled"
  • PHP 8 | ControlStructureSpacing: bug fix - $data should be an array
  • EnqueuedResources: bug fix - handling of multi-line text strings
  • ArrayIndentation: bug fix - prevent fixer conflict
  • EscapeOutput: defensive coding
  • Travis: change from "trusty" to "xenial"
  • Move "minimum WP version" related utilities to dedicated MinimumWPVersionTrait
  • MinimumWPVersionTrait: use PHPCSUtils Helper::getCommandLineData()
  • MinimumWPVersionTrait: rename the get_wp_version_from_cl() method
  • MinimumWPVersionTrait: rename the local $cli_supported_version variable
  • EscapedNotTranslated: use PHPCSUtils GetTokensAsString
  • Adds documentation for the WordPress.WP.CapitalPDangit sniff.
  • WordPress.WP.CapitalPDangit: next iteration of the documentation
  • Travis: retry composer install on failure
  • Adds documentation for WordPress.WP.EnqueueResourceParameters. (Adds documentation for WordPress.WP.EnqueueResourceParameters. WordPress/WordPress-Coding-Standards#1825)
  • TypeCasts: change (unset) cast from warning to error
  • PHP/RestrictedPHPFunctions: update error message
  • Travis: add build against PHP 8.0
  • Move from TravisCI to GitHub Actions (Move from TravisCI to GitHub Actions WordPress/WordPress-Coding-Standards#1965)
  • 3.0: Move "is unit test" utility functions to dedicated trait (3.0: Move "is unit test" utility functions to dedicated trait WordPress/WordPress-Coding-Standards#1960)
  • Security/EscapeOutput: bug fix - allow for basename() being fully qualified
  • GH Actions: don't test against PHPCS 4.x (yet)
  • PHP 8.1 compatibility: fix deprecation notice [1]
  • PHP 8.1 compatibility: fix deprecation notice [2]
  • GH Actions: get the tests running on PHP 8.1 (nightly)
  • GH Actions: report CS violations in the PR
  • GH Actions: don't use cs2pr in quicktest
  • OneObjectStructurePerFile: move from Extra to Core
  • CS: get rid of "commented out code" warnings
  • QA: remove unnecessary assignment
  • QA: use fully qualified global constant references
  • QA: import all used classes
  • Bug report template: various improvements
  • GH Actions: turn display_errors on
  • PHP/NoSilencedErrors: add libxml_disable_entity_loader()
  • PHP/NoSilencedErrors: add imagecreatefromwebp
  • Composer: allow the PHPCS plugin
  • GH Actions: auto-cancel previous builds for same branch
  • GH Actions: use error_reporting=-1
  • GH Actions: update for the release of PHP 8.1
  • GH Actions: version update for ramsey/composer-install
  • Update the min support PHP version
  • WP/CronInterval: bug fix for parentheses
  • GH Actions: version update for various predefined actions
  • GH Actions/CS: fix build failure
  • Core: add the Generic.VersionControl.GitMergeConflict sniff
  • GH Actions: show deprecations when linting
  • Composer: update PHP Parallel Lint and Console Highlighter
  • Composer: up the minimum PHPCS version to 3.6.2
  • Move "interpolated variable" related utilities to dedicated TextStringHelper
  • IsUnitTestTrait: update test class list
  • Move "deprecation" related utilities to dedicated DeprecationHelper
  • PHP 8.0 | DeprecationHelper: allow for attributes between function declaration and docblock
  • Add Code of Conduct
  • Document YodaConditionals you must (Document YodaConditionals you must WordPress/WordPress-Coding-Standards#1724)
  • Docs/WordPress.WhiteSpace.OperatorSpacing (Docs/WordPress.WhiteSpace.OperatorSpacing WordPress/WordPress-Coding-Standards#1727)
  • Add PHP.StrictInArray XML documentation (Add PHP.StrictInArray XML documentation WordPress/WordPress-Coding-Standards#1740)
  • Add the documentation for WordPress.Arrays.CommaAfterArrayItem (Add the documentation for WordPress.Arrays.CommaAfterArrayItem WordPress/WordPress-Coding-Standards#1734)
  • Prefix Your Globals (Prefix Your Globals WordPress/WordPress-Coding-Standards#1726)
  • NamingConventions/ValidHookName: bug fix - ignore parameters passed to function calls
  • Docs: Add TimezoneChange XML doc (Docs: Add TimezoneChange XML doc WordPress/WordPress-Coding-Standards#1731)
  • Composer: up the minimum PHPCS version to 3.7.0
  • Helper classes: explicitly state there is no BC promise
  • Move "array access keys" related utilities to dedicated VariableHelper
  • VariableHelper::get_array_access_keys() use PHPCSUtils
  • Move "is comparison" related utility to dedicated VariableHelper
  • VariableHelper::is_comparison(): use PHPCSUtils
  • PHP 8.0 | VariableHelper::is_comparison(): add support for variables being compared in a match expression
  • DB/DirectDatabaseQuery: remove custom ignore annotation support
  • DB/DirectDatabaseQuery: minor improvement error message text
  • AbstractFunctionRestrictionsSniff: rename array key
  • PrefixAllGlobals: rename property [1]
  • PrefixAllGlobals: rename property [2]
  • PrefixAllGlobals: rename property [3]
  • PrefixAllGlobals: rename (private) method
  • ValidPostTypeSlug: rename constant
  • ValidVariableName: rename property [1]
  • ValidVariableName: rename property [2]
  • ValidVariableNameSniff: rename method
  • IniSet: rename property [1]
  • IniSet: rename property [2]
  • IniSet: rename local variable [1]
  • IniSet: rename local variable [2]
  • IniSet: rename error code
  • IniSet: update the documentation for two properties
  • NoSilencedErrors: rename property [1]
  • NoSilencedErrors: rename property [2]
  • NoSilencedErrors: rename property [3]
  • NoSilencedErrors: fix up comments
  • NoSilencedErrors: rename a metric
  • Various language usage updates in comments
  • Add link to "Running in GitHub Actions" doc page
  • Update README.md
  • Update README.md
  • WP/CronInterval: update inline annotations in test case file (WP/CronInterval: update inline annotations in test case file WordPress/WordPress-Coding-Standards#2074)
  • WP/CronInterval: bugfix for fully qualified time constants
  • Arrays/ArrayKeySpacingRestrictions: don't warn on parse error
  • Arrays/ArrayKeySpacingRestrictions: improve handling of brackets for array assignments without key
  • Arrays/ArrayKeySpacingRestrictions: tweak test order
  • Arrays/ArrayKeySpacingRestrictions: rename three local variables
  • Arrays/ArrayKeySpacingRestrictions: bug fix - require spaces around calculations and allow for + sign
  • Arrays/ArrayKeySpacingRestrictions: add tests with non-decimal integers
  • Arrays/ArrayKeySpacingRestrictions: minor simplifications
  • Arrays/ArrayKeySpacingRestrictions: implement the PHPCSUtils SpacesFixer
  • PHP 7.4 | Arrays/ArrayKeySpacingRestrictions: add tests with numeric literals with underscores
  • PHP 8.1 | Arrays/ArrayKeySpacingRestrictions: add tests with octal numeric literals
  • Reorganize core ruleset to match the reorganized chapters in the WPCS docs
  • Update the handbook links
  • Fix the indentation in the core ruleset
  • Update WordPress-Core/ruleset.xml
  • Update WordPress-Core/ruleset.xml
  • Update WordPress-Core/ruleset.xml
  • Update WordPress-Core/ruleset.xml
  • Update WordPress-Core/ruleset.xml
  • Apply suggestions from the PR and update the covers rule texts
  • Update composer.json keywords
  • Composer/GH Actions: start using PHPCSDevTools 1.2.0
  • Sniff XML docs: add schema to docs
  • GH Actions: fix use of deprecated set-output
  • GH Actions: harden the workflow against PHPCS ruleset errors
  • Composer: up the minimum PHPCS version to 3.7.1
  • EnqueuedResourcesSniff: use Collections method instead of property
  • CronInterval: add the parameter name to allow for named parameters
  • Sniff::addMessage(): switch over to the PHPCSUtils version
  • Sniff::string_to_errorcode(): switch over to the PHPCSUtils version
  • TextStringHelper: remove the strip_interpolated_variables() method
  • Sniff::is_foreach_as(): switch over to the PHPCSUtils version
  • WP/I18n: use PHPCSUtils for checking string embeds
  • DB/PreparedSQL: use PHPCSUtils for checking string embeds
  • DB/PreparedSQL: improve matching of $wpdb
  • DB/PreparedSQLPlaceholders: use PHPCSUtils for checking string embeds and improve $wpdb matching
  • Security/ValidatedSanitizedInput: use PHPCSUtils for checking string embeds
  • TextStringHelper: remove the class
  • ✨ New WordPress.WhiteSpace.ObjectOperatorSpacing sniff
  • WPCS-Extra: enable the Generic.CodeAnalysis.UnusedFunctionParameter sniff
  • Core: move rules related to include/require statements from Extra to Core
  • Core: add sniffs to check there is no blank line before a function close brace
  • Core: remove custom message for OneObjectStructurePerFile sniff
  • Core: add sniff to check spacing around spread operators
  • Core: move rules related to explicit property/method visibility from Extra to Core
  • Core: move rules related to property/method modifier order from Extra to Core
  • Core: move last modifier keyword sniff from Extra to Core
  • Core: move BacktickOperator sniff from Extra to Core
  • Core: only allow one property declaration per statement
  • Extra: fix typo in rule
  • GH Actions: bust the cache semi-regularly
  • Extra: fix (more) typos in rules
  • Removed file_get_contents() from the list as it is already checked in another group
  • Seprated WP counter function and removed updated the list of filesystem functions
  • Updated since of unlink function
  • Removed commented code
  • Fix the get_wp_version_from_cli method
  • Update the sniffs with the updated get_wp_version_from_cli method
  • ✨ New WordPress.WP.ClassNameCase sniff
  • Group all the checks in one place and add script descriptions
  • WP/ClassNameCase: minor documentation tweaks
  • WP/ClassNameCase: add support for examining classes in WP external dependencies
  • Add sniff that will check that capabilities are used correctly.
  • MinimumWPVersionTrait: rename minimum WP version property
  • WP/Capabilities: tests - prevent CLI value leaking
  • Update the minimum_wp_version to WP 5.8
  • WP/DeprecatedFunctions: temporarily exclude one test on PHP 8.2
  • CS: minor tweaks/don't allow warnings
  • PHPCS ruleset: remove redundant exclusion
  • PHPCS ruleset: divide the ruleset into "chapters"
  • PHPCS ruleset: add a few more exclusions
  • Sample ruleset: add a few more common directives
  • GH Actions: rename the basic QA workflow file
  • GH Actions: remove redundant documentation
  • GH Actions: move the name key down
  • GH Actions: order matrix range in logical order
  • GH Actions: use PHP latest
  • GH Actions/basic-qa: move a step up
  • GH Actions/test: remove unused step
  • GH Actions/test: no longer allow build failures against PHP 8.2
  • Remove outdated bin/pre-commit file
  • GH Actions: automate some label management
  • Core: add sniffs to check class/constant modifier keyword order
  • Replace the WordPress.WhiteSpace.PrecisionAlignment sniff
  • Core: add sniffs to check formatting of increment/decrement operators
  • CS: clean up codebase for new rules / pre-increment
  • GH Actions: tweak label management workflow
  • Core: add sniffs to check formatting for type declarations
  • Core: move rules related to object instantiations from Extra to Core
  • Remove the Classes/ClassInstantiation sniff
  • Core: add sniff to discourage using reserved keywords as param names
  • CS/QA: rename parameters matching reserved keywords
  • Core: add sniff to check magic constants are in uppercase
  • Core: ensure more keywords are lowercase
  • WP/DeprecatedParameters: add support for PHP 8.0+ named parameters
  • PHP/PregQuoteDelimiter: add support for PHP 8.0+ named parameters
  • Core: add sniff to enforce the use of DIR instead of dirname(FILE)
  • Core: add sniffs to check the formatting of ::class class resolution
  • PHP/StrictInArray: add support for PHP 8.0+ named parameters
  • GH Actions: minor simplification
  • GH Actions: update PHP versions in workflows
  • QA: ensure URLs mentioned use https
  • QA: update/fix a number of URLs
  • Add additional rules to the extra ruleset
  • Sniff::$formattingFunctions: add antispambot() to the list
  • WP/EnqueuedResourceParameters: change MissingVersion to a warning
  • Sniff: remove the $hookFunctions property
  • Move "hook" related utilities to dedicated WPHookHelper
  • WPHookHelper: add new get_hook_name_param() method
  • MinimumWPVersionTrait: add new wp_version_compare() method (bug fix)
  • Arrays/ArrayKeySpacingRestrictions: small bug fix
  • Arrays/CommaAfterArrayItem: minor tweaks
  • PHP/YodaConditions: implement PHPCSUtils
  • PHP/YodaConditions: minor tweaks
  • WhiteSpace/OperatorSpacing: add extra tests with PHP 8.0+ types
  • Updated unlink function description
  • Updated file_system_read to file_system_operations
  • Added rename in separate category
  • Added test cases for new functions
  • Files/FileName: remove some redundant code
  • Files/FileName: split the logic off into three methods
  • Files/FileName: implement PHPCSUtils
  • Files/FileName: minor efficiency tweak
  • Files/FileName: exclude test files altogether
  • Files/FileName: minor docs tweak
  • Sniff: move the has_nonce_check() method to the Security/NonceVerification Sniff
  • Sniff: move the $cache*Functions properties to the DB/DirectDatabaseQuery Sniff
  • Move "property handling" related utilities to dedicated RulesetPropertyHelper
  • Move "is WPDB method call" related utilities to dedicated WPDBTrait
  • WPDBTrait::is_wpdb_method_call(): use PHPCSUtils
  • WPDBTrait::is_wpdb_method_call(): improve code-style independence and support PHP 8.0+ nullsafe object operators
  • WPDBTrait::is_wpdb_method_call(): bug fix - check names case-insensitively
  • Update WordPress/Sniffs/WP/AlternativeFunctionsSniff.php
  • Update WordPress/Sniffs/WP/AlternativeFunctionsSniff.php
  • Update WordPress/Tests/WP/AlternativeFunctionsUnitTest.inc
  • DateTime/CurrentTimeTimestamp: add support for PHP 8.0+ named parameters
  • DateTime/CurrentTimeTimestamp: minor code simplification
  • PHP/IniSet: add support for PHP 8.0+ named parameters
  • PHP/IniSet: prevent some false positives
  • PHP/IniSet: minor code simplification
  • PHP/IniSet: minor message tweak for clarity
  • PHP/NoSilencedErrors: add extra test
  • PHP/NoSilencedErrors: implement PHPCSUtils methods
  • PHP/StrictInArray: prevent some false positives
  • Move "global variable" related utilities to dedicated WPGlobalVariablesHelper
  • Move "is assignment" related utility to dedicated VariableHelper
  • NamingConventions/ValidHookName: various minor code and comment tweaks
  • NamingConventions/ValidHookName::transform_complex_string(): simplify with PHPCSUtils
  • NamingConventions/ValidHookName: bug fix - disregard variable function calls
  • NamingConventions/ValidHookName: add support for PHP 8.0+ named parameters
  • NamingConventions/ValidPostTypeSlug: minor error message tweak
  • NamingConventions/ValidPostTypeSlug: minor code readability tweak
  • NamingConventions/ValidPostTypeSlug: add support for PHP 7.3+ flexible heredoc/nowdocs
  • NamingConventions/ValidPostTypeSlug: add support for PHP 8.0+ named parameters
  • NamingConventions/ValidPostTypeSlug: use "clean" info in error message
  • Security/PluginMenuSlug: add support for PHP 8.0+ named parameters
  • Security/PluginMenuSlug: minor test tweak
  • Security/PluginMenuSlug: improve error position precision
  • WP/AlternativeFunctions: order lists alphabetically
  • WP/AlternativeFunctions: add missing @since tags
  • WP/AlternativeFunctions: change property visibility
  • WP/AlternativeFunctions: remove stray blank lines at top of test file
  • WP/AlternativeFunctions: move parse_url related tests down
  • WP/AlternativeFunctions: bug fix - special casing for parse_url was not applied
  • WP/AlternativeFunctions: add support for PHP 8.0+ named parameters [1] / strip_tags()
  • WP/AlternativeFunctions: add support for PHP 8.0+ named parameters [2] / parse_url()
  • WP/AlternativeFunctions: add support for PHP 8.0+ named parameters [3] / file_get_contents()
  • WP/AlternativeFunctions: minor code readability improvements
  • WP/AlternativeFunctions: add support for PHP 8.0+ named parameters [4] / readfile/fopen/file_put_contents()
  • WP/AlternativeFunctions: prevent some false positives / file_get_contents()
  • WP/AlternativeFunctions: minor code tweak / readfile/fopen/file_put_contents()
  • WP/CapitalPDangit: use PHPCSUtils
  • WP/CapitalPDangit: prevent false positives for lists
  • WP/CapitalPDangit: always skip over array access keys
  • WP/CapitalPDangit: add tests covering PHP 8.1+ enums
  • WP/CapitalPDangit: add tests with namespaced names containing reserved keyword
  • WP/CapitalPDangit: add tests with PHP 7.3 flexible heredoc/nowdoc
  • WP/CronInterval: implement PHPCSUtils and other minor tweaks
  • WP/CronInterval: add some tests for edge cases
  • WP/CronInterval: bug fix / prevent parse errors in eval-ed code
  • WP/CronInterval: add support for PHP 7.4+ arrow function callbacks
  • WP/CronInterval: add support for PHP 7.4/8.1 numbers
  • WP/CronInterval: (properly) add support for PHP 8.0+ named parameters
  • WP/CronInterval: add support for PHP 8.1 first class callables
  • WP/DeprecatedParameters: verify against WP Core
  • WP/DeprecatedParameterValues: add support for PHP 8.0+ named parameters
  • WP/DeprecatedParameterValues: verify against WP Core
  • WP/DiscouragedConstants: allow for the PHP 8.0+ nullsafe object operator
  • WP/DiscouragedConstants: allow for PHP 8.1+ enums
  • WP/DiscouragedConstants: add support for PHP 8.0+ named parameters
  • WP/DiscouragedConstants: prevent some false positives
  • WP/DiscouragedConstants: improve error position precision
  • WP/DiscouragedConstants: add tests with trait and enum constants
  • WP/DiscouragedConstants: remove redundant code
  • WP/EnqueuedResources: add tests with PHP 7.3+ flexible heredoc/nowdocs
  • WP/EnqueuedResources: minor code performance tweak
  • WP/EnqueuedResources: minor message tweak for clarity
  • WP/EnqueuedResourceParameters: add support for PHP 8.0+ named parameters
  • WP/EnqueuedResourceParameters: prevent false positives
  • WP/EnqueuedResourceParameters: improve error position precision
  • WP/EnqueuedResourceParameters: add support for PHP 7.4/8.1 numbers
  • PHPCS: ruleset tweak
  • CodeAnalysis/EscapedNotTranslated: improvement to the error message
  • PHP/PregQuoteDelimiter: minor message tweak for clarity
  • PHP/RestrictedPHPFunctions: minor message tweak for clarity
  • PHP/TypeCasts: minor message tweak for clarity
  • Security/SafeRedirect: minor message tweak for clarity
  • WP/GlobalVariablesOverride: implement PHPCSUtils
  • WP/GlobalVariablesOverride: minor efficiency tweak
  • WP/GlobalVariablesOverride: add extra test
  • WP/GlobalVariablesOverride: bug fix - allow for global statement closed via close tag
  • WP/GlobalVariablesOverride: add support for PHP 7.4+ arrow functions
  • WP/GlobalVariablesOverride: add test with PHP 7.4+ null coalesce assignment
  • WP/GlobalVariablesOverride: add test with PHP 8.0+ constructor property promotion
  • WP/GlobalVariablesOverride: add test with PHP 8.1+ enums
  • WP/GlobalVariablesOverride: minor code readability improvement
  • WP/GlobalVariablesOverride: minor comment fix
  • Composer: update for PHPCSUtils + PHPCSExtra 1.0.0
  • DB/DirectDatabaseQuery: remove redundant code
  • DB/DirectDatabaseQuery: add missing test case
  • DB/DirectDatabaseQuery: implement PHPCSUtils
  • DB/DirectDatabaseQuery: add support for PHP 8.0+ nullsafe object operator
  • DB/DirectDatabaseQuery: bug fix - code style independent token walking
  • DB/DirectDatabaseQuery: bug fix - finding end of statement
  • DB/DirectDatabaseQuery: bug fix - ignore TRUNCATE queries
  • Sniff: move the $SQL*Functions properties to the DB/PreparedSQL Sniff
  • DB/PreparedSQL: change visibility of a property
  • DB/PreparedSQL: minor code tweak
  • DB/PreparedSQL: use predefined token collections [1]
  • DB/PreparedSQL: use predefined token collections [2]
  • DB/PreparedSQL: use predefined token collections [3]
  • DB/PreparedSQL: use predefined token collections + allow floats [4]
  • DB/PreparedSQL: use predefined token collections [5]
  • DB/PreparedSQL: allow for the PHP 8.0+ nullsafe object operator
  • DB/PreparedSQL: add test with PHP 7.3+ flexible heredoc
  • DB/PreparedSQL: add test with PHP 7.4+ numeric literals with underscores and PHP 8.1+ explicit octals
  • DB/PreparedSQL: minor documentation tweaks
  • Helpers/MinimumWPVersionTrait: split wp_version_compare() method
  • Helpers/MinimumWPVersionTrait: reduce use of magic number
  • Helpers/MinimumWPVersionTrait: rename method
  • NamingConventions/PrefixAllGlobals: minor code tweak
  • NamingConventions/PrefixAllGlobals: remove some redundant code
  • NamingConventions/PrefixAllGlobals: add extra tests
  • NamingConventions/PrefixAllGlobals: implement PHPCSUtils
  • NamingConventions/PrefixAllGlobals: minor bug fix
  • NamingConventions/PrefixAllGlobals: (mostly) ignore PHP 7.4+ arrow functions
  • NamingConventions/PrefixAllGlobals: add test with PHP 7.4 null coalesce equals
  • NamingConventions/PrefixAllGlobals: add test with PHP 8.0 nullsafe object operator
  • NamingConventions/PrefixAllGlobals: add support for PHP 8.0+ named parameters
  • NamingConventions/PrefixAllGlobals: prevent some false positives
  • NamingConventions/PrefixAllGlobals: add test with PHP 8.0+ constructor property promotion
  • NamingConventions/PrefixAllGlobals: add support for PHP 8.1+ enums
  • NamingConventions/PrefixAllGlobals: add tests with PHP 8.2+ constants in traits
  • NamingConventions/PrefixAllGlobals: bug fix - finding end of global statement
  • NamingConventions/PrefixAllGlobals: bug fix - only check global statement in current scope
  • Move "snake case" related utility to dedicated SnakeCaseHelper
  • SnakeCaseHelper::get_suggestion(): bug fix - underscore handling
  • NamingConventions/ValidFunctionName: add extra tests
  • NamingConventions/ValidFunctionName: implement PHPCSUtils methods
  • NamingConventions/ValidFunctionName: add tests covering PHP 8.1+ enums
  • NamingConventions/ValidFunctionName: minor comment fix
  • NamingConventions/ValidVariableName: sync with upstream
  • NamingConventions/ValidVariableName: bug fix
  • NamingConventions/ValidVariableName: implement PHPCSUtils [1]
  • NamingConventions/ValidVariableName: implement PHPCSUtils [2]
  • NamingConventions/ValidVariableName: implement PHPCSUtils [3]
  • NamingConventions/ValidVariableName: add tests with PHP 7.4+ arrow functions
  • NamingConventions/ValidVariableName: allow for the PHP 8.0+ nullsafe object operator
  • NamingConventions/ValidVariableName: add tests with PHP 8.1+ enums
  • NamingConventions/ValidVariableName: add extra test
  • NamingConventions/ValidVariableName: minor documentation improvement
  • CodeAnalysis/AssignmentInCondition: remove parse error related warning
  • Arrays/MultipleStatementAlignment: add some extra tests
  • Arrays/MultipleStatementAlignment: implement PHPCSUtils
  • Arrays/ArrayIndentation: add extra test
  • Arrays/ArrayIndentation: implement PHPCSUtils
  • Utils/I18nTextDomainFixer: add load_script_textdomain() function
  • Utils/I18nTextDomainFixer: update lists of plugin/theme headers
  • Utils/I18nTextDomainFixer: add some extra tests
  • Utils/I18nTextDomainFixer: implement PHPCSUtils
  • Utils/I18nTextDomainFixer: add support for PHP 8.0+ named parameters
  • NamingConventions/Valid(Function|Variable)Name: bug fix for error determination
  • CodeAnalysis/AssignmentInCondition: defer to upstream sniff
  • CodeAnalysis/AssignmentInTernaryCondition: remove some redundant code
  • CodeAnalysis/AssignmentInTernaryCondition: add some extra tests
  • CodeAnalysis/AssignmentInTernaryCondition: implement PHPCSUtils
  • CodeAnalysis/AssignmentInTernaryCondition: add test with PHP 7.4+ null coalesce equals
  • QA: make all test classes final
  • QA: make all non-abstract sniff classes final
  • PHPCS: enforce classes to be abstract or final
  • Documentation: various minor tweaks
  • Ruleset: various minor doc updates
  • Minor CS/QA fixes
  • WP/PostsPerPage: minor clean up of test case file
  • GH Actions: minor tweak to composer install
  • GH Actions/quicktest: simplify the matrix
  • GH Actions/ruleset-test: minimize the install
  • GH Actions: tweak the way the PHPCS versions are set
  • Composer: up the minimum PHPCS version to 3.7.2
  • WP/I18n: minor code simplification
  • WP/I18n: fix property reset in tests
  • WP/I18n: complete refactor of the sniff
  • WP/I18n: add tests with PHP 8.0+ named parameters
  • WP/I18n: add tests with PHP 7.3+ trailing commas in function calls
  • WP/I18n: fix SuperfluousDefaultTextDomain auto-fix code to allow for named params
  • WP/I18n: remove the public check_translator_comments property
  • WP/I18n: bug fix - fixer for UnorderedPlaceholders* could mangle text string
  • WP/I18n: new error: passing empty string as text domain
  • WP/EnqueuedResourceParameters: fix handling of an edge case
  • SnakeCaseHelper: fix typo in regex
  • WPDBTrait: add some extra tests
  • CodeAnalysis/AssignmentInTernaryCondition: add extra test
  • Files/FileName: add some extra tests
  • WP/CapitalPDangit: add extra test
  • WP/DeprecatedParameterValues: add extra test
  • Sniff::get_last_ptr_on_line(): remove function
  • Tests: allow for recording code coverage + add @covers tags
  • Tests: add @covers tags for Helpers
  • Tests: add @covers tags for abstract base sniff classes
  • Move is_class_object_call() utility method to dedicated ContextHelper
  • ContextHelper::has_object_operator_before(): simplify/use PHPCSUtils/support PHP 8.0 nullsafe object operator
  • Move is_token_namespaced() utility method to dedicated ContextHelper
  • ContextHelper::is_token_namespaced(): minor simplifications
  • NamingConventions/ValidVariableName: use ContextHelper::has_object_operator_before()
  • NamingConventions/ValidVariableName: normalize parameter names
  • Move is_in_function_call() utility method to dedicated ContextHelper
  • Move is_in_type_test() utility method to dedicated ContextHelper
  • Move is_in_isset_or_empty() utility method to dedicated ContextHelper
  • ContextHelper::is_in_isset_or_empty(): move functions array to property
  • ContextHelper::is_in_isset_or_empty(): use PHPCSUtils
  • ContextHelper::is_in_isset_or_empty(): add support for PHP 8.0 named parameters
  • Move is_safe_casted() utility method to dedicated ContextHelper
  • ContextHelper::is_safe_casted(): minor simplification
  • WP/I18n: allow for new PHP 8.0+ [s]printf() placeholders
  • Move is_in_array_comparison() utility method to dedicated ContextHelper
  • ContextHelper::is_in_array_comparison(): bug fix for case-insensitivity
  • ContextHelper::is_in_array_comparison(): add support for PHP 8.0 named parameters
  • Move get_list_variables() utility method to dedicated ListHelper
  • ListHelper::get_list_variables(): use PHPCSUtils / prevent false positives on complex list item keys
  • AbstractFunctionRestrictionsSniff: add test for non-listed function
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): remove some redundant code
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): add tests with OO declarations
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): add tests with import use declarations
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): add test with live coding/parse error
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): bug fix - false positive on function declaration returning by reference
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): bug fix - false positive for class instantiation
  • AbstractFunctionRestrictionsSniff::is_targetted_token(): prevent false positives on PHP 8.0+ attributes
  • AbstractFunctionRestrictionsSniff::process_token(): add tests for the exclude property
  • AbstractFunctionRestrictionsSniff: add test with empty functions group
  • AbstractFunctionRestrictionsSniff: bug fix - function names should be compared case-insensitively
  • AbstractFunctionRestrictionsSniff: add test with PHP 8.1+ first class callables
  • AbstractClassRestrictionsSniff::get_namespaced_classname(): efficiency tweak
  • AbstractClassRestrictionsSniff::get_namespaced_classname(): bug fix - namespace operator is case-insensitive
  • AbstractClassRestrictionsSniff::is_targetted_token(): bug fix - false positives icw hierarchy keywords
  • AbstractClassRestrictionsSniff::is_targetted_token(): use PHPCSUtils [1]
  • AbstractClassRestrictionsSniff::is_targetted_token(): bug fix - false negative on class instantiation ending on close tag
  • AbstractClassRestrictionsSniff::is_targetted_token(): bug fix - false negative on class instantiation with method chaining
  • AbstractClassRestrictionsSniff: add an extra test
  • AbstractClassRestrictionsSniff::is_targetted_token(): bug fix - sniff does not bow out early on hierarchy keywords
  • AbstractClassRestrictionsSniff::is_targetted_token(): bug fix - hierarchy keywords are case-insensitive
  • AbstractClassRestrictionsSniff::is_targetted_token(): use PHPCSUtils [2]
  • AbstractClassRestrictionsSniff::is_targetted_token(): add tests with PHP 7.0+ anonymous classes
  • AbstractClassRestrictionsSniff::is_targetted_token(): add tests with PHP 8.1+ enums
  • Support '%i' placeholders for escaping Identifiers (e.g. table/field names)
  • Core: replace the Generic EndFileNewline sniff with the PSR2 one
  • Tests: fix unintentional (parse/compile) errors in test case files
  • Tests: use unique function names
  • WP/EnqueuedResources: bring back try/catch
  • GH Actions: fix fixer conflict check
  • GH Actions: temporarily ignore one test case file for the fixer conflict check
  • Core: add section about namespace declaration rules with select new sniffs
  • Move is_use_of_global_constant() utility method to dedicated ConstantsHelper
  • ConstantsHelper::is_use_of_global_constant(): simplify/implement PHPCSUtils
  • ConstantsHelper::is_use_of_global_constant(): minor simplification
  • Move escaping functions related functionality to dedicated EscapingFunctionsTrait
  • Move printing functions related functionality to dedicated PrintingFunctionsTrait
  • Minor doc tweaks
  • Core: add section about import use statement rules with select new sniffs
  • Move formatting functions related functionality to dedicated FormattingFunctionsHelper
  • Core: add new sniff to check formatting of OO declaration statement
  • CS: fix up own codebase to comply with class rules
  • WP/CapitalPDangit: use more modular error codes
  • Move "array walking" functions related functionality to dedicated ArrayWalkingFunctionsHelper
  • ArrayWalkingFunctionsHelper: add support for PHP 8.0+ named parameters
  • Move sanitization functions related functionality to dedicated SanitizingFunctionsTrait (Move sanitization functions related functionality to dedicated SanitizingFunctionsTrait WordPress/WordPress-Coding-Standards#2259)
  • Move unslashing-only functions related functionality to dedicated UnslashingFunctionsHelper
  • Move validation checking functionality to dedicated ValidationHelper
  • Security/ValidatedSanitizedInput: rename test case file
  • ValidationHelper::is_validated(): add some extra tests
  • ValidationHelper::is_validated(): implement PHPCSUtils
  • ValidationHelper::is_validated(): move inline array to property [1]
  • ValidationHelper::is_validated(): move inline array to property [2]
  • ValidationHelper::is_validated(): extract some duplicate code to a separate method
  • ValidationHelper::is_validated(): add note about PHP 7.4 arrow functions
  • ValidationHelper::is_validated(): add support for PHP 8.0 named parameters
  • ValidationHelper::is_validated(): don't examine PHP 8.0 attributes which may look like function calls
  • ValidationHelper::is_validated(): don't examine PHP 8.1 first call callables which look like function calls
  • ValidationHelper::is_validated(): various minor tweaks
  • WP/PostsPerPage: simplification
  • AbstractArrayAssignmentRestrictions: add some extra tests
  • AbstractArrayAssignmentRestrictions: improve documentation
  • AbstractArrayAssignmentRestrictions: minor readability fix
  • AbstractArrayAssignmentRestrictions: implement PHPCSUtils
  • AbstractArrayAssignmentRestrictions: bug fix - improve comment tolerance [1]
  • AbstractArrayAssignmentRestrictions: bug fix - improve comment tolerance [2]
  • AbstractArrayAssignmentRestrictions: minor efficiency tweak [1]
  • AbstractArrayAssignmentRestrictions: minor efficiency tweak [2]
  • AbstractArrayAssignmentRestrictions: minor efficiency tweak [3]
  • AbstractArrayAssignmentRestrictions: precision (bug) fix
  • AbstractArrayAssignmentRestrictions: bug fix - simplify the $inst(ances) array
  • AbstractArrayAssignmentRestrictions: make the contents of $inst more comprehensible
  • AbstractArrayAssignmentRestrictions: report the error for array assignments on the key pointer
  • AbstractArrayAssignmentRestrictions: allow for PHP 7.4+ null coalesce equals
  • AbstractArrayAssignmentRestrictions: add test with PHP 8.0 match
  • AbstractArrayAssignmentRestrictions: bug fix - improve value capturing
  • AbstractArrayAssignmentRestrictionsSniff: don't strip quotes off value
  • Helpers\IsUnitTestTrait: bug fix - allow for custom test classes passed as FQN
  • ArrayWalkingFunctionsHelper: improve consistency in method names across Helpers
  • UnslashingFunctionsHelper: improve consistency in method names across Helpers
  • Helpers: add some more defensive coding
  • ContextHelper::$safe_casts: make private
  • ArrayWalkingFunctionsHelper: make sure function names are checked case-insensitively
  • FormattingFunctionsHelper: make sure function names are checked case-insensitively
  • UnslashingFunctionsHelper: make sure function names are checked case-insensitively
  • EscapingFunctionsTrait: make sure function names are checked case-insensitively
  • PrintingFunctionsTrait: make sure function names are checked case-insensitively
  • SanitizingFunctionsTrait: make sure function names are checked case-insensitively
  • Security/PluginMenuSlug: order functions list alphabetically
  • NamingConventions/PrefixAllGlobals: make the "is PHP native polyfill ?" check case-insensitive
  • PHP/StrictInArray: rename a local variable
  • NamingConventions/ValidVariableName: re-order member names + remove one
  • WP/DiscouragedConstants: use the ConstantsHelper class
  • Docs: clarify the $matched_content parameter
  • Docs: use correct format for @internal tags
  • Docs: remove redundant comment
  • WP/AlternativeFunctionsSniff::is_local_data_stream(): update param name and docs
  • IsUnitTestTrait: make sure namespace and class names are checked case-insensitively
  • Files/FileName: improve handling of files using non-underscore, non-dash word separators
  • Files/FileName: improve handling of files using different file extensions
  • Files/FileName: update for changes in WP Core
  • NamingConventions/PrefixAllGlobals: allow non-prefixed declarations for pluggable functions and classes
  • GH Actions/manage-labels: remove label which doesn't exist anymore
  • DB/DirectDatabaseQuery: SQL keywords are case-insensitive
  • DB/DirectDatabaseQuery: method names are case-insensitive
  • WP/PostsPerPage: bug fix - non-numeric values for "posts_per_page" should be disregarded
  • WP/PostsPerPage: bug fix - allow for explicitly positive numbers
  • WP/PostsPerPage: allow for non-decimal nrs, PHP 7.4 numeric literals, PHP 8.1 octal literals
  • Always use BCFile for find[Start|End]OfStatement()
  • AbstractArrayAssignmentRestrictions: remove support for 'callback'
  • Docs: add @internal tag to classes marked as internal API
  • Docs: add missing @uses tags
  • Docs: make sure all moved methods have correct changelog entries
  • VariableHelper::is_comparison(): minor defensive coding tweak
  • Security/NonceVerification: rename test case file
  • Security/NonceVerification: move test involving global scope to separate test case file
  • Security/NonceVerification: add some extra tests involving global scope
  • Security/NonceVerification: test with empty()
  • Security/NonceVerification: remove redundant function call
  • Security/NonceVerification: remove redundant local variable
  • Security/NonceVerification: changes to $addedCustomFunctions property
  • Security/NonceVerification: bug fix - $_FILES not $_FILE
  • Security/NonceVerification: move results cache to property
  • Security/NonceVerification: improve caching
  • Security/NonceVerification: add cache getter and setter methods
  • Security/NonceVerification: implement PHPCSUtils
  • Security/NonceVerification: bug fix - ignore OO properties
  • Security/NonceVerification: bug fix - disregard assignments via list()
  • Security/NonceVerification: new needs_nonce_check() method
  • Security/NonceVerification: efficiency fix - check for being in a nonce verification method early
  • Security/NonceVerification: bug fix - allow unsetting of superglobal key without nonce verification
  • Security/NonceVerification: add test with PHP 7.0+ null coalesce operator
  • Security/NonceVerification: support PHP 7.4+ null coalesce equals
  • Security/NonceVerification: disregard PHP 7.4 arrow function when determining search scope
  • Security/NonceVerification: disregard nonce check in PHP 7.4 arrow function when searching
  • Security/NonceVerification: add test with PHP 8.0+ match construct
  • Security/NonceVerification: add test with PHP 8.1+ nested enum
  • Security/NonceVerification: various documentation tweaks
  • NamingConventions/ValidVariableName: bring back $catID
  • Arrays/ArrayDeclarationSpacing: implement PHPCSUtils [1]
  • Arrays/ArrayDeclarationSpacing: implement PHPCSUtils [2] / PHP 7.2+ keyed lists
  • Arrays/ArrayDeclarationSpacing: implement PHPCSUtils [3]
  • Arrays/ArrayDeclarationSpacing: implement PHPCSUtils [4]
  • Arrays/ArrayDeclarationSpacing: replace whitespace checks with PHPCSExtra sniff
  • Arrays/ArrayDeclarationSpacing::process_multi_line_array(): remove redundant parameter
  • Arrays/ArrayDeclarationSpacing::process_single_line_array(): lower nesting level
  • Arrays/ArrayDeclarationSpacing: minor test tweaks
  • Core: add section about trait use statement rules with select new sniffs
  • Composer: update PHPCSUtils + PHPCSExtra
  • Core: add some more sniffs for import use statements
  • Extra: add sniff to detect inefficient "echo sprintf(...)"
  • Replace the WordPress.Array.CommaAfterArrayItem sniff
  • Rulesets: various minor tweaks
  • DB/PreparedSQLPlaceholders: final fixes for %i support
  • DB/PreparedSQLPlaceholders: add extra tests
  • DB/PreparedSQLPlaceholders: make variables used explicit
  • DB/PreparedSQLPlaceholders: implement PHPCSUtils
  • DB/PreparedSQLPlaceholders: minor simplification
  • DB/PreparedSQLPlaceholders: prevent false positive due to comments in params [1]
  • DB/PreparedSQLPlaceholders: prevent false negative due to comments in params [2]
  • DB/PreparedSQLPlaceholders: prevent false positive due to comments in params [3]
  • DB/PreparedSQLPlaceholders: bug fix - allow for FQN function calls
  • DB/PreparedSQLPlaceholders: bug fix - sniff could skip too much
  • DB/PreparedSQLPlaceholders: improve error message precision for IdentifierWithinIN
  • DB/PreparedSQLPlaceholders: improve error message precision for QuotedDynamicPlaceholderGeneration
  • DB/PreparedSQLPlaceholders: prevent token walking too far
  • DB/PreparedSQLPlaceholders: add tests with PHP 7.3+ trailing commas in function calls
  • DB/PreparedSQLPlaceholders: add tests with PHP 8.0+ nullsafe object operator [1]
  • DB/PreparedSQLPlaceholders: add tests with PHP 8.0+ nullsafe object operator [2]
  • DB/PreparedSQLPlaceholders: add support for PHP 8.0+ named parameters [1]
  • DB/PreparedSQLPlaceholders: add support for PHP 8.0+ named parameters [2]
  • DB/PreparedSQLPlaceholders: add support for PHP 8.0+ named parameters [3]
  • DB/PreparedSQLPlaceholders: add support for PHP 8.0+ named parameters [4]
  • DB/PreparedSQLPlaceholders: add tests with PHP 8.1+ first class callable
  • DB/PreparedSQLPlaceholders: minor documentation fix
  • Docs: various minor tweaks
  • NamingConventions/PrefixAllGlobals: order constants list alphabetically
  • NamingConventions/PrefixAllGlobals: update the constants list based on WP 6.3-RC1
  • NamingConventions/ValidPostTypeSlug: order reserved names alphabetically
  • NamingConventions/ValidPostTypeSlug: update the reserved post types list based on WP 6.3-RC1
  • WP/ClassNameCase: update the class lists based on WP 6.3-RC1
  • WP/ClassNameCase: add list of Twenty* themes classes
  • WP/DeprecatedClasses: update the class list based on WP 6.3-RC1
  • WP/DeprecatedFunctions: update the functions list based on WP 6.3-RC1
  • WP/DeprecatedParameters: update the list based on WP 6.3-RC1
  • Update the minimum_wp_version to WP 6.0
  • .gitattributes: minor update
  • PHPUnit config: remove file which no longer exists
  • Core/Extra: tweak the inclusion of the Modernize.FunctionCalls.Dirname sniff
  • EscapingFunctionsTrait: add esc_xml() to the list of escaping functions
  • EscapingFunctionsTrait: add wp_timezone_choice() to the list of auto-escaped functions
  • EscapingFunctionsTrait: add wp_readonly() to the list of auto-escaped functions
  • SanitizingFunctionsTrait: add sanitize_url() to the list of sanitization functions
  • [SanitizingFunctions|EscapingFunctions]Trait: add wp_kses_one_attr() to function lists
  • Security/EscapeOutput: rename test case file
  • Security/EscapeOutput: move parse error related test to separate file
  • Security/EscapeOutput: use Tokens::$magicConstants
  • Security/EscapeOutput: use PHPCSUtils
  • Security/EscapeOutput: normalize the $safe_components array
  • Security/EscapeOutput: bug fix - expand the "safe components" list
  • Security/EscapeOutput: split process_token() method [1]
  • Security/EscapeOutput: split process_token() method [2]
  • Security/EscapeOutput: bug fix - false positives on non-function calls
  • Helpers/PrintingFunctionsTrait: add get_printing_functions() method
  • Security/EscapeOutput: bug fix - false positives on non-global function calls
  • Security/EscapeOutput: bug fix - function names are case-insensitive
  • Security/EscapeOutput: prevent false positive due to comments in param
  • Security/EscapeOutput: code readability improvements [1]
  • Security/EscapeOutput: bug fix - only examine exit/die with parentheses
  • Security/EscapeOutput: bug fix - improve start/end determination for print statements
  • Security/EscapeOutput: efficiency tweak for parse errors in echo statements
  • Security/EscapeOutput: fix up after refactor
  • Security/EscapeOutput: bug fix - allow for nested statements with ternaries
  • Security/EscapeOutput: bug fix - [improved] allow for nested statements with ternaries
  • Security/EscapeOutput: bug fix - allow non-matching parentheses
  • Security/EscapeOutput: bug fix - fix ternary finding within the loop
  • Security/EscapeOutput: bug fix - false negatives for short ternary
  • Security/EscapeOutput: code readability improvements [2]
  • Security/EscapeOutput: efficiency tweak [1]
  • Security/EscapeOutput: efficiency tweak [2]
  • Security/EscapeOutput: bug fix - sniff would skip too much
  • Security/EscapeOutput: bug fix - sniff did not handle function call parameters correctly
  • Security/EscapeOutput: add tests for PHP 7.4 numeric literals + PHP 8.1 octal literals
  • Security/EscapeOutput: add support for PHP 8.0+ named parameters [1]
  • Security/EscapeOutput: add support for PHP 8.0+ named parameters [2]
  • Security/EscapeOutput: add support for PHP 8.0+ match expressions [1]
  • Security/EscapeOutput: add support for PHP 8.0+ match expressions [2]
  • Security/EscapeOutput: add support for *::class and PHP 8.0+ $obj::class
  • Security/EscapeOutput: add support for examining throw statements and PHP 8.0+ throw expressions
  • Security/EscapeOutput: improve handling of inline expressions
  • Security/EscapeOutput: improve handling of params in unsafe printing functions
  • Security/EscapeOutput: very minor code readability improvements [3]
  • Security/EscapeOutput: bug fix - sniff did not handle arrays correctly
  • Security/EscapeOutput: group common token check together
  • Security/EscapeOutput: improve handling of heredocs, include PHP 7.3+ flexible heredocs
  • Security/EscapeOutput: improve handling of params in formatting functions
  • Security/EscapeOutput: special case get_search_query( false )
  • Security/EscapeOutput: various minor docs fixes
  • Core: properly check formatting of function declaration statements
  • CS: fix up closure spacing to comply with new rules
  • GlobalVariablesOverride: move parse error test to separate file
  • Composer: make PHP extension dependencies explicit
  • Docs: remove redundant @package tags
  • Add release checklist
  • Release checklist: update for review comments
  • Whitespace/ControlStructureSpacing: sync with upstream [1]
  • Whitespace/ControlStructureSpacing: sync with upstream [2]
  • Whitespace/ControlStructureSpacing: sync with upstream [3]
  • Whitespace/ControlStructureSpacing: sync with upstream [4]
  • WhiteSpace/ControlStructureSpacing: implement PHPCSUtils
  • WhiteSpace/ControlStructureSpacing: fix/update class docblock
  • Docs: remove orphaned CommaAfterArrayItem docs
  • Docs: remove orphaned ClassInstantiation docs
  • WhiteSpace/ControlStructureSpacing: add documentation
  • Docs: update the sample ruleset
  • Code coverage: initial setup for CodeCov
  • Utils/I18nTextDomainFixer: use PHPCSUtils in one more place
  • WP/Capabilities: minor clean up
  • DB/DirectDatabaseQuery: minor defensive coding tweak
  • Files/FileName: minor defensive coding tweak in test code
  • DateTime/CurrentTimeTimestamp: rename some local variables
  • WhiteSpace/ControlStructureSpacing: minor defensive coding tweak
  • Docs: array properties expect arrays
  • Sniff: move "missing unslashing" handling to callback function
  • README: fix codecov badge
  • QA/CS: various minor tweaks
  • QA/CS: alphabetize import use statements
  • GH Actions: fix quicktest for develop
  • Issue template: minor tweaks
  • Changelog: update references to the Composer PHPCS plugin
  • Codecov config: tweak patch config
  • Rename SanitizingFunctionsTrait to SanitizationHelperTrait
  • Move sanitization methods to SanitizationHelperTrait
  • SanitizationHelperTrait::is_sanitized(): add some defensive coding
  • SanitizationHelperTrait::is_sanitized(): implement PHPCSUtils
  • SanitizationHelperTrait::is_sanitized(): efficiency tweak - move unset check up
  • SanitizationHelperTrait::is_sanitized(): efficiency fix/improve performance
  • SanitizationHelperTrait::is_sanitized(): minor code tweaks
  • SanitizationHelperTrait::is_sanitized(): minor doc tweaks
  • Various minor doc fixes
  • Docs: improve test @return tags
  • Docs: more @var/@param/@return tag improvements
  • Docs: add missing @return tags
  • Add PHPStan to QA checks
  • Updates related to branch rename from master to main
  • Make methods in traits final
  • ValidationHelper: bug fix - unsetting is not validation
  • ValidationHelper: bug fix - validation done in another scope
  • Security/ValidatedSanitizedInput: make sure all superglobals being examined are used in tests
  • Security/ValidatedSanitizedInput: use PHPCSUtils for superglobal determination [1]
  • Security/ValidatedSanitizedInput: use PHPCSUtils for superglobal determination [2]
  • Security/ValidatedSanitizedInput: add extra test for PHP 7.4+ null coalesce equals
  • Security/ValidatedSanitizedInput: add test with PHP 8.0+ match [1]
  • Security/ValidatedSanitizedInput: add tests with PHP 8.0+ match [2]
  • Security/ValidatedSanitizedInput: make MissingUnslash message more informative
  • Security/ValidatedSanitizedInput: make closures static
  • CS: closures not using $this should be static
  • Helpers: add type declarations whenever possible
  • Sniff: remove init() method
  • Tests: Remove redundant placeholder function
  • README: updates for WordPressCS 3.0.0
  • CONTRIBUTING: updates for WordPressCS 3.0.0
  • Docs: miscellaneous changes
  • Changelog for WordPressCS 3.0.0 (Changelog for WordPressCS 3.0.0 WordPress/WordPress-Coding-Standards#2368)
  • Docs: Use WordPress.Files.FileName rule instead of WordPress.Files.Filename in the sample phpcs ruleset
  • GH Actions: add task to test example ruleset
  • Security/EscapeOutputSniff: More modular error codes
  • Keep the old code for trigger_error
  • Default $code per request
  • Update readme of the project
  • Update README.md
  • Funding: fix format
  • Release checklist: add link to monthly dev blog
  • Add dependabot configuration file
  • Add changelog for v3.0.1
  • Fix the release date in the changelog
  • GH Actions: Bump actions/checkout from 3 to 4
  • Add defensive coding to posts per page sniff and add tests
  • README: minor tweak
  • Add a sniff that checks if double arrows use only 1 space THEME-3651

jrfnl and others added 30 commits July 10, 2023 21:24
…dundant parameter

The previous change made passing the array `$closer` token to the `process_multi_line_array()` method redundant, so let's remove the parameter.
…sting level

As the checks for whitespace around the array opener/closer have now been removed, the code in the `process_single_line_array()` method no longer needs to be nested in condition upon condition.

This commit applies the typical "bow out early" pattern to the code in the method.

:point_right: This change will be easier to review while ignoring whitespace changes.
…ename-bring-back-catID

NamingConventions/ValidVariableName: bring back `$catID`
…tionspacing-phpcsutils-phpcsextra

Arrays/ArrayDeclarationSpacing: partially replace the sniff + implement PHPCSUtils in what remains
> ### Trait Use Statements
>
> Trait use statements should be at the top of a class and should have exactly one blank line before the first use statement, and at least one blank line after the last statement. The only exception is when the class only contains trait use statements, in which case the blank line after may be omitted.
>
> The following code examples show the formatting requirements for trait use statements regarding things like spacing, grouping and indentation.

Refs:
* https://make.wordpress.org/core/2020/03/20/updating-the-coding-standards-for-modern-php/ - Trait use statement section
* https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#trait-use-statements
* WordPress/wpcs-docs 101
* WordPress/wpcs-docs 130
* https://www.php-fig.org/psr/psr-12/#42-using-traits

The WP rules for traits are very akin to the PSR12 rules with only a few exceptions:
* WP allows a blank line between the class/trait declaration statement and the first trait `use` statement.
* In the Make post, the proposed rules allowed for single-line `use` statements with conflict resolution. PSR12 always demands multi-line in that case.

The upstream PSR12 trait use sniff therefore seems like a good fit.

I propose to exclude the "blank line before first `use`" error code to address the first point mentioned above.

As for the second point, the code sample which showed the single-line `use` statement in the docs has been updated to multi-line in PR WordPress/wpcs-docs 130. With that change and taking into consideration that these rules are new to WPCS anyway, it makes sense to actually apply the PSR version of the rule demanding that conflict resolution must always be multi-line.

Other than that, this PR contains one more exclusion to prevent duplicate error messages about a spacing issue already covered via another sniff.
Note: this exclusion won't work (yet) as there is a typo in the upstream sniff. PR squizlabs/PHP_CodeSniffer 3856 is open to fix this.
PHPCSUtils released version 1.0.8 with a small bug fix.

PHPCSExtra has just released version 1.1.0. with 7 new sniffs, most of which we'll want to add to WPCS (will be done in follow-up PRs).

Refs:
* https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.0.8
* https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.1.0
…ate-phpcsextra-phpcsutils

Composer: update PHPCSUtils + PHPCSExtra
Includes preventing a duplicate notification about "spacing after the `use` keyword".

Refs:
* `Universal.UseStatements.DisallowMixedGroupUse` - upstream PHPCSStandards/PHPCSExtra 241
* `Universal.UseStatements.NoUselessAliases` - upstream PHPCSStandards/PHPCSExtra 244
* `Universal.UseStatements.KeywordSpacing` - upstream PHPCSStandards/PHPCSExtra 247
... which ought to be replaced by `prinft(...)`.

Ref: PHPCSStandards/PHPCSExtra 242
... with two sniffs from PHPCSExtra.

The original WPCS native sniff did two things:
1. Check for a comma after the last item in an array (forbid it for single-line arrays, enforce it for multi-line arrays).
2. Check the spacing around commas in arrays (no space before the comma, one space or new line after the comma with an allowance for aligned trailing comments).

The sniff will now be replaced by the following upstream sniffs:
* `NormalizedArrays.Arrays.CommaAfterLast` for the comma after the last item in an array.
* `Universal.WhiteSpace.CommaSpacing` for the spacing around commas (and not just in arrays).

The behaviour of the sniffs is 100% in line with the original sniff (verified by running both the old and the new sniffs over the test case file for the WPCS sniff being removed).

Additionally, the `Universal.WhiteSpace.CommaSpacing` sniff will now check the spacing around commas in more places, where WPCS previously did not check the comma spacing and will make sure the comma is before a trailing comment, not after.

The `Universal.WhiteSpace.CommaSpacing` sniff by default checks the spacing for _all_ commas with the following exceptions:
* A comma preceded or followed by a parenthesis, curly or square bracket will not be flagged to prevent conflicts with sniffs handling spacing around braces.
* A comma preceded or followed by another comma, like for skipping items in a list assignment, will not be flagged.
* A comma preceded by a non-indented heredoc/nowdoc closer.
    These will be flagged, but in that case, unless the `php_version` config directive is set to a version higher than PHP 7.3.0, a new line before will be enforced to prevent parse errors on PHP < 7.3.

This also means that the sniff will flag issues with the spacing around commas in function declarations, function calls and closure use statements, while WPCS already has other sniffs in place to handle this.

Luckily, the upstream sniff offers very modular error codes, so we can selectively silence those errors in the most common situations to prevent duplicate notices about the same issue.
For those places were the `Universal` sniff doesn't offer modular codes, we can, in most cases, selectively silence the errors coming from other sniffs. This commit includes some of those exclusions, but we may need to add more if we discover additional message duplications.

There may, however, still be some places which could get duplicate messages. It is, however, not expected that those will ever lead to fixer conflicts.

Both upstream sniffs contain fixers for all issues.

Ref:
* PHPCSStandards/PHPCSExtra 11
* PHPCSStandards/PHPCSExtra 254
Double-checked the ruleset against the handbook. Everything currently in the handbook is now in the Core ruleset. :white_checkmark:

* Removed duplicate rule (the `Universal.UseStatements.LowercaseFunctionConst` was previously added here, but subsequently added to the "Use import statement" section as well).
* Removed links to closed issues when the issue has been addressed in the mean time.
* Made sure that rules which haven't got a sniff associated with them, while they are potentially sniffable, have an issue attached to them.
* Made sure that rules which are "covered" by one or more sniffs have the `Covers` prefix.
…ks-tidy-up

Rulesets: various minor tweaks
* Add sniff to the list of sniffs using the `MinimumWPVersionTrait`
* Fix incorrect implementation of the minimum WP version check.
    This check was never supposed to hide the `QuotedIdentifierPlaceholder` check when the minimum supported WP version is below 6.2.
    Instead, the check is needed to flag the `%i` modifier as an "unsupported placeholder" when used with a minimum supported WP version below 6.2.

Includes tests safeguarding the new `UnsupportedIdentifierPlaceholder` error.
Note: I've left the `phpcs:set WordPress.DB.PreparedSQLPlaceholders minimum_wp_version 6.2` before the original set of test in place to prevent having to up the error/warning nrs for all those tests, while this particular error is safeguarded via separate tests anyway.

Includes a few minor doc tweaks.
Includes a minor efficiency fix (condition order in an `if`).
Support '%i' placeholders for escaping Identifiers
... to covered previously uncovered code.

Note: some of the messages generated for these (mostly invalid) code samples are not always that clear, but the fact that the queries are being flagged is still correct.
These variables are conditionally set within the `for()` loop. Just declaring them here to be more explicit/complete with the variables in use within the loop.
This change is already covered by existing tests (test case file line 58 and 259).
In both these cases, a "quick check" for the target function call was done prior to walking the tokens, but the token walking with a negative search for `Tokens::$emptyToken` doesn't contain the risk of walking very far, so this quick check isn't really needed and removing it shouldn't impact performance.
… params [1]

The `'raw'` key in the parameter arrays returned from the `PassedParameters` class contains - as per the name - the _raw_ contents of the parameter.

Since PHPCSUtils 1.0.0-alpha4, the return array also contain a `'clean'` index, which contains the contents of the parameter cleaned of comments.

By switching to using that key, a potential false positive gets fixed.

Includes unit test demonstrating the issue and safeguarding the fix.
… params [2]

The `'raw'` key in the parameter arrays returned from the `PassedParameters` class contains - as per the name - the _raw_ contents of the parameter.

Since PHPCSUtils 1.0.0-alpha4, the return array also contain a `'clean'` index, which contains the contents of the parameter cleaned of comments.

By switching to using that key, a potential false negative gets fixed.

Includes unit test demonstrating the issue and safeguarding the fix.
… params [3]

The `'raw'` key in the parameter arrays returned from the `PassedParameters` class contains - as per the name - the _raw_ contents of the parameter.

Since PHPCSUtils 1.0.0-alpha4, the return array also contain a `'clean'` index, which contains the contents of the parameter cleaned of comments.

By switching to using that key, a potential false positive gets fixed.

Includes unit test demonstrating the issue and safeguarding the fix.
Also includes unit tests with an unsupported placeholder in the `array_fill()`, which looks like it was so far untested.
When looking for a function calls to `implode()` or `array_fill()`, the sniff did not allow for fully qualified function calls, which would lead to false positives.

Fixed now.

Includes unit tests demonstrating the issue and safeguarding the fix.
As things were, the `$skip_to` param would lead to the first token _after_ the parenthesis closer also being skipped. This was not the intention and while - for valid code - this won't lead to false positives/negatives, it should still be fixed.
…ifierWithinIN

Throw the error for `IdentifierWithinIN` error on the actual text string token in the parameter instead of on the function call to `implode()` to give a better indication where the actual error occurred.

Safeguarded by adjusting one of the pre-existing tests.
…dDynamicPlaceholderGeneration

Throw the error for `QuotedDynamicPlaceholderGeneration` error on the actual text string token which contains the open quote instead of on the function call to `implode()` to give a better indication where the actual error occurred.

Safeguarded via the existing tests.
anomiex and others added 27 commits September 4, 2023 16:08
Add the funding link and section in the readme.
Add the link to the v3 release make post in the readme.
Add the FUNDING.yml file so that we can add the funding button in the repo.

Co-authored-by: Juliette <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
This should either be an array of links or a singular link. The `WP PHP` was regarded as an invalid link (not as a link description).

Ref: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
…se-checklist

Release checklist: add link to monthly dev blog
…-codes-for-error-generation

Security/EscapeOutputSniff: More modular error codes
This commit adds an initial Dependabot configuration to:
* Submit pull requests for security updates and version updates for GH Action runner dependencies.

At a later point in time, we could consider enabling it for Composer dependencies as well.

The configuration has been set up to:
* Run weekly (for now).
* Submit a maximum of 5 pull requests at a time.
    If additional pull requests are needed, these will subsequently be submitted the next time Dependabot runs after one or more of the open pull requests have been merged.
* The commit messages for PRs submitted by Dependabot will be prefixed according the unofficial conventions used in this repo up to now.
* The PRs will automatically be labelled with an appropriate label as already in use in this repo.

Refs:
* https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
* https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#versioning-strategy
Co-authored-by: Juliette <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
…r-wpcs-3.0.1-release

Add changelog for v3.0.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
…-update

Fix the release date in the changelog
The posts per page sniff should bail out early if empty string is passed as a value.

The tests were added for both posts per page sniff and slow db query sniff,
to check if empty string is passed as a value.
In the case of SlowDBQuery the sniff should flag cases where there is and isn't a value passed,
as that sniff will always flag whenever meta_key and meta_value are used in a query.
…-error

Add defensive coding in posts per page sniff
Just noticed this didn't display as intended.
@pawelmpc pawelmpc merged commit c6bc477 into placester Apr 18, 2024
3 of 33 checks passed
@pawelmpc pawelmpc deleted the THEME-3651 branch April 18, 2024 09:44
pawelmpc pushed a commit that referenced this pull request Apr 18, 2024
1. Adjusted the way the correct parameter is retrieved to use the new PHPCSUtils 1.0.0-alpha4 `PassedParameters::getParameterFromStack()` method.
2. Verified the parameter name used is in line with the name as per the WP 6.1 release.
    WP has been renaming parameters and is probably not done yet, but it doesn't look like those changes (so far) made it into changelog entries.... _sigh_.
    It also looks like in the past, deprecated parameters were being renamed to `$deprecated` on deprecation. This practice should be strongly discouraged in the context of named parameters, but that's a different discussion and outside of the scope of this commit.
    For the purposes of this exercise, I've taken the _current_ parameter name as the "truth" as support for named parameters hasn't officially been announced yet, so any renames _after_ this moment are the only ones relevant.
3. Adjusted the error message/data determination to take named parameters into account.

Name verification notes:
* Removed the `comments_link()` function.
    Per [the changelog](https://developer.wordpress.org/reference/functions/comments_number/#changelog), the previously deprecated fourth parameter is now being used for something else since WP 5.4.0....
    Far from best practice, but it is what it is, so I've removed the listing for that function.

What has **not** been done: a scan of the WP Core codebase to find newly deprecated parameters.

Includes additional unit tests and updating one existing test to ensure the code logic is properly covered.

Note: I thought of updating the error message to no longer refer to the position of the parameter, but to use the parameter name instead (with a "Found: %s" for displaying value), as in:
```bash
# Current:
The parameter "$variable" at position #2 of wp_new_user_notification() has been deprecated since WordPress version 4.3.1. Instead do not pass the parameter.

# Variation:
The $deprecated parameter of the wp_new_user_notification() function has been deprecated since WordPress version 4.3.1. Instead do not pass the parameter. Found: $variable
```
... but as WP renamed all deprecated parameters to `$deprecated`, this wouldn't necessarily be more descriptive than it is now.

Along the same lines, I considered updating the error code to refer to the param name instead of the position, but aside from it not making things more descriptive as things are, that would also constitute a BC-break which I don't think is warranted.

Opinions appreciated.
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

Successfully merging this pull request may close these issues.

7 participants