Skip to content

Commit cb59397

Browse files
authored
Merge pull request #1232 from PHPCSStandards/feature/various-minor-cs-fixes
CS: various minor fixes
2 parents 379692d + e82c8a1 commit cb59397

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public static function determineLoadedClass($classesBeforeLoad, $classesAfterLoa
210210
// That way, at the end, only the "main" class just included will remain.
211211
$newClasses = array_reduce(
212212
$newClasses,
213-
function ($remaining, $current) {
213+
static function ($remaining, $current) {
214214
return array_diff($remaining, class_parents($current));
215215
},
216216
$newClasses

src/Reports/Summary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function generate(
9898

9999
uksort(
100100
$reportFiles,
101-
function ($keyA, $keyB) {
101+
static function ($keyA, $keyB) {
102102
$pathPartsA = explode(DIRECTORY_SEPARATOR, $keyA);
103103
$pathPartsB = explode(DIRECTORY_SEPARATOR, $keyB);
104104

src/Sniffs/AbstractPatternSniff.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -744,17 +744,17 @@ protected function registerSupplementary()
744744
}//end registerSupplementary()
745745

746746

747-
/**
748-
* Processes any tokens registered with registerSupplementary().
749-
*
750-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where to
751-
* process the skip.
752-
* @param int $stackPtr The position in the tokens stack to
753-
* process.
754-
*
755-
* @return void
756-
* @see registerSupplementary()
757-
*/
747+
/**
748+
* Processes any tokens registered with registerSupplementary().
749+
*
750+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where to
751+
* process the skip.
752+
* @param int $stackPtr The position in the tokens stack to
753+
* process.
754+
*
755+
* @return void
756+
* @see registerSupplementary()
757+
*/
758758
protected function processSupplementary(File $phpcsFile, $stackPtr)
759759
{
760760

src/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)
195195

196196
// Skip constructor and destructor.
197197
$methodName = $phpcsFile->getDeclarationName($stackPtr);
198-
$isSpecialMethod = in_array($methodName, $this->specialMethods, true);
198+
$isSpecialMethod = in_array($methodName, $this->specialMethods, true);
199199

200200
$return = null;
201201
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {

src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)
6767

6868
// Skip constructor and destructor.
6969
$methodName = $phpcsFile->getDeclarationName($stackPtr);
70-
$isSpecialMethod = in_array($methodName, $this->specialMethods, true);
70+
$isSpecialMethod = in_array($methodName, $this->specialMethods, true);
7171

7272
if ($return !== null) {
7373
$content = $tokens[($return + 2)]['content'];
@@ -781,7 +781,7 @@ protected function checkInheritdoc(File $phpcsFile, $stackPtr, $commentStart)
781781
T_DOC_COMMENT_STAR,
782782
];
783783
for ($i = $commentStart; $i <= $tokens[$commentStart]['comment_closer']; $i++) {
784-
if (in_array($tokens[$i]['code'], $allowedTokens) === false) {
784+
if (in_array($tokens[$i]['code'], $allowedTokens, true) === false) {
785785
$trimmedContent = strtolower(trim($tokens[$i]['content']));
786786

787787
if ($trimmedContent === '{@inheritdoc}') {

src/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
127127
return;
128128
}
129129

130-
// Support both a var type and a description.
130+
// Support both a var type and a description.
131131
preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9\[\]]+))*)( .*)?`i', $tokens[($foundVar + 2)]['content'], $varParts);
132132
if (isset($varParts[1]) === false) {
133133
return;

src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function process(File $phpcsFile, $stackPtr)
6868
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
6969

7070
// Allow for PHP 8.4+ fully qualified use of exit/die.
71-
if ($tokens[$stackPtr]['code'] === \T_EXIT && $tokens[$prev]['code'] === \T_NS_SEPARATOR) {
71+
if ($tokens[$stackPtr]['code'] === T_EXIT && $tokens[$prev]['code'] === T_NS_SEPARATOR) {
7272
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true);
7373
}
7474

src/Standards/Squiz/Sniffs/WhiteSpace/FunctionOpeningBraceSpaceSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public function process(File $phpcsFile, $stackPtr)
6363
$nextContent = $phpcsFile->findNext(T_WHITESPACE, ($openBrace + 1), null, true);
6464

6565
if ($nextContent === $tokens[$stackPtr]['scope_closer']) {
66-
// The next bit of content is the closing brace, so this
67-
// is an empty function and should have a blank line
68-
// between the opening and closing braces.
66+
// The next bit of content is the closing brace, so this
67+
// is an empty function and should have a blank line
68+
// between the opening and closing braces.
6969
return;
7070
}
7171

src/Util/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static function load(Ruleset $ruleset, Config $config)
105105
);
106106
$filter = new RecursiveCallbackFilterIterator(
107107
$di,
108-
function ($file, $key, $iterator) {
108+
static function ($file, $key, $iterator) {
109109
// Skip non-php files.
110110
$filename = $file->getFilename();
111111
if ($file->isFile() === true && substr($filename, -4) !== '.php') {

src/Util/MessageCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private function arrayColumn(array $input, $columnKey)
298298
}
299299

300300
// PHP 5.4.
301-
$callback = function ($row) use ($columnKey) {
301+
$callback = static function ($row) use ($columnKey) {
302302
return $row[$columnKey];
303303
};
304304

0 commit comments

Comments
 (0)