-
Notifications
You must be signed in to change notification settings - Fork 1
Releases: Yoast/yoastcs
Releases · Yoast/yoastcs
3.4.1
@jrfnl
jrfnl
Immutable
release. Only release title and notes can be modified.
dedd30d
This commit was created on GitHub.com and signed with GitHub’s verified signature.
3.4.1 - 2026年03月03日
Fixed
- PHPCS: a PHPCS run with the SlevomatCodingStandard locked at a version below 8.17.0 would error out on a "ERROR: Property "checkIfConditions" does not exist" error.
Assets 3
3.4.0
@enricobattocchi
enricobattocchi
Immutable
release. Only release title and notes can be modified.
c3f5b28
This commit was created on GitHub.com and signed with GitHub’s verified signature.
3.4.0 - 2026年02月20日
Changed
- Composer: Supported version of PHPCompatibilityWP has been changed from
^2.1.6to^3.0.0@alpha.
This allows for installing the much, much improved PHPCompatibility 10.0.0 (prerelease).
To do so, thecomposer.jsonfile of packages requiring this package must have"minimum-stability": "dev"or"alpha"(or other tweaks which net the same effect).
Assets 3
3.3.0
@enricobattocchi
enricobattocchi
Immutable
release. Only release title and notes can be modified.
54fdadb
This commit was created on GitHub.com and signed with GitHub’s verified signature.
3.3.0 - 2026年02月04日
Added
- PHPCS: The
SlevomatCodingStandard.Arrays.ArrayAccesssniff. - PHPCS: The
SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperatorsniff. - PHPCS: The
SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperatorsniff. - PHPCS: The
SlevomatCodingStandard.Functions.RequireTrailingCommaInCallsniff. - PHPCS: The
SlevomatCodingStandard.Functions.DisallowTrailingCommaInCallsniff (for single-line function calls). - PHPCS: The
SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparatorsniff. - PHPCS: The
Universal.Attributes.TrailingCommasniff. - PHPCS: The
Universal.Attributes.BracketSpacingsniff (via WordPressCS). - PHPCS: The
Universal.Attributes.DisallowAttributeParenthesessniff (via WordPressCS). - PHPCS: The
Universal.PHP.NoFQNTrueFalseNullsniff. - PHPCS: The
Universal.PHP.RequireExitDieParenthesessniff. - PHPCS: The
WordPress.WP.GetMetaSinglesniff (via WordPressCS).
Changed
- Composer: Supported version of PHPCSExtra has been changed from
^1.2.1to^1.5.0. - Composer: Supported version of VariableAnalysis has been changed from
^2.12.0to^2.13.0. - Composer: Supported version of WordPressCS has been changed from
^3.1.0to^3.3.0. - PHPCS: The default value for the
minimum_wp_versionproperty which is used by various WPCS sniffs has been updated to WP6.8(was6.6). - Various housekeeping.
Assets 3
3.2.0
@enricobattocchi
enricobattocchi
2594255
This commit was created on GitHub.com and signed with GitHub’s verified signature.
3.2.0 - 2025年03月19日
Added
- PHPCS: The
Generic.Strings.UnnecessaryHeredocsniff. - PHPCS: The
Generic.WhiteSpace.HereNowdocIdentifierSpacingsniff.
Changed
- Composer: Supported version of PHP_CodeSniffer has been changed from
^3.9.1to^3.12.0. - Composer: Supported version of PHPCSUtils has been changed from
^1.0.10to^1.0.12. - Composer: Supported version of PHPCompatibilityWP has been changed from
^2.1.4to^2.1.6. - Composer: Supported version of VariableAnalysis has been changed from
^2.11.17to^2.12.0. - Composer: Supported version of WordPressVIP Coding Standards has been changed from
^3.0.0to^3.0.1. - Composer: Updated the supported versions of dev dependencies.
- PHPCS: The default setting for the minimum supported PHP version for repos using YoastCS is now PHP
7.4(was7.2). - PHPCS: The default value for the
minimum_wp_versionproperty which is used by various WPCS sniffs has been updated to WP6.6(was6.3). - PHPCS: verified runtime compatibility with PHP 8.4.
- PHPCS: compatibility with SlevomatCodingStandard 8.16.0.
- Various housekeeping.
Fixed
- PHPCS: The spacing around comma's in short arrays nested in function calls will now be flagged correctly again.
Assets 2
3.1.0
@enricobattocchi
enricobattocchi
533b74e
This commit was created on GitHub.com and signed with GitHub’s verified signature.
3.1.0 - 2024年04月05日
Added
- Threshold report: aside from the pre-existing
YOASTCS_ABOVE_THRESHOLDconstant, a newYOASTCS_THRESHOLD_EXACT_MATCHconstant will now be available to determine (from a calling script) whether the error/warning thresholds were matched exactly or need to be updated.
Changed
- Composer: Supported version of PHP_CodeSniffer has been changed from
^3.8.0to^3.9.1. - Composer: Supported version of PHPCSUtils has been changed from
^1.0.9to^1.0.10. - Composer: Supported version of WordPressCS has been changed from
^3.0.1to^3.1.0.
This introduces one new sniff -Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence- to the YoastCS ruleset. - Composer: Supported version of SlevomatCodingStandard has been changed from
^8.14.0to^8.15.0. - Composer: Supported version of PHP Parallel Lint has been changed from
^1.3.2to^1.4.0. - PHPCS: The default value for the
minimum_wp_version(previouslyminimum_supported_wp_version) property which is used by various WPCS sniffs has been updated to WP6.3(was6.2). - Various housekeeping.
Assets 2
3.0.0
3.0.0 - 2023年12月14日
Added
- Composer/PHPCS: Dependencies on the following external PHPCS standards packages: PHPCSUtils, PHPCSExtra, SlevomatCodingStandard, VariableAnalysis and WordPressVIP Coding Standards.
- PHPCS: A best effort has been made to add support for new PHP syntaxes/features to all YoastCS native sniffs and utility functions (or to verify/improve existing support).
YoastCS native sniffs and utilities have received fixes for the following syntaxes:- PHP 5.6
- Parameter unpacking in function calls.
- PHP 8.0
- Named arguments in function calls.
- PHP 8.1
- Enumerations.
- First class callables.
- PHP 8.2
- Readonly classes.
- PHP 5.6
- PHPCS: The
Yoast.Commenting.CoversTagsniff includes a new warning for the use ofClassName<*>type@coversannotations, as these have been deprecated as of PHPUnit 9.0. - PHPCS: The
Yoast.Files.FileNamesniff now has the (optional) ability to check whether file names comply with PSR-4.
To enable this ability, add the custompsr4_pathsproperty to your ruleset. Thepsr4_pathsproperty is an array property and mirrors thepsr4setting in the Composerautoloaddirective. It expects a namespace prefix as the array key and a comma separated list of relative paths as the array value. Multiple PSR-4 paths can be passed (array elements).
For files containing OO structures in a "PSR4 path", theoo_prefixesand theexcluded_files_strict_checkproperties will be ignored. - PHPCS: The
Yoast.NamingConventions.NamespaceNamesniff will now throw aMissingPrefixerror if a prefix is expected, but the namespace name does not include a prefix. - PHPCS: The
Yoast.NamingConventions.NamespaceNamesniff will now throw aDirectoryInvaliderror if a file is in a directory which would not result in a valid namespace name. - PHPCS: The
Yoast.NamingConventions.NamespaceNamesniff now has the (optional) ability to check whether namespace names comply with PSR-4.
To enable this ability, add the custompsr4_pathsproperty to your ruleset. Thepsr4_pathsproperty is an array property and mirrors thepsr4setting in the Composerautoloaddirective. It expects a namespace prefix as the array key and a comma separated list of relative paths as the array value. Multiple PSR-4 paths can be passed (array elements).
Apsr4_pathsproperty will take precedence over the, potentially set,src_directoryandprefixesproperties. - PHPCS: The following sniffs/error codes have been added to/enabled in the YoastCS ruleset (with appropriate configuration):
- All new sniffs which were added/included in WordPressCS 3.0.0.
PSR1.Classes.ClassDeclaration(for tests only)PSR12.Properties.ConstantVisibilitySlevomatCodingStandard.Arrays.DisallowImplicitArrayCreationSlevomatCodingStandard.Classes.ClassStructureSlevomatCodingStandard.Classes.ModernClassNameReferenceSlevomatCodingStandard.Functions.StaticClosureSlevomatCodingStandard.Namespaces.AlphabeticallySortedUsesSlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstantsSlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctionsSlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnlySlevomatCodingStandard.Namespaces.UnusedUsesSlevomatCodingStandard.Namespaces.UseFromSameNamespaceSlevomatCodingStandard.TypeHints.DisallowMixedTypeHint(tests excluded)SlevomatCodingStandard.TypeHints.LongTypeHintsSlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValueSlevomatCodingStandard.TypeHints.NullTypeHintOnLastPositionSlevomatCodingStandard.TypeHints.ParameterTypeHintSlevomatCodingStandard.TypeHints.PropertyTypeHintSlevomatCodingStandard.TypeHints.ReturnTypeHintSquiz.Commenting.FunctionComment.InvalidReturnNotVoidSquiz.Commenting.FunctionComment.MissingReturnSquiz.Commenting.FunctionComment.ParamCommentNotCapitalSquiz.Commenting.FunctionComment.SpacingAfterParamNameSquiz.WhiteSpace.SuperfluousWhitespace.EmptyLinesUniversal.Classes.RequireFinalClass(for tests only, doubles/mocks excluded)Universal.CodeAnalysis.NoDoubleNegativeUniversal.ControlStructures.DisallowAlternativeSyntaxUniversal.ControlStructures.IfElseDeclarationUniversal.FunctionDeclarations.NoLongClosuresUniversal.Operators.ConcatPositionUniversal.Operators.DisallowLogicalAndOrUniversal.PHP.LowercasePHPTagUniversal.UseStatements.DisallowUseConstUniversal.UseStatements.DisallowUseFunctionVariableAnalysis.CodeAnalysis.VariableAnalysisWordPressVIPMinimum.Classes.DeclarationCompatibilityWordPressVIPMinimum.Hooks.AlwaysReturnInFilterWordPressVIPMinimum.Security.EscapingVoidReturnFunctionsWordPressVIPMinimum.Security.ProperEscapingFunction
- PHPCS: New
PathHelper,PathValidationHelperandPSR4PathsTraitsclasses/traits for use by the sniffs. - Readme: section on the YoastCS
Thresholdreport.
Changed
⚠️ The minimum supported PHP version for this package is now PHP 7.2 (was 5.4).- PHPCS: all sniffs are now runtime compatible with PHP 7.2 - 8.3.
⚠️ PHPCS: All non-abstract classes in YoastCS are nowfinaland all non-publicmethods and properties are nowprivate.
Additionally, all non-private methods in traits have also been madefinal.- Composer: Supported version of PHP_CodeSniffer has been changed from
^3.7.1to^3.8.0. ⚠️ Composer: Supported version of WordPressCS has been changed from^2.3.0to^3.0.1.
YoastCS is now fully compatible with WordPressCS 3.0.
Note: WordPressCS 3.0.0 contains breaking changes. Please read the WordPressCS release announcement and follow the WordPressCS upgrade guides.- PHPCS: The default value for the
minimum_wp_version(previouslyminimum_supported_wp_version) property which is used by various WPCS sniffs has been updated to WP6.2(was6.0). - PHPCS: Files in a
wp-content/plugins/subdirectory will now always be ignored for PHPCS scans. - PHPCS: The ruleset included value for the
doubles_pathproperty in theYoast.Files.TestDoublessniff has been updated to include the typical Yoasttest/Unit/Doublesandtest/WP/Doublesdirectories as per the restructured tests. - PHPCS: The
Yoast.Commenting.CodeCoverageIgnoreDeprecatedsniff will now also examine class docblocks. - PHPCS: The
Yoast.Commenting.FileCommentsniff will no longer flag a file docblock in a namespaced file which doesn't contain an OO structure as redundant. - PHPCS: The
Yoast.Files.FileNamesniff will now also examine the file name of PHP files using only the PHP short open tag (<?=). - PHPCS: The
Yoast.Files.FileNamesniff will now respect inline PHPCS native ignore/disable annotations for the sniff.
Note: the annotations are respected for the sniff itself, but not for individual error codes from the sniff! - PHPCS: The
Yoast.Files.FileNamesniff now recognizes more word separators, meaning that files using other word separators than underscores will now be flagged for not using hyphenation. - PHPCS: The
Yoast.Files.FileNamesniff will now throw a potential "missing basepath" warning only once per run, not for each file triggering the sniff. - PHPCS: The default value for the
doubles_pathproperty in theYoast.Files.TestDoublessniff is now an empty array.
This property should now always be set in a custom ruleset.
Note: the YoastCS ruleset sets this property, so if the ruleset is used instead of explicitly including the individual sniff, this change has no impact. - PHPCS: The "namespace level depth" check in the
Yoast.NamingConventions.NamespaceNamesniff now allows for test fixtures directories being at a deeper level than directly under atestsdirectory. - PHPCS: The
Yoast.NamingConventions.ObjectNameDepthsniff now allows for test classes using a_TestCasesuffix and will allow for extra object name depth for those, same as for test classes with a_Testsuffix. ⚠️ PHPCS: TheYoast.Yoast.AlternativeFunctionssniff has been renamed toYoast.Yoast.JsonEncodeAlternative.- The
Yoast.Yoast.JsonEncodeAlternativesniff (previouslyYoast.Yoast.AlternativeFunctions) is now disabled by default for files in a/tests/directory. - The
Generic.CodeAnalysis.UselessOverridingMethodsniff is now disabled by default for files in a/tests/*/Doubles/directory. - The
WordPress.WP.GlobalVariablesOverridesniff is now disabled by default for files in a/tests/directory. - PHPCS: The eror messages for the
Yoast.Files.TestDoublessniff have been improved for accuracy. - PHPCS: The error message for the
Yoast.NamingConventions.NamespaceName.Invaliderror has been made more informative/actionable. - PHPCS: The error message for the
Yoast.NamingConventions.ValidHookName.NonStringwarning has been made more actionable. - PHPCS: Various sniffs have received efficiency fixes for improved performance.
- PHPCS: the XML documentation for various sniffs ha...
Assets 2
2.3.1
2.3.1 - 2023年03月09日
Changed
- PHPCS: The default setting for the minimum supported PHP version for repos using YoastCS is now PHP 7.2 (was 5.6).
- Composer: Supported version of PHP_CodeSniffer has been changed from
^3.7.1to^3.7.2.
Assets 2
2.3.0
2.3.0 - 2023年01月09日
Added
- PHPCS: New
Yoast.Tools.BrainMonkeyRaceConditionsniff.
This sniff will flag test code which is likely to run into a particular race condition when using BrainMonkey to set expectations for WP hook functions.
Changed
- PHPCS: The default value for the
minimum_supported_wp_versionproperty which is used by various WPCS sniffs has been updated to WP6.0(was5.7). - Composer: The package will now identify itself as a static analysis tool. Thanks @GaryJones!
- Composer: Supported version of PHP_CodeSniffer has been changed from
^3.6.2to^3.7.1. - Composer: Supported version of PHPCompatibilityWP has been changed from
^2.1.3to^2.1.4. - Composer: Supported version of the Composer PHPCS plugin has been changed from
^0.5 || ^0.6.2 || ^0.7to^0.6.2 || ^0.7 || ^1.0. - Various housekeeping.
Fixed
- PHPCS:
Yoast.Files.FileComment: the sniff will now allow for and respectphpcs:disablecomments for this sniff when found in a file docblock.
Assets 2
2.2.1
2.2.1 - 2022年02月22日
Changed
- Composer: Supported version of PHP_CodeSniffer has been changed from
^3.6.0to^3.6.2. - Composer: Supported version of PHPCompatibilityWP has been changed from
^2.1.0to^2.1.3. - Composer: Supported version of PHP Parallel Lint has been changed from
^1.3.1to^1.3.2. - Composer: Supported version of PHP Console Highlighter has been changed from
^0.5.0to^1.0.0. - Readme: Updated installation instructions for compatibility with Composer 2.2+ and other minor improvements.
- Various housekeeping.
Assets 2
2.2.0
2.2.0 - 2021年09月22日
Added
- PHP Parallel Lint will now be provided via YoastCS.
Ifphp-parallel-lint/php-parallel-lintandphp-parallel-lint/php-console-highlighterare included in therequire-devof yourcomposer.jsonfile, you can remove these after updating the version constraint for YoastCS to"yoast/yoastcs": "^2.2.0". - PHPCS: A custom
YoastCS\Yoast\Reports\Thresholdreport.
This commit adds a custom report for use with PHPCS to compare the run results with "threshold" settings.- The report will look in the runtime environment for the following two environment variables and will take the values of those as the thresholds to compare the PHPCS run results against:
YOASTCS_THRESHOLD_ERRORSYOASTCS_THRESHOLD_WARNINGS
- If the environment variables are not set, they will default to 0 for both, i.e. no errors or warnings allowed.
- After the report has run, a global
YOASTCS_ABOVE_THRESHOLDconstant (boolean) will be available which can be used in calling scripts. - To use this report, run PHPCS with the following command-line argument:
--report=YoastCS\Yoast\Reports\Threshold.
Note: depending on the OS the command is run on, the backslashes in the report name may need to be escaped (doubled).
- The report will look in the runtime environment for the following two environment variables and will take the values of those as the thresholds to compare the PHPCS run results against:
- PHPCS: The
PSR12.ControlStructures.BooleanOperatorPlacementsniff.
Enforces that boolean operators in multi-line control structures are always placed at the start of a line. - PHPCS:
Yoast.Commenting.CodeCoverageIgnoreDeprecated: Support for attributes (PHP 8.0+) placed between a function or class declaration and the associated docblock. - PHPCS:
Yoast.Commenting.TestHaveCoversTag: Support for attributes (PHP 8.0+) placed between a function or class declaration and the associated docblock. - PHPCS:
Yoast.NamingConventions.ObjectNameDepth: Support for attributes (PHP 8.0+) placed between a function or class declaration and the associated docblock. - PHPCS:
Yoast.NamingConventions.ObjectNameDepth: Support for examining the word count in CamelCaps class names. - PHPCS:
Yoast.NamingConventions.ValidHookName: Verification that backslashes in namespace-like prefixes in double quoted strings are slash-escaped. - An initial CONTRIBUTING file with guidelines on acceptance testing changes to the sniffs in this repository.
Changed
- PHPCS: The default value for the
minimum_supported_wp_versionproperty which is used by various WPCS sniffs has been updated to WP5.7(was5.4). - Composer: Supported version of PHP_CodeSniffer has been changed from
^3.5.0to^3.6.0. - Composer: Supported version of WordPressCS has been changed from
^2.2.0to^2.3.0. - Composer: Updated the supported versions of dev dependencies.
- Readme: Minor documentation improvements.
- Continuous Integration: CI has been moved from Travis to GitHub Actions.
- Various housekeeping.
Fixed
- PHPCS:
Yoast.Commenting.CoversTag:@coverstags refering to classes and functions which don't follow the WordPressCS naming conventions will now be regarded as valid. - PHPCS:
Yoast.Commenting.TestsHaveCoversTag: the sniff will now also report missing@coverstags for test methods without docblock. - PHPCS:
Yoast.Commenting.TestsHaveCoversTag: the determination whether a class or method is a test class or method has been made more flexible to allow for different test naming conventions. - PHPCS:
Yoast.Commenting.TestsHaveCoversTag: will no longer expect a@coverstag for abstract test methods. - PHPCS:
Yoast.Files.FileComment: fixed performance issue. - PHPCS:
Yoast.Files.FileName: will no longer throw an error when a class names is an exact match for one of the "removable" prefixes (as there would be nothing left to name the file as). - PHPCS:
Yoast.NamingConventions.ObjectNameDepth: the object name depth for underscore prefixed class names will now be calculated correctly. - PHPCS:
Yoast.NamingConventions.ValidHookName: will now recognize slash-escaped backslashes in namespace-like prefixes correctly when in a double quoted string.