Skip to content

Commit

Permalink
phpcs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
klausi committed Aug 4, 2024
1 parent cf16071 commit 2ecd3df
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public function process(File $phpcsFile, $stackPtr)
&& in_array($tokens[($i - 1)]['code'], [T_WHITESPACE, T_COMMA]) === false
) {
$error = 'Selectors must be on a single line';
// cspell:ignore SeletorSingleLine
$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']));
}
Expand Down
2 changes: 1 addition & 1 deletion coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function register()
public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$color = $tokens[$stackPtr]['content'];
$color = $tokens[$stackPtr]['content'];

$expected = strtolower($color);
if ($color !== $expected) {
Expand Down
6 changes: 3 additions & 3 deletions coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* 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
* @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
{
Expand Down
2 changes: 1 addition & 1 deletion coder_sniffer/Drupal/Sniffs/Commenting/DeprecatedSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function process(File $phpcsFile, $stackPtr)
// 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
// 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) {
Expand Down
4 changes: 2 additions & 2 deletions coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ public function process(File $phpcsFile, $stackPtr)
// 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 = [];
// cspell:ignore groupid
$tagGroups = [];
// Cspell:ignore groupid .
$groupid = 0;
$paramGroupid = null;
$currentTag = null;
Expand Down
4 changes: 2 additions & 2 deletions coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ public function process(File $phpcsFile, $stackPtr)
&& $tokens[$next]['code'] === T_CLOSE_TAG
) {
$error = 'There must be no blank line after the file comment in a template';
// cspell:ignore TeamplateSpacingAfterComment
$fix = $phpcsFile->addFixableError($error, $commentEnd, 'TeamplateSpacingAfterComment');
// Cspell:ignore TeamplateSpacingAfterComment .
$fix = $phpcsFile->addFixableError($error, $commentEnd, 'TeamplateSpacingAfterComment');
if ($fix === true) {
$phpcsFile->fixer->beginChangeset();
$uselessLine = ($commentEnd + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FunctionCommentSniff implements Sniff
/**
* A map of invalid data types to valid ones for param and return documentation.
*
* cspell:ignore TRUEFALSE
* Cspell:ignore TRUEFALSE
*
* @var array<string, string>
*/
Expand Down Expand Up @@ -442,7 +442,7 @@ protected function processThrows(File $phpcsFile, $stackPtr, $commentStart)
$comment .= ' '.$tokens[$i]['content'];
if ($indent < 3) {
$error = 'Throws comment indentation must be 3 spaces, found %s spaces';
// cspell:ignore TrhowsCommentIndentation
// Cspell:ignore TrhowsCommentIndentation .
$phpcsFile->addError($error, $i, 'TrhowsCommentIndentation', [$indent]);
}
}
Expand Down
12 changes: 6 additions & 6 deletions coder_sniffer/Drupal/Sniffs/Files/FileEncodingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/**
* \Drupal\Sniffs\Files\FileEncodingSniff.
*
* @category PHP
* @package PHP_CodeSniffer
* @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;
Expand All @@ -17,9 +17,9 @@
*
* Validates the encoding of a file against a white list of allowed encodings.
*
* @category PHP
* @package PHP_CodeSniffer
* @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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*
* If an assignment goes over two lines, ensure the equal sign is indented.
*
* @category PHP
* @package PHP_CodeSniffer
* @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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff
* The value is NULL if no alternative exists, i.e., the function should
* just not be used.
*
* cSpell:disable
* cspell:disable
*
* @var array<string, null>
*/
Expand Down Expand Up @@ -59,7 +59,7 @@ class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff
'fnmatch' => null,
// Functions which are a security risk.
'eval' => null,
// cSpell:enable
// Cspell:enable .
];

/**
Expand Down
2 changes: 1 addition & 1 deletion coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function process(File $phpcsFile, $stackPtr)

$ptr = self::getPtr('files[]', $file, $phpcsFile);
$error = "It's only necessary to declare files[] if they declare a class or interface.";
// cspell:ignore UnecessaryFileDeclaration
// Cspell:ignore UnecessaryFileDeclaration .
$phpcsFile->addError($error, $ptr, 'UnecessaryFileDeclaration');
}//end foreach
}//end if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/**
* \Drupal\Sniffs\NamingConventions\ValidClassNameSniff.
*
* @category PHP
* @package PHP_CodeSniffer
* @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;
Expand All @@ -18,9 +18,9 @@
* Ensures class and interface names start with a capital letter
* and do not use _ separators.
*
* @category PHP
* @package PHP_CodeSniffer
* @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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class FunctionAliasSniff extends FunctionCall
/**
* Returns an array of function names this test wants to listen for.
*
* cSpell:enable
* Cspell:enable
*
* @return array<string>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/**
* \Drupal\Sniffs\Strings\UnnecessaryStringConcatSniff.
*
* @category PHP
* @package PHP_CodeSniffer
* @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;
Expand All @@ -17,9 +17,9 @@
/**
* Checks that two strings are not concatenated together; suggests using one string instead.
*
* @category PHP
* @package PHP_CodeSniffer
* @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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/**
* \Drupal\Sniffs\WhiteSpace\ObjectOperatorIndentSniff.
*
* @category PHP
* @package PHP_CodeSniffer
* @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;
Expand All @@ -19,9 +19,9 @@
* Checks that object operators are indented 2 spaces if they are the first
* thing on a line.
*
* @category PHP
* @package PHP_CodeSniffer
* @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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function process(File $phpcsFile, $stackPtr)
$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
// Cspell:ignore TforValue .
$phpcsFile->addWarning($warning, $arrayValue, 'TforValue');
}
}
Expand Down

0 comments on commit 2ecd3df

Please sign in to comment.