yoast/yoastcs
Yoast Coding Standards (YoastCS) provides Composer-installable rulesets for PHP_CodeSniffer plus PHP Parallel Lint, bundling Yoast sniffs and selected external standards (including WordPress). Use it to enforce consistent code style and quality in Yoast projects.
^2.1.6 to ^3.0.0@alpha.
This allows for installing the much, much improved PHPCompatibility 10.0.0 (prerelease).
To do so, the composer.json file of packages requiring this package must have "minimum-stability": "dev" or "alpha" (or other tweaks which net the same effect).SlevomatCodingStandard.Arrays.ArrayAccess sniff.SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator sniff.SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator sniff.SlevomatCodingStandard.Functions.RequireTrailingCommaInCall sniff.SlevomatCodingStandard.Functions.DisallowTrailingCommaInCall sniff (for single-line function calls).SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator sniff.Universal.Attributes.TrailingComma sniff.Universal.Attributes.BracketSpacing sniff (via WordPressCS).Universal.Attributes.DisallowAttributeParentheses sniff (via WordPressCS).Universal.PHP.NoFQNTrueFalseNull sniff.Universal.PHP.RequireExitDieParentheses sniff.WordPress.WP.GetMetaSingle sniff (via WordPressCS).^1.2.1 to ^1.5.0.^2.12.0 to ^2.13.0.^3.1.0 to ^3.3.0.minimum_wp_version property which is used by various WPCS sniffs has been updated to WP 6.8 (was 6.6).Generic.Strings.UnnecessaryHeredoc sniff.Generic.WhiteSpace.HereNowdocIdentifierSpacing sniff.^3.9.1 to ^3.12.0.^1.0.10 to ^1.0.12.^2.1.4 to ^2.1.6.^2.11.17 to ^2.12.0.^3.0.0 to ^3.0.1.7.4 (was 7.2).minimum_wp_version property which is used by various WPCS sniffs has been updated to WP 6.6 (was 6.3).YOASTCS_ABOVE_THRESHOLD constant, a new YOASTCS_THRESHOLD_EXACT_MATCH constant will now be available to determine (from a calling script) whether the error/warning thresholds were matched exactly or need to be updated.^3.8.0 to ^3.9.1.^1.0.9 to ^1.0.10.^3.0.1 to ^3.1.0.
This introduces one new sniff - Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence - to the YoastCS ruleset.^8.14.0 to ^8.15.0.^1.3.2 to ^1.4.0.minimum_wp_version (previously minimum_supported_wp_version) property which is used by various WPCS sniffs has been updated to WP 6.3 (was 6.2).Yoast.Commenting.CoversTag sniff includes a new warning for the use of ClassName<*> type [@covers](https://github.com/covers) annotations, as these have been deprecated as of PHPUnit 9.0.Yoast.Files.FileName sniff now has the (optional) ability to check whether file names comply with PSR-4.
To enable this ability, add the custom psr4_paths property to your ruleset. The psr4_paths property is an array property and mirrors the psr4 setting in the Composer autoload directive. 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", the oo_prefixes and the excluded_files_strict_check properties will be ignored.Yoast.NamingConventions.NamespaceName sniff will now throw a MissingPrefix error if a prefix is expected, but the namespace name does not include a prefix.Yoast.NamingConventions.NamespaceName sniff will now throw a DirectoryInvalid error if a file is in a directory which would not result in a valid namespace name.Yoast.NamingConventions.NamespaceName sniff now has the (optional) ability to check whether namespace names comply with PSR-4.
To enable this ability, add the custom psr4_paths property to your ruleset. The psr4_paths property is an array property and mirrors the psr4 setting in the Composer autoload directive. 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).
A psr4_paths property will take precedence over the, potentially set, src_directory and prefixes properties.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.ProperEscapingFunctionPathHelper, PathValidationHelper and PSR4PathsTraits classes/traits for use by the sniffs.Threshold report.final and all non-public methods and properties are now private.
Additionally, all non-private methods in traits have also been made final.^3.7.1 to ^3.8.0.^2.3.0 to ^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.minimum_wp_version (previously minimum_supported_wp_version) property which is used by various WPCS sniffs has been updated to WP 6.2 (was 6.0).wp-content/plugins/ subdirectory will now always be ignored for PHPCS scans.doubles_path property in the Yoast.Files.TestDoubles sniff has been updated to include the typical Yoast test/Unit/Doubles and test/WP/Doubles directories as per the restructured tests.Yoast.Commenting.CodeCoverageIgnoreDeprecated sniff will now also examine class docblocks.Yoast.Commenting.FileComment sniff will no longer flag a file docblock in a namespaced file which doesn't contain an OO structure as redundant.Yoast.Files.FileName sniff will now also examine the file name of PHP files using only the PHP short open tag (<?=).Yoast.Files.FileName sniff 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!Yoast.Files.FileName sniff now recognizes more word separators, meaning that files using other word separators than underscores will now be flagged for not using hyphenation.Yoast.Files.FileName sniff will now throw a potential "missing basepath" warning only once per run, not for each file triggering the sniff.doubles_path property in the Yoast.Files.TestDoubles sniff 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.Yoast.NamingConventions.NamespaceName sniff now allows for test fixtures directories being at a deeper level than directly under a tests directory.Yoast.NamingConventions.ObjectNameDepth sniff now allows for test classes using a _TestCase suffix and will allow for extra object name depth for those, same as for test classes with a _Test suffix.Yoast.Yoast.AlternativeFunctions sniff has been renamed to Yoast.Yoast.JsonEncodeAlternative.Yoast.Yoast.JsonEncodeAlternative sniff (previously Yoast.Yoast.AlternativeFunctions) is now disabled by default for files in a /tests/ directory.Generic.CodeAnalysis.UselessOverridingMethod sniff is now disabled by default for files in a /tests/*/Doubles/ directory.WordPress.WP.GlobalVariablesOverride sniff is now disabled by default for files in a /tests/ directory.Yoast.Files.TestDoubles sniff have been improved for accuracy.Yoast.NamingConventions.NamespaceName.Invalid error has been made more informative/actionable.Yoast.NamingConventions.ValidHookName.NonString warning has been made more actionable.Yoast.ControlStructures.IfElseDeclaration sniff (replaced by the Universal.ControlStructures.IfElseDeclaration sniff from PHPCSExtra).Yoast.Namespaces.NamespaceDeclaration sniff (replaced by a variety of sniffs from PHPCSExtra).Yoast.Files.TestDoubles doubles_path property being passed as a string instead of an array.
Passing the property as a string was previously deprecated in YoastCS 1.1.0.Yoast.Files.TestDoubles.OneObjectPerFile error code.
This is already checked via the Generic.Files.OneObjectStructurePerFile sniff, which is included in WordPressCS, anyway.Yoast.Commenting.CoversTag sniff will no longer flag ::<[!]visibility> annotations as an invalid format when combined with a [@coversDefaultClass](https://github.com/coversDefaultClass) tag.Yoast.Commenting.TestHaveCoversTag sniff will no longer examine global functions.Yoast.Files.FileName sniff will now handle the values for the excluded_files_strict_check property in a case-sensitive manner (as file names are case-sensitive on most operating systems).Yoast.Files.TestDoubles sniff will now handle the values for the doubles_path property in a case-sensitive manner (as directory names are case-sensitive on most operating systems).Yoast.NamingConventions.NamespaceName sniff will now bow out earlier if the namespace name is invalid (parse error).Yoast.NamingConventions.NamespaceName sniff will now handle "directory to namespace name" translations more accurately and will no longer throw an error if the directory name contains an underscore.Yoast.NamingConventions.ObjectNameDepth sniff now has a more accurate object name depth calculation for OO structures with a name in CamelCaps.
This should prevent various false positives for test classes/test doubles.Yoast.NamingConventions.ObjectNameDepth sniff will no longer check if a class extends a known "TestCase" to determine whether to allow for extra object name depth, it will just base itself on the name of the object under examination, which should prevent some false positives.Yoast.Yoast.JsonEncodeAlternative sniff (previously Yoast.Yoast.AlternativeFunctions) will no longer inadvertently create a parse error when fixing fully qualified function calls.Yoast.Yoast.JsonEncodeAlternative sniff (previously Yoast.Yoast.AlternativeFunctions) will now no longer try to auto-fix when it encounters PHP 5.6+ parameter unpacking.Yoast.Yoast.JsonEncodeAlternative sniff (previously Yoast.Yoast.AlternativeFunctions) will now no longer try to auto-fix when it encounters a PHP 8.1+ first class callable.^3.7.1 to ^3.7.2.Yoast.Tools.BrainMonkeyRaceCondition sniff.
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.minimum_supported_wp_version property which is used by various WPCS sniffs has been updated to WP 6.0 (was 5.7).^3.6.2 to ^3.7.1.^2.1.3 to ^2.1.4.^0.5 || ^0.6.2 || ^0.7 to ^0.6.2 || ^0.7 || ^1.0.Yoast.Files.FileComment: the sniff will now allow for and respect phpcs:disable comments for this sniff when found in a file docblock.^3.6.0 to ^3.6.2.^2.1.0 to ^2.1.3.^1.3.1 to ^1.3.2.^0.5.0 to ^1.0.0.php-parallel-lint/php-parallel-lint and php-parallel-lint/php-console-highlighter are included in the require-dev of your composer.json file, you can remove these after updating the version constraint for YoastCS to "yoast/yoastcs": "^2.2.0".YoastCS\Yoast\Reports\Threshold report.
This commit adds a custom report for use with PHPCS to compare the run results with "threshold" settings.
YOASTCS_THRESHOLD_ERRORSYOASTCS_THRESHOLD_WARNINGSYOASTCS_ABOVE_THRESHOLD constant (boolean) will be available which can be used in calling scripts.--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).PSR12.ControlStructures.BooleanOperatorPlacement sniff.
Enforces that boolean operators in multi-line control structures are always placed at the start of a line.Yoast.Commenting.CodeCoverageIgnoreDeprecated: Support for attributes (PHP 8.0+) placed between a function or class declaration and the associated docblock.Yoast.Commenting.TestHaveCoversTag: Support for attributes (PHP 8.0+) placed between a function or class declaration and the associated docblock.Yoast.NamingConventions.ObjectNameDepth: Support for attributes (PHP 8.0+) placed between a function or class declaration and the associated docblock.Yoast.NamingConventions.ObjectNameDepth: Support for examining the word count in CamelCaps class names.Yoast.NamingConventions.ValidHookName: Verification that backslashes in namespace-like prefixes in double quoted strings are slash-escaped.minimum_supported_wp_version property which is used by various WPCS sniffs has been updated to WP 5.7 (was 5.4).^3.5.0 to ^3.6.0.^2.2.0 to ^2.3.0.Yoast.Commenting.CoversTag: [@covers](https://github.com/covers) tags refering to classes and functions which don't follow the WordPressCS naming conventions will now be regarded as valid.Yoast.Commenting.TestsHaveCoversTag: the sniff will now also report missing [@covers](https://github.com/covers) tags for test methods without docblock.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.Yoast.Commenting.TestsHaveCoversTag: will no longer expect a [@covers](https://github.com/covers) tag for abstract test methods.Yoast.Files.FileComment: fixed performance issue.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).Yoast.NamingConventions.ObjectNameDepth: the object name depth for underscore prefixed class names will now be calculated correctly.Yoast.NamingConventions.ValidHookName: will now recognize slash-escaped backslashes in namespace-like prefixes correctly when in a double quoted string.Yoast.Files.TestDoubles sniff to verify that all double/mock classes have either Double or Mock in the class name.Yoast.NamingConventions.NamespaceName sniff to see the breakdown of the number of levels used in namespace names across a code base.
To see the metrics, run PHPCS with the --report=info option.Yoast.NamingConventions.ObjectNameDepth sniff to see the breakdown of the number of words used in object names across a code base.
To see the metrics, run PHPCS with the --report=info option.Yoast.NamingConventions.ValidHookName sniff to see the breakdown of the number of words used in hook names across a code base, as well as a break down of old-style versus new-style hook name usage.
To see the metrics, run PHPCS with the --report=info option.minimum_supported_wp_version property which is used by various WPCS sniffs has been updated to WP 5.4 (was 5.3).0.7.0 version which adds support for Composer 2.0.
Note: this requirement is flexible to prevent conflicts with included standards which may include the plugin as well.Yoast.Files.FileName sniff expects a -functions suffix for a function-only file. The sniff has been updated to also allow such a file to be called functions.php without further specification.
This widening is specifically intended for namespaced function-only files.Yoast.NamingConventions.NamespaceName sniff has improved handling of the allowance for an extra namespace level for test double directories for non-conventional test directory set-ups (like YoastSEO).minimum_supported_wp_version property which is used by various WPCS sniffs has been updated to WP 5.3 (was 5.2).^0.5.0 to ^0.5 || ^0.6.
Note: this requirement is flexible to prevent conflicts with included standards which may include the plugin as well.Yoast.NamingConventions.NamespaceName: fixed a potential "undefined index" notice.Yoast.NamingConventions.ObjectNameDepth sniff.
_Test, _Mock or _Double suffix at the end of the object name will be disregarded for the purposes of the word count.max_words (error) and recommended_max_words (warning). The default for both is 3.Yoast.NamingConventions.NamespaceName sniff.
This sniff verifies that:
Tests\(Doubles\) directly after the prefix will be ignored when determining the level depth.max_levels (error) and recommended_max_levels (warning) which are by default set to 3 and 2 respectively.src_directory to indicate the project root(s) for the path-to-name translation when the project root is not the repo root directory.prefixes to set the plugin specific prefix(es) to take into account.Yoast.NamingConventions.ValidHookName sniff.
This sniff extends and adds to the upstream WordPress.NamingConventions.ValidHookName sniff.
The sniff will ignore non-prefixed hooks and hooks with a prefix unrelated to the plugin being examined, to prevent errors being thrown about hook names which are outside of our control.
This sniff verifies that:
Yoast\WP\PluginName.
Note: The prefix is exempt from the lowercase with words separated by underscores rule.
If the non-namespace type prefix for a plugin is used, the sniff will throw a warning.warning at severity 3 suggesting the hook name be inspected manually.
As the default severity for PHPCS is 5, this warning at severity 3 will normally not be shown.
It is there to allow for intermittently checking of the dynamic hook names. To trigger it, --severity=3 should be passed on the command line.maximum_depth (error) and soft_maximum_depth (warning). The default for both is 4.prefixes to set the plugin specific prefix(es) to take into account.Generic.Arrays.DisallowLongArraySyntax sniff.
WPCS 2.2.0 demands long array syntax. In contrast to that, YoastCS demands short array syntax.Generic.ControlStructures.DisallowYodaConditions sniff.
In contrast to WPCS, YoastCS never demanded Yoda conditions. With the addition of this sniff, "normal" (non-Yoda) conditions will now be enforced.Generic.WhiteSpace.SpreadOperatorSpacingAfter sniff.
Enforces no space between the ... spread operator and the variable/function call it applies to.PEAR.WhiteSpace.ObjectOperatorIndent sniff.
Enforce consistent indentation of chained method calls to one more or less than the previous call in the chain and always at least one in from the start of the chain.PSR12.Classes.ClosingBrace sniff.
This sniff disallows the outdated practice of // end ... comments for OO stuctures.PSR12.Files.ImportStatement sniff.
Import use statements must always be fully qualified, so a leading backslash is redundant (and discouraged by PHP itself).
This sniff enforces that no leading backslash is used for import use statements.PSR12.Files.OpenTag sniff.
Enforces that a PHP open tag is on a line by itself in PHP-only files.CustomPrefixesTrait to handle checking names against a list of custom prefixes.lint script which uses the Parallel-Lint package for faster and more readable linting results.Yoast.Files.FileName sniff: the public $prefixes property, which can be used to indicate which prefixes should be stripped of a class name when translating it to a file name, has been renamed to $oo_prefixes.
Custom repo specific rulesets using the property should be updates to reflect this change.Yoast.Files.FileName sniff: the public $exclude property, which can be used to indicate which files to exclude from the file name versus object name check, has been renamed to $excluded_files_strict_check.
Custom repo specific rulesets using the property should be updates to reflect this change.minimum_supported_wp_version property which is used by various WPCS sniffs has been update to WP 5.2 (was 4.9).^3.4.2 to ^3.5.0.
Note: this makes the option --filter=gitstaged available which can be used in git pre-commit hooks to only check staged files.^2.1.1 to ^2.2.0.^2.0.0 to ^2.1.0.Yoast.Commenting.CoversTag sniff.
This sniff verifies that:
[@covers](https://github.com/covers) annotation is valid based on what's supported by PHPUnit;[@covers](https://github.com/covers) or [@coversNothing](https://github.com/coversNothing) tags in a docblock;[@covers](https://github.com/covers) tag as well as a [@coversNothing](https://github.com/coversNothing) tag;
Includes a fixer for common errors.Yoast.Commenting.TestsHaveCoversTag sniff.
This sniff verifies that all unit test functions have at least one [@covers](https://github.com/covers) tag - or a [@coversNothing](https://github.com/coversNothing) tag - in the function docblock or in the class docblock.Yoast.Yoast.AlternativeFunctions sniff.
This sniff allows for discouraging/forbidding the use of PHP/WP native functions in favor of using Yoast native functions.
In this initial version, the sniff checks for the use of the json_encode() and wp_json_encode() functions and suggests using WPSEO_Utils::format_json_encode() instead.
Note: this sniff contains an auto-fixer. If for any of the repos, the auto-fixer should not be used, the auto-fixer can be disabled from within the repo specific ruleset using <rule ref="..." phpcs-only="true"/>.Squiz.WhiteSpace.MemberVarSpacing sniff.
This sniff verifies and auto-fixes the number of blank lines between property declarations within OO-structures.minimum_supported_wp_version property which is used by various WPCS sniffs. The current default is WP 4.9.
Previously this value would have to be set via a config directive in custom repo specific rulesets.
For those rulesets which use the Yoast default, this config directive can now be removed.
For more details, see #131.phpcs --generator=Text --standard=Yoast.fix-cs script./.git//.wordpress-svn//node-modules//vendor//vendor_prefixed/
Custom repo specific rulesets which contain excludes to this effect, can now remove them safely.Generic.Formatting.MultipleStatementAlignment and WordPress.Arrays.MultipleStatementAlignment sniffs, has been upgraded from warning to error.json_encode() function in the WordPress.WP.AlternativeFunctions has been disabled in favor of the new YoastCS native Yoast.Yoast.AlternativeFunctions sniff.^3.4.0 to ^3.4.2.^2.0.0 to ^2.1.1.nightly (PHP 8, unstable) as no viable PHPUnit version is currently available.Yoast.Files.FileName sniff will now always suggest removing the longest prefix of the prefixes passed in the configuration.^3.3.2 to ^3.4.0.^1.2.0 to ^2.0.0.Yoast.Namespaces.NamespaceDeclaration sniff.Yoast.Commenting.FileComment sniff.
This sniff is a wrapper around the FileComment sniff used in WordPressCS and manages the slightly different requirements for file comments set for the Yoast organisation, in particular:
Yoast.Namespaces.NamespaceDeclaration sniff.
This sniff forbids the use of:
namespace; which in effect means "global namespace".Yoast.Commenting.CodeCoverageIgnoreDeprecated sniff.
This sniff verifies that functions which have a [@deprecated](https://github.com/deprecated) tag in the function docblock, also have a [@codeCoverageIgnore](https://github.com/codeCoverageIgnore) tag in the same docblock.^0.5.0.
This means that - in most cases - projects which require(-dev) YoastCS, will no longer need to have the plugin in their own composer.json and will still get the benefit of it.Yoast.Files.TestDoubles sniff now allows setting multiple valid paths for test doubles to be placed in.
To this end, the public doubles_path property has been changed from a string to an array.^3.3.1 to ^3.3.2.^1.0.0 to ^1.2.0.^1.0.0 to ^2.0.0, which uses PHPCompatibility ^9.0.0 under the hood.config-set script for use with this repo has been renamed to config-yoastcs to be in line with the same script in other repos..gitignore.suggest section. The DealerDirect Composer PHPCS plugin is now included in the require section.Yoast.Files.TestDoubles sniff.
basepath contained a trailing slash, the sniff could give incorrect results./tests/doublesniff as correct when /test/doubles is in the allowed list.OneObjectPerFile check will now check both code above the detected mock/double class as well as code below it.Yoast.Files.TestDoubles sniff.
This sniff verifies that test double/mock classes are in their own file in a doubles test sub-directory.Yoast.WhiteSpace.FunctionSpacing sniff.
This sniff is based on the PHPCS native Squiz.WhiteSpace.FunctionSpacing sniff and verifies and auto-fixes the amount of blank lines between methods within OO-structures.Generic.PHP.LowerCaseType sniff, as introduced in PHP_CodeSniffer 3.3.0, to the YoastCS ruleset.PSR2.Methods.FunctionClosingBrace sniff to the YoastCS ruleset.PSR12.Keywords.ShortFormTypeKeywords sniff, as introduced in PHP_CodeSniffer 3.3.0, to the YoastCS ruleset.roave/security-advisories dependency to prevent dependencies with known security issues from being installed.--dev requirement of the PHPCompatibility library at version ^8.2.0.^3.2.0 to ^3.3.1.~0.14.0 to ^1.0.0.^1.0.0.check-cs over the code in this repo.
PHP_CodeSniffer 3.3.0 allows overruling config directives from the command-line. This also simplies the ruleset used for the YoastCS codebase.composer.lock file.
This file is not necessary for library packages and makes the testing of YoastCS sniffs more involved.PHPCompatibility ruleset.
These are no longer necessary after the switch to PHPCompatibilityWP.// End ... comments from the codebase.Yoast.Files.FileName sniff and exclude the whole WordPress.Files.FileName sniff.
The Yoast.Files.FileName sniff verifies that file names comply with the Yoast specific file name rules.^8.1.0.
Checking against this standard was previously disabled as it was incompatible with Composer. This has since been fixed.PHPCompatibility standard to prevent false positives for native PHP functionality which is back-filled by WordPress.WordPress.Arrays.MultipleStatementAlignment sniff as introduced in WordPressCS 0.14.0.WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition error code.WordPress.PHP.StrictInArray.FoundNonStrictFalse error code.type indicator for compatibility with Composer plugins which handle the setting of the PHP_CodeSniffer installed_paths directive.dealerdirect/phpcodesniffer-composer-installer, for handling the PHP_CodeSniffer installed_paths directive at version ^0.4.3.composer.json file..gitattributes file to keep the code distributed via GH archives and Packagist clean of development related files..phpcs.xml.dist, based on YoastCS to check the code style of the code in the YoastCS repository itself.phpunit.xml.dist file to document the PHPUnit configuration used for testing the YoastCS native sniffs.2.8.1 to ^3.2.0.~0.10.0 to ~0.14.0.Yoast.ControlStructures.IfElseDeclaration sniff:
conflict directive.
This has been superseded by a higher minimum PHP_CodeSniffer requirement.Generic.Files.LineEndings.InvalidEOLChar error code.Generic.Strings.UnnecessaryStringConcat sniff, including custom configuration.
This sniff is now included in WordPressCS since version 0.11.0.PEAR.Functions.FunctionCallSignature.Indent error code as code should comply with this.Squiz.ControlStructures category and the related detail configuration.
This is now largely covered by WordPressCS 0.14.0.WordPress.Variables.GlobalVariables sniff.
This sniff was previously excluded because of a bug in WordPressCS. This bug has been fixed in WordPressCS 0.11.0.WordPress.VIP.DirectDatabaseQuery, WordPress.VIP.FileSystemWritesDisallow, WordPress.XSS.EscapeOutput, WordPress.VIP.ValidatedSanitizedInput sniffs and the Generic.Commenting.DocComment.MissingShort error code.
These kind of excludes should be handled in the plugin specific rulesets, not across the board in the YoastCS ruleset.WordPress.VIP.RestrictedFunctions, WordPress.VIP.RestrictedVariables and the WordPress.VIP.PostsPerPage sniffs.
This kind of configuration should be handled in the plugin specific rulesets, not across the board in the YoastCS ruleset.xml files in this repository.php files in this repository.index.php files.Generic.Strings.UnnecessaryStringConcat sniff to the YoastCS ruleset.Generic.PHP.Syntax sniff.
The Yoast plugins all run php lint against a variety of PHP versions, which is the recommended way to check for PHP syntax errors.WordPress.VIP.RestrictedFunctions sniff: error_log, runtime_configuration, prevent_path_disclosure, url_to_postid.2.7.0 to 2.8.1.
The minimum supported version remains at 2.8.1 as updated in YoastCS 0.4.1.2.4.3 to 2.6.0.
The minimum supported version remains at 2.2.3.WordPress ruleset, rather than the WordPress-VIP ruleset. See: #16.WordPress.NamingConventions.ValidVariableName sniff.
This sniff was previously excluded because of a bug in WordPressCS. This bug has been fixed in WordPressCS 0.10.0.Yoast.ControlStructures.IfElseDeclaration sniff.2.7.0 to ~2.8.1.Squiz.Commenting.FunctionComment.ScalarTypeHintMissing error code.
This is already taken care of upstream in WordPressCS 0.10.0.Yoast.ControlStructures.IfElseDeclaration sniff from the YoastCS ruleset.
All Yoast sniffs are automatically included, so the explicit inclusion was redundant.2.5.1 to ~2.7.0.0.9 to ~0.10.0.2.4.2 to 2.4.3.
The minimum supported version remains at 2.2.3.WordPress.VIP.RestrictedFunctions.get_pages error code to the YoastCS ruleset.PEAR.Functions.FunctionCallSignature.Indent error code to the YoastCS ruleset.Squiz.Commenting.FunctionComment.ScalarTypeHintMissing error code.WordPress.NamingConventions.ValidVariableName sniff.WordPress.VIP.RestrictedFunctions.count_user_posts error code.wp to the list of common exceptions to the ShortVariable name rule.^2.2.0 to 2.5.1.0.6 to 0.9.2.2.3 to 2.4.2.
The minimum supported version remains at 2.2.3.WordPress.NamingConventions.ValidFunctionName sniff from the YoastCS ruleset.Initial public release as a stand-alone package.
How can I help you explore Laravel packages today?