diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000000000000000000000000000000000000..51dc2e53a032283cc3511e92ac61d815327e0493 --- /dev/null +++ b/.cspell.json @@ -0,0 +1,62 @@ +{ + // Version of the setting file. Always 0.2 + "version": "0.2", + // language - current active spelling language + "language": "en-US", + "ignorePaths": [ + "composer.*", + "tests", + "vendor" + ], + "dictionaries": [ + "dictionary", + "drupal", + "companies", + "fonts", + "html", + "php", + "softwareTerms" + ], + // words - list of words to be always considered correct + "words": [ + "addtogroup", + "autoloader", + "codesniffer", + "ColourDefinitionSniff", + "CURLOPT_SSL_VERIFYPEER", + "datestamp", + "defgroup", + "drush", + "endcode", + "endlink", + "heredocs", + "Kernighan", + "Komodo", + "multibyte", + "Netbeans", + "phpcbf", + "Ritchie", + "ruleset", + "sirbrillig", + "squizlabs", + "Squiz", + "startOfLine", + "Superglobal", + "T_ASPERAND", + "T_COLOUR", + "T_CONSTANT_ENCAPSED_STRING", + "T_DNUMBER", + "T_LNUMBER", + "T_NULLSAFE_OBJECT_OPERATOR", + "tableselect", + "ungreedy", + "unserialized", + "webform" + ], + // flagWords - list of words to be always considered incorrect + // This is useful for offensive words and common spelling errors. + // For example "hte" should be "the" + "flagWords": [ + "hte" + ] +} diff --git a/.gitattributes b/.gitattributes index 794f62358e79c78e65a25312dd8553aa8e0c72f3..5f558660c4842849413988b3b94f4d11ba5e5097 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ +/.cspell.json export-ignore /.gitattributes export-ignore -/.travis.yml export-ignore /README.md export-ignore /phpcs.xml.dist export-ignore /phpunit.xml.dist export-ignore diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f268ff73499663961e20e45be9eb4d6be9952143..e5bd900a1f4f438c9455a5d05f7554c6896b789c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -62,6 +62,12 @@ jobs: if: ${{ matrix.extra-tests == '1' }} run: ./vendor/bin/phpstan analyse + - name: Run Cspell + if: ${{ matrix.extra-tests == '1' }} + uses: streetsidesoftware/cspell-action@v6 + with: + incremental_files_only: false + - name: Checkout Drupal core if: ${{ matrix.extra-tests == '1' }} uses: actions/checkout@v3 diff --git a/README.md b/README.md index b7493fdfe61c7aed52617798962957ea2a6ec99e..5c5ee20397f6a7f46cf8ae0e92969fb6d7b082c3 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ phpcs.xml.dist file in your project like this: ```xml <?xml version="1.0" encoding="UTF-8"?> -<ruleset name="myproject"> - <description>PHP CodeSniffer configuration for myproject development.</description> +<ruleset name="example"> + <description>PHP CodeSniffer configuration for example development.</description> <!-- Check all files in the current directory and below. --> <file>.</file> <arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/> @@ -139,7 +139,7 @@ Then execute the coding standards checker on Coder itself: Then execute static analysis: - ./vendor/bin/phpstan analyse + ./vendor/bin/phpstan ## Contributing @@ -154,6 +154,8 @@ Thank you! ## Maintainers +[//]: # cspell:ignore Pieter Frenssen Welford + - Pieter Frenssen, https://www.drupal.org/u/pfrenssen - Michael Welford, https://www.drupal.org/u/mikejw - Klaus Purer, https://www.drupal.org/u/klausi diff --git a/coder_sniffer/Drupal/Docs/Functions/FunctionCallArgumentSpacingStandard.xml b/coder_sniffer/Drupal/Docs/Functions/FunctionCallArgumentSpacingStandard.xml deleted file mode 100644 index be6f0cc9847fc1cc3cb28bc2599f2ff2290b7922..0000000000000000000000000000000000000000 --- a/coder_sniffer/Drupal/Docs/Functions/FunctionCallArgumentSpacingStandard.xml +++ /dev/null @@ -1,19 +0,0 @@ -<documentation title="Parameter Spacing in Function Calls"> - <standard> - <![CDATA[ - There must be one space between a comma and a parameter in a function call. - ]]> - </standard> - <code_comparison> - <code title="Valid: spaces between parameters"> - <![CDATA[ -$var = foo($bar<em>, </em>$baz<em>, </em>$quux); - ]]> - </code> - <code title="Invalid: no space between commas and parameters"> - <![CDATA[ -$var = foo($bar<em>,</em>$baz<em>,</em>$quux); - ]]> - </code> - </code_comparison> -</documentation> diff --git a/coder_sniffer/Drupal/Docs/Functions/FunctionCallSignatureStandard.xml b/coder_sniffer/Drupal/Docs/Functions/FunctionCallSignatureStandard.xml deleted file mode 100644 index f87422778e873c943c14fd01f6a9012d83324292..0000000000000000000000000000000000000000 --- a/coder_sniffer/Drupal/Docs/Functions/FunctionCallSignatureStandard.xml +++ /dev/null @@ -1,19 +0,0 @@ -<documentation title="Function Calls"> - <standard> - <![CDATA[ - Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; and no space between the last parameter, the closing parenthesis, and the semicolon. - ]]> - </standard> - <code_comparison> - <code title="Valid: spaces between parameters"> - <![CDATA[ -$var = foo($bar, $baz, $quux); - ]]> - </code> - <code title="Invalid: additional spaces used"> - <![CDATA[ -$var = foo<em> </em>(<em> </em>$bar, $baz, $quux<em> </em>)<em> </em>; - ]]> - </code> - </code_comparison> -</documentation> diff --git a/coder_sniffer/Drupal/Docs/Functions/ValidDefaultValueStandard.xml b/coder_sniffer/Drupal/Docs/Functions/ValidDefaultValueStandard.xml deleted file mode 100644 index 56196cb620d2a26e01ff1e2e03cba8ca85473343..0000000000000000000000000000000000000000 --- a/coder_sniffer/Drupal/Docs/Functions/ValidDefaultValueStandard.xml +++ /dev/null @@ -1,25 +0,0 @@ -<documentation title="Default Values in Function Declarations"> - <standard> - <![CDATA[ - Arguments with default values go at the end of the argument list. - ]]> - </standard> - <code_comparison> - <code title="Valid: argument with default value at end of declaration"> - <![CDATA[ -function connect($dsn, <em>$persistent = false</em>) -{ - ... -} - ]]> - </code> - <code title="Invalid: argument with default value at start of declaration"> - <![CDATA[ -function connect(<em>$persistent = false</em>, $dsn) -{ - ... -} - ]]> - </code> - </code_comparison> -</documentation> diff --git a/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php b/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php index f66bea5b1cb4fac2c20d3a7f0971131f30eec7dc..33d0450c86f289501333d088e0972c663b7a12e6 100644 --- a/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php +++ b/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php @@ -98,7 +98,8 @@ class ClassDefinitionNameSpacingSniff implements Sniff && in_array($tokens[($i - 1)]['code'], [T_WHITESPACE, T_COMMA]) === false ) { $error = 'Selectors must be on a single line'; - $fix = $phpcsFile->addFixableError($error, $i, 'SeletorSingleLine'); + // cspell:ignore SeletorSingleLine + $fix = $phpcsFile->addFixableError($error, $i, 'SeletorSingleLine'); if ($fix === true) { $phpcsFile->fixer->replaceToken($i, str_replace($phpcsFile->eolChar, ' ', $tokens[$i]['content'])); } diff --git a/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php b/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php index 941fbdfbbf974f5d2df14b59413dea443ba7054e..884ddc4ab05f55a6b6a6367ef375fe3c276ac719 100644 --- a/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php +++ b/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php @@ -15,7 +15,7 @@ use PHP_CodeSniffer\Sniffs\Sniff; /** * \Drupal\Sniffs\CSS\ColourDefinitionSniff. * - * Ensure colours are defined in lower-case. + * Ensure colors are defined in lower-case. * * @category PHP * @package PHP_CodeSniffer @@ -56,14 +56,14 @@ class ColourDefinitionSniff implements Sniff public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); - $colour = $tokens[$stackPtr]['content']; + $color = $tokens[$stackPtr]['content']; - $expected = strtolower($colour); - if ($colour !== $expected) { - $error = 'CSS colours must be defined in lowercase; expected %s but found %s'; + $expected = strtolower($color); + if ($color !== $expected) { + $error = 'CSS colors must be defined in lowercase; expected %s but found %s'; $data = [ $expected, - $colour, + $color, ]; $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotLower', $data); if ($fix === true) { diff --git a/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php b/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php index bdf6ec99e1add786cbcd689c4a7d77f72f73f648..0d3889c1d675ebff3b6b116a5693127d52d8ec08 100644 --- a/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php @@ -82,10 +82,10 @@ class ClassDeclarationSniff extends PSR2ClassDeclarationSniff } $previous = $phpcsFile->findPrevious(T_WHITESPACE, ($openingBrace - 1), null, true); - $decalrationLine = $tokens[$previous]['line']; + $declarationLine = $tokens[$previous]['line']; $braceLine = $tokens[$openingBrace]['line']; - $lineDifference = ($braceLine - $decalrationLine); + $lineDifference = ($braceLine - $declarationLine); if ($lineDifference > 0) { $error = 'Opening brace should be on the same line as the declaration'; diff --git a/coder_sniffer/Drupal/Sniffs/Classes/PropertyDeclarationSniff.php b/coder_sniffer/Drupal/Sniffs/Classes/PropertyDeclarationSniff.php index e4fd2427faa3a093b061f4a157df7f81b3fc16f0..67d63e88ff111546b16b0a90952d5725ca3d91d4 100644 --- a/coder_sniffer/Drupal/Sniffs/Classes/PropertyDeclarationSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Classes/PropertyDeclarationSniff.php @@ -14,7 +14,7 @@ use PHP_CodeSniffer\Sniffs\AbstractVariableSniff; use PHP_CodeSniffer\Util\Tokens; /** - * Laregely copied from + * Largely copied from * \PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\PropertyDeclarationSniff to have a fixer * for the var keyword. * diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php index 37923e8c1dfe1cb4d12fe0d8e6447561ebf8c8eb..a0c6bb6c48d090a1e825738150f461d65452656b 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php @@ -17,13 +17,9 @@ use PHP_CodeSniffer\Util\Tokens; * Checks that comment doc blocks exist on classes, interfaces and traits. Largely * copied from PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\ClassCommentSniff. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ class ClassCommentSniff implements Sniff { diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/DeprecatedSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/DeprecatedSniff.php index 4a3a6548c589319aad727d9ec4bf473869db95f7..4628c7e9d205edd3e2b21be792ad1ca34e29a5b2 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/DeprecatedSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/DeprecatedSniff.php @@ -124,6 +124,7 @@ class DeprecatedSniff implements Sniff // automatic fixes for Drupal core, and if the project is missing we are // assuming it is Drupal core. Deprecations for contrib projects are much // less frequent and faults can be corrected manually. + // cspell:ignore xdev preg_match('/^(.*)(as of|in) (drupal|)( |:|)+([\d\.\-xdev\?]+)(,| |. |)(.*)(removed|removal)([ |from|before|in|the]*) (drupal|)( |:|)([\d\-\.xdev]+)( |,|$)+(?:release|)(?:[\.,])*(.*)$/i', $text1, $matchesFix); if (count($matchesFix) >= 12) { diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php index a78342350205c2e66ac2ce9061a39a47856d9008..75b8831123af2003a0e32947b516010987465143 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php @@ -382,7 +382,8 @@ class DocCommentSniff implements Sniff // Break out the tags into groups and check alignment within each. // A tag group is one where there are no blank lines between tags. // The param tag group is special as it requires all @param tags to be inside. - $tagGroups = []; + $tagGroups = []; + // cspell:ignore groupid $groupid = 0; $paramGroupid = null; $currentTag = null; @@ -506,12 +507,12 @@ class DocCommentSniff implements Sniff } }//end foreach - // If there is a param group, it needs to be first; with the exception of - // @code, @todo and link tags. + // If there is a param group, it needs to be first; with the exception + // of @code, @todo and link tags. if ($paramGroupid !== null && $paramGroupid !== 0 && in_array($tokens[$tokens[$commentStart]['comment_tags'][0]]['content'], ['@code', '@todo', '@link', '@endlink', '@codingStandardsIgnoreStart']) === false // In JSDoc we can have many other valid tags like @function or - // @constructor before the param tags. + // tags like @constructor before the param tags. && $phpcsFile->tokenizerType !== 'JS' ) { $error = 'Parameter tags must be defined first in a doc comment'; diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php index bbc6956926eb751b58232633c846a4b584752dfd..72b490d4f41feba069b3d3d4aa7de2275f17995e 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php @@ -57,7 +57,7 @@ class FileCommentSniff implements Sniff $commentStart = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); // Files containing exactly one class, interface or trait are allowed to - // ommit a file doc block. If a namespace is used then the file comment must + // omit a file doc block. If a namespace is used then the file comment must // be omitted. $oopKeyword = $phpcsFile->findNext([T_CLASS, T_INTERFACE, T_TRAIT, T_ENUM], $stackPtr); if ($oopKeyword !== false) { @@ -159,7 +159,7 @@ class FileCommentSniff implements Sniff $next = $phpcsFile->findNext(T_WHITESPACE, ($commentEnd + 1), null, true); // If there is no @file tag and the next line is a function or class - // definition then the file docblock is mising. + // definition then the file docblock is missing. if ($tokens[$next]['line'] === ($tokens[$commentEnd]['line'] + 1) && $tokens[$next]['code'] === T_FUNCTION ) { @@ -225,7 +225,8 @@ class FileCommentSniff implements Sniff && $tokens[$next]['code'] === T_CLOSE_TAG ) { $error = 'There must be no blank line after the file comment in a template'; - $fix = $phpcsFile->addFixableError($error, $commentEnd, 'TeamplateSpacingAfterComment'); + // cspell:ignore TeamplateSpacingAfterComment + $fix = $phpcsFile->addFixableError($error, $commentEnd, 'TeamplateSpacingAfterComment'); if ($fix === true) { $phpcsFile->fixer->beginChangeset(); $uselessLine = ($commentEnd + 1); diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php index 0c665dec80cfab9a9d9da5bf47c75cacafa0c4a7..8db598054a8c832fb8edbbe110fb8ac80d9f0b7b 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php @@ -46,6 +46,7 @@ class FunctionCommentSniff implements Sniff 'Bool' => 'bool', 'Int' => 'int', 'Integer' => 'int', + // cspell:ignore TRUEFALSE 'TRUEFALSE' => 'bool', ]; @@ -440,6 +441,7 @@ class FunctionCommentSniff implements Sniff $comment .= ' '.$tokens[$i]['content']; if ($indent < 3) { $error = 'Throws comment indentation must be 3 spaces, found %s spaces'; + // cspell:ignore TrhowsCommentIndentation $phpcsFile->addError($error, $i, 'TrhowsCommentIndentation', [$indent]); } } @@ -456,7 +458,7 @@ class FunctionCommentSniff implements Sniff return; } - // Starts with a capital letter and ends with a fullstop. + // Starts with a capital letter and ends with a full stop. $firstChar = $comment[0]; if (strtoupper($firstChar) !== $firstChar) { $error = '@throws tag comment must start with a capital letter'; @@ -769,7 +771,7 @@ class FunctionCommentSniff implements Sniff $content .= $param['var']; $content .= str_repeat(' ', $param['var_space']); // At this point there is no description expected in the - // @param line so no need to append comment. + // param line so no need to append comment. $phpcsFile->fixer->replaceToken(($param['tag'] + 2), $content); // Fix up the indent of additional comment lines. diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/HookCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/HookCommentSniff.php index 8d6ac34e6c7400c63a93c914cad91b69703b4494..42882f2af9d8c12e3fb39152461e328c144d9b7b 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/HookCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/HookCommentSniff.php @@ -93,8 +93,8 @@ class HookCommentSniff implements Sniff ) { $phpcsFile->addWarning('Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."', $short, 'HookCommentFormat'); } else { - // Check that a hook implementation does not duplicate @param and - // @return documentation. + // Check that a hook implementation does not duplicate param and + // return documentation. foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) { if ($tokens[$tag]['content'] === '@param') { $warn = 'Hook implementations should not duplicate @param documentation'; diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php index 990a059f8bd09e7faf5e3909705ad3593e420086..3fdb40498cbc80faee5f858312ef60d7102f7697 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php @@ -351,7 +351,7 @@ class InlineCommentSniff implements Sniff // Also, when the comment starts with cspell: don't check the end of the // comment. if (preg_match('/^\p{L}/u', $commentText) === 1 - && preg_match('/(cspell|spell\-checker):ignore/i', $commentText) === 0 + && preg_match('/(cspell|spell\-checker):/i', $commentText) === 0 ) { $commentCloser = $commentText[(strlen($commentText) - 1)]; $acceptedClosers = [ diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php index ef0df2953cc0d80ee68df4b537809dc49b2a89df..bb5200d6283b09a3879bbbd0cc8b0d3ee80e6add 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php @@ -15,7 +15,7 @@ use PHP_CodeSniffer\Sniffs\AbstractVariableSniff; /** * Parses and verifies class property doc comments. * - * Laregely copied from + * Largely copied from * \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\VariableCommentSniff. * * @category PHP diff --git a/coder_sniffer/Drupal/Sniffs/ControlStructures/InlineControlStructureSniff.php b/coder_sniffer/Drupal/Sniffs/ControlStructures/InlineControlStructureSniff.php index ef1fb70a1d4bc757825c7d6174e2d2e7c4413332..90e757cc86a364a2c45819f6bc369dbd9fad72b6 100644 --- a/coder_sniffer/Drupal/Sniffs/ControlStructures/InlineControlStructureSniff.php +++ b/coder_sniffer/Drupal/Sniffs/ControlStructures/InlineControlStructureSniff.php @@ -15,7 +15,7 @@ use PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures\InlineControlStru /** * \Drupal\Sniffs\ControlStructures\InlineControlStructureSniff. * - * Verifies that inline control statements are not present. This Sniff overides + * Verifies that inline control statements are not present. This Sniff overrides * the generic sniff because Drupal template files may use the alternative * syntax for control structures. See * http://www.php.net/manual/en/control-structures.alternative-syntax.php diff --git a/coder_sniffer/Drupal/Sniffs/Files/FileEncodingSniff.php b/coder_sniffer/Drupal/Sniffs/Files/FileEncodingSniff.php index 983365d5c705e83d755a33ef78468ed838ebe2ee..dd3a8747c8607138d7ee1890d2d7dfd2e2ba51c6 100644 --- a/coder_sniffer/Drupal/Sniffs/Files/FileEncodingSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Files/FileEncodingSniff.php @@ -2,12 +2,9 @@ /** * \Drupal\Sniffs\Files\FileEncodingSniff. * - * @category PHP - * @package PHP_CodeSniffer - * @author Klaus Purer <klaus.purer@mail.com> - * @copyright 2016 Klaus Purer - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ namespace Drupal\Sniffs\Files; @@ -20,13 +17,9 @@ use PHP_CodeSniffer\Sniffs\Sniff; * * Validates the encoding of a file against a white list of allowed encodings. * - * @category PHP - * @package PHP_CodeSniffer - * @author Klaus Purer <klaus.purer@mail.com> - * @copyright 2016 Klaus Purer - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ class FileEncodingSniff implements Sniff { diff --git a/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php b/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php index b30b9ea3e29bf7bf65107f62ec68e6a27d47f78f..8a02a790919eeb4cc77ccb253c39d0d5f2098915 100644 --- a/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php @@ -17,13 +17,9 @@ use PHP_CodeSniffer\Sniffs\Sniff; * * If an assignment goes over two lines, ensure the equal sign is indented. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) - * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version Release: 1.2.0RC3 - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ class MultiLineAssignmentSniff implements Sniff { diff --git a/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php b/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php index 5e0a333a06490e05f739826fe9b4f62d4ccd94bd..444bc53b089a3ed1350d5f4df31e6e4c90aaa03c 100644 --- a/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php @@ -27,10 +27,12 @@ class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff * The value is NULL if no alternative exists, i.e., the function should * just not be used. * + * cspell:disable + * * @var array<string, null> */ public $forbiddenFunctions = [ - // Devel module debugging functions. + // Devel module debugging functions. 'dargs' => null, 'dcp' => null, 'dd' => null, @@ -52,11 +54,12 @@ class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff 'kpr' => null, 'kprint_r' => null, 'sdpm' => null, - // Functions which are not available on all - // PHP builds. + // Functions which are not available on all + // PHP builds. 'fnmatch' => null, - // Functions which are a security risk. + // Functions which are a security risk. 'eval' => null, + // cspell:enable ]; /** diff --git a/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php b/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php index 57012d433950ff27b205ef75a9912dc00c1965df..4da942ac85a1ad131b2526254f6a3012c41190d2 100644 --- a/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php +++ b/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php @@ -80,6 +80,7 @@ class ClassFilesSniff implements Sniff $ptr = self::getPtr('files[]', $file, $phpcsFile); $error = "It's only necessary to declare files[] if they declare a class or interface."; + // cspell:ignore UnecessaryFileDeclaration $phpcsFile->addError($error, $ptr, 'UnecessaryFileDeclaration'); }//end foreach }//end if diff --git a/coder_sniffer/Drupal/Sniffs/InfoFiles/DependenciesArraySniff.php b/coder_sniffer/Drupal/Sniffs/InfoFiles/DependenciesArraySniff.php index dca423e30365c7f498c9ad3f6a391d93bb19ba63..2d0f39270e93bad93f6822cf781a443dce7f87a6 100644 --- a/coder_sniffer/Drupal/Sniffs/InfoFiles/DependenciesArraySniff.php +++ b/coder_sniffer/Drupal/Sniffs/InfoFiles/DependenciesArraySniff.php @@ -63,7 +63,7 @@ class DependenciesArraySniff implements Sniff // searching $tokens to find the dependencies item. $tokens = $phpcsFile->getTokens(); // $tokens cannot be empty at this point, but PHPStan 10.1.4 does not know this and gives the error - // "Variable $key might not be defined". So initialise it here. + // "Variable $key might not be defined". So initialize it here. $key = $stackPtr; foreach ($tokens as $key => $token) { if (preg_match('/dependencies\s*\:/', $token['content']) === 1) { diff --git a/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php b/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php index 364b3e20d53db7fc4f7c37e7d286e22d93b595e5..6e0a04eeac14429b813889e33a498b142df36d5a 100644 --- a/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php +++ b/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php @@ -67,7 +67,7 @@ class DuplicateEntrySniff implements Sniff /** - * Parses a Drupal info file and checsk if a key apperas more than once. + * Parses a Drupal info file and checks if a key appears more than once. * * @param string $data The contents of the info file to parse * diff --git a/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php b/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php index 049b7cdcce9ab162610f88dffa8b556ede4f75dd..11ae5f89d08dea60323bafe8fbbde45b610059d2 100644 --- a/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php +++ b/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php @@ -2,13 +2,9 @@ /** * \Drupal\Sniffs\NamingConventions\ValidClassNameSniff. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @author Marc McIntyre <mmcintyre@squiz.net> - * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) - * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ namespace Drupal\Sniffs\NamingConventions; @@ -22,14 +18,9 @@ use PHP_CodeSniffer\Sniffs\Sniff; * Ensures class and interface names start with a capital letter * and do not use _ separators. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @author Marc McIntyre <mmcintyre@squiz.net> - * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) - * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version Release: 1.2.0RC3 - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ class ValidClassNameSniff implements Sniff { diff --git a/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php b/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php index 24ec103b84dd8ce4684ad253444f10b472216c76..a6d128354f524e224f03140695130ebd3a4c932b 100644 --- a/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php @@ -16,7 +16,7 @@ use PHP_CodeSniffer\Util\Tokens; /** * Verifies that class/interface/trait methods have scope modifiers. * - * Laregely copied from + * Largely copied from * \PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MethodScopeSniff to work on * traits and have a fixer. * diff --git a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionAliasSniff.php b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionAliasSniff.php index bafc3c608f676ed114c811f4991e335eb342760f..71d0916d28044b00f19ac9f355fb74236c74de16 100644 --- a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionAliasSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionAliasSniff.php @@ -26,6 +26,8 @@ class FunctionAliasSniff extends FunctionCall * http://php.net/manual/en/aliases.php * * @var array<string, string> + * + * cSpell:disable */ protected $aliases = [ '_' => 'gettext', @@ -159,6 +161,7 @@ class FunctionAliasSniff extends FunctionCall 'snmpwalkoid' => 'snmprealwalk', 'strchr' => 'strstr', 'xptr_new_context' => 'xpath_new_context', + // cspell:enable ]; diff --git a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php index b29e8de9970f74b775e8f5d4b620b821f2f4f69c..2ba729cdcf1629d1182dd5fa511d10dc5de99a1f 100644 --- a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php +++ b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php @@ -190,19 +190,19 @@ abstract class FunctionCall implements Sniff // End token of the last argument. $end = $this->phpcsFile->findPrevious(Tokens::$emptyTokens, ($this->closeBracket - 1), null, true); $lastArgEnd = $end; - $nextSeperator = $this->openBracket; + $nextSeparator = $this->openBracket; $counter = 1; - while (($nextSeperator = $this->phpcsFile->findNext(T_COMMA, ($nextSeperator + 1), $this->closeBracket)) !== false) { + while (($nextSeparator = $this->phpcsFile->findNext(T_COMMA, ($nextSeparator + 1), $this->closeBracket)) !== false) { // Make sure the comma belongs directly to this function call, // and is not inside a nested function call or array. - $brackets = $tokens[$nextSeperator]['nested_parenthesis']; + $brackets = $tokens[$nextSeparator]['nested_parenthesis']; $lastBracket = array_pop($brackets); if ($lastBracket !== $this->closeBracket) { continue; } // Update the end token of the current argument. - $end = $this->phpcsFile->findPrevious(Tokens::$emptyTokens, ($nextSeperator - 1), null, true); + $end = $this->phpcsFile->findPrevious(Tokens::$emptyTokens, ($nextSeparator - 1), null, true); // Save the calculated findings for the current argument. $this->arguments[$counter] = [ 'start' => $start, @@ -213,7 +213,7 @@ abstract class FunctionCall implements Sniff } $counter++; - $start = $this->phpcsFile->findNext(Tokens::$emptyTokens, ($nextSeperator + 1), null, true); + $start = $this->phpcsFile->findNext(Tokens::$emptyTokens, ($nextSeparator + 1), null, true); $end = $lastArgEnd; }//end while diff --git a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php index 4da9955f0b0a55ffa8030e304e45c02f765b9e32..3dd365af9433d3b98a488e8005a0660b66ce7f47 100644 --- a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php @@ -13,7 +13,7 @@ use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Util\Tokens; /** - * Check the usage of the t() function to not escape translateable strings with back + * Check the usage of the t() function to not escape translatable strings with back * slashes. Also checks that the first argument does not use string concatenation. * * @category PHP diff --git a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTriggerErrorSniff.php b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTriggerErrorSniff.php index ec03aa6165e8f9ea629c5fd3364775ac55fff1fd..9c1f98ab2b7404f652eafc0829be441d70fa039f 100644 --- a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTriggerErrorSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTriggerErrorSniff.php @@ -1,6 +1,6 @@ <?php /** - * \Drupal\Sniffs\Semanitcs\FunctionTriggerErrorSniff. + * \Drupal\Sniffs\Semantics\FunctionTriggerErrorSniff. * * @category PHP * @package PHP_CodeSniffer diff --git a/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php b/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php index d96dfa462836247796363520f6e2ee240744b998..8603d9f4ced279fc455ac86a7d9888e1020f35ac 100644 --- a/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php @@ -2,12 +2,9 @@ /** * \Drupal\Sniffs\Strings\UnnecessaryStringConcatSniff. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ namespace Drupal\Sniffs\Strings; @@ -20,12 +17,9 @@ use PHP_CodeSniffer\Util\Tokens; /** * Checks that two strings are not concatenated together; suggests using one string instead. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ class UnnecessaryStringConcatSniff extends GenericUnnecessaryStringConcatSniff { @@ -81,8 +75,8 @@ class UnnecessaryStringConcatSniff extends GenericUnnecessaryStringConcatSniff // the line length limit. $lineLengthLimitSniff = new LineLengthSniff; - $lineLenght = $lineLengthLimitSniff->getLineLength($phpcsFile, $tokens[$prev]['line']); - $stringLength = ($lineLenght + strlen($tokens[$next]['content']) - 4); + $lineLength = $lineLengthLimitSniff->getLineLength($phpcsFile, $tokens[$prev]['line']); + $stringLength = ($lineLength + strlen($tokens[$next]['content']) - 4); if ($stringLength > $lineLengthLimitSniff->lineLimit) { return; } diff --git a/coder_sniffer/Drupal/Sniffs/WhiteSpace/NamespaceSniff.php b/coder_sniffer/Drupal/Sniffs/WhiteSpace/NamespaceSniff.php index bbc3e56f05e7efc499e863dd4cf5a7c5dd1e688a..8d121a712e84556ab188090c6fc48178e6950fb4 100644 --- a/coder_sniffer/Drupal/Sniffs/WhiteSpace/NamespaceSniff.php +++ b/coder_sniffer/Drupal/Sniffs/WhiteSpace/NamespaceSniff.php @@ -49,7 +49,7 @@ class NamespaceSniff implements Sniff $tokens = $phpcsFile->getTokens(); if ($tokens[($stackPtr + 1)]['content'] !== ' ') { - $error = 'There must be exactly one space after the namepace keyword'; + $error = 'There must be exactly one space after the namespace keyword'; $fix = $phpcsFile->addFixableError($error, ($stackPtr + 1), 'OneSpace'); if ($fix === true) { $phpcsFile->fixer->replaceToken(($stackPtr + 1), ' '); diff --git a/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php b/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php index cc2244e24189aac62e302dfd576c308bfdb15a66..3ca059dff04ebfbf460b4da075689010f33ee40c 100644 --- a/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php @@ -2,12 +2,9 @@ /** * \Drupal\Sniffs\WhiteSpace\ObjectOperatorIndentSniff. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) - * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ namespace Drupal\Sniffs\WhiteSpace; @@ -22,13 +19,9 @@ use PHP_CodeSniffer\Util\Tokens; * Checks that object operators are indented 2 spaces if they are the first * thing on a line. * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood <gsherwood@squiz.net> - * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) - * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version Release: 1.2.0RC3 - * @link http://pear.php.net/package/PHP_CodeSniffer + * @category PHP + * @package PHP_CodeSniffer + * @link http://pear.php.net/package/PHP_CodeSniffer */ class ObjectOperatorIndentSniff implements Sniff { @@ -94,7 +87,7 @@ class ObjectOperatorIndentSniff implements Sniff } // Closing parenthesis can be indented in several ways, so rather use the - // line that opended the parenthesis. + // line that opened the parenthesis. if ($tokens[$startOfLine]['code'] === T_CLOSE_PARENTHESIS) { $startOfLine = $this->findStartOfline($phpcsFile, $tokens[$startOfLine]['parenthesis_opener']); } diff --git a/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php b/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php index 74538a9bac11dea6455355376de73c82c4f76d26..0ac20d1f120df455eecef2d810aa4762f88d8262 100644 --- a/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php +++ b/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php @@ -57,7 +57,7 @@ class OpenTagNewlineSniff implements Sniff $next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); - // If there is no furhter content in this file ignore it. + // If there is no further content in this file ignore it. if ($next === false) { return ($phpcsFile->numTokens + 1); } diff --git a/coder_sniffer/Drupal/ruleset.xml b/coder_sniffer/Drupal/ruleset.xml index a1aa2e3219bae464987c4f24c2b0e3acdee862b1..0aced327e736464516f104c02e588165efc2fdda 100644 --- a/coder_sniffer/Drupal/ruleset.xml +++ b/coder_sniffer/Drupal/ruleset.xml @@ -32,7 +32,7 @@ <rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis"> <severity>0</severity> </rule> - <!-- Silence mmethod name underscore warning which is coverd already in + <!-- Silence method name underscore warning which is covered already in Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps. --> <rule ref="Drupal.Methods.MethodDeclaration.Underscore"> <severity>0</severity> diff --git a/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php b/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php index 81240893c9d0f0c9edc821874ad4324d3e8b34bd..31f915c7cd3b38ba5df2200a4260ae0d9ab59b04 100644 --- a/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php +++ b/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php @@ -13,7 +13,7 @@ use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; /** - * Checks that the PHPunit @expectedExcpetion tags are not used. + * Checks that the PHPunit @expectedException tags are not used. * * See https://thephp.cc/news/2016/02/questioning-phpunit-best-practices . * diff --git a/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/FormErrorTSniff.php b/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/FormErrorTSniff.php index a60e263e2e7f8bc52fe97f8341b29396abd3e591..b859f8927ec7d354629d41fa358021ff125f977c 100644 --- a/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/FormErrorTSniff.php +++ b/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/FormErrorTSniff.php @@ -13,7 +13,7 @@ use PHP_CodeSniffer\Files\File; use Drupal\Sniffs\Semantics\FunctionCall; /** - * Verifiies that messages passed to form_set_error() run through t(). + * Verifies that messages passed to form_set_error() run through t(). * * @category PHP * @package PHP_CodeSniffer diff --git a/coder_sniffer/DrupalPractice/Sniffs/FunctionDefinitions/AccessHookMenuSniff.php b/coder_sniffer/DrupalPractice/Sniffs/FunctionDefinitions/AccessHookMenuSniff.php index d226441e6c32cfb96f113a034304c8b4fb9aaf4e..ead9dc286231a22c1efec56c9ca9d06b56af92d1 100644 --- a/coder_sniffer/DrupalPractice/Sniffs/FunctionDefinitions/AccessHookMenuSniff.php +++ b/coder_sniffer/DrupalPractice/Sniffs/FunctionDefinitions/AccessHookMenuSniff.php @@ -49,7 +49,7 @@ class AccessHookMenuSniff extends FunctionDefinition return; } - // Search for 'access callabck' => TRUE in the function body. + // Search for 'access callback' => TRUE in the function body. $string = $phpcsFile->findNext( T_CONSTANT_ENCAPSED_STRING, $tokens[$functionPtr]['scope_opener'], diff --git a/coder_sniffer/DrupalPractice/Sniffs/General/OptionsTSniff.php b/coder_sniffer/DrupalPractice/Sniffs/General/OptionsTSniff.php index 72c8d605a925b6b6f4c5085648e697ad7e09746b..3dd881a9f7a823eedf2d8514ac072f343b8dd069 100644 --- a/coder_sniffer/DrupalPractice/Sniffs/General/OptionsTSniff.php +++ b/coder_sniffer/DrupalPractice/Sniffs/General/OptionsTSniff.php @@ -127,6 +127,7 @@ class OptionsTSniff implements Sniff $afterValue = $phpcsFile->findNext(T_WHITESPACE, ($arrayValue + 1), $statementEnd, true); if ($tokens[$afterValue]['code'] === T_COMMA || $tokens[$afterValue]['code'] === T_CLOSE_PARENTHESIS) { $warning = '#options values usually have to run through t() for translation'; + // cspell:ignore TforValue $phpcsFile->addWarning($warning, $arrayValue, 'TforValue'); } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 32baa4da6f9db836076ae9f38c10b1aa54f3b9ca..5c26d17e67be791bf87b6b9677c2f55f9da03545 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -38,7 +38,6 @@ <rule ref="Squiz.Commenting.BlockComment"/> <rule ref="Squiz.Commenting.DocCommentAlignment"/> <rule ref="Squiz.Commenting.EmptyCatchComment"/> - <rule ref="Squiz.Commenting.InlineComment"/> <rule ref="Squiz.Commenting.LongConditionClosingComment"/> <rule ref="Squiz.Commenting.PostStatementComment"/> <rule ref="Squiz.Commenting.VariableComment"/> @@ -156,5 +155,6 @@ <!-- Additional rules from Drupal that we want. --> <rule ref="coder_sniffer/Drupal/Sniffs/Classes/UnusedUseStatementSniff.php"/> + <rule ref="coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php"/> </ruleset>