Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static function determineLoadedClass($classesBeforeLoad, $classesAfterLoa
// That way, at the end, only the "main" class just included will remain.
$newClasses = array_reduce(
$newClasses,
function ($remaining, $current) {
static function ($remaining, $current) {
return array_diff($remaining, class_parents($current));
},
$newClasses
Expand Down
2 changes: 1 addition & 1 deletion src/Reports/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function generate(

uksort(
$reportFiles,
function ($keyA, $keyB) {
static function ($keyA, $keyB) {
$pathPartsA = explode(DIRECTORY_SEPARATOR, $keyA);
$pathPartsB = explode(DIRECTORY_SEPARATOR, $keyB);

Expand Down
22 changes: 11 additions & 11 deletions src/Sniffs/AbstractPatternSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,17 @@ protected function registerSupplementary()
}//end registerSupplementary()


/**
* Processes any tokens registered with registerSupplementary().
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where to
* process the skip.
* @param int $stackPtr The position in the tokens stack to
* process.
*
* @return void
* @see registerSupplementary()
*/
/**
* Processes any tokens registered with registerSupplementary().
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where to
* process the skip.
* @param int $stackPtr The position in the tokens stack to
* process.
*
* @return void
* @see registerSupplementary()
*/
protected function processSupplementary(File $phpcsFile, $stackPtr)
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)

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

$return = null;
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)

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

if ($return !== null) {
$content = $tokens[($return + 2)]['content'];
Expand Down Expand Up @@ -781,7 +781,7 @@ protected function checkInheritdoc(File $phpcsFile, $stackPtr, $commentStart)
T_DOC_COMMENT_STAR,
];
for ($i = $commentStart; $i <= $tokens[$commentStart]['comment_closer']; $i++) {
if (in_array($tokens[$i]['code'], $allowedTokens) === false) {
if (in_array($tokens[$i]['code'], $allowedTokens, true) === false) {
$trimmedContent = strtolower(trim($tokens[$i]['content']));

if ($trimmedContent === '{@inheritdoc}') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
return;
}

// Support both a var type and a description.
// Support both a var type and a description.
preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9\[\]]+))*)( .*)?`i', $tokens[($foundVar + 2)]['content'], $varParts);
if (isset($varParts[1]) === false) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function process(File $phpcsFile, $stackPtr)
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public function process(File $phpcsFile, $stackPtr)
$nextContent = $phpcsFile->findNext(T_WHITESPACE, ($openBrace + 1), null, true);

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

Expand Down
2 changes: 1 addition & 1 deletion src/Util/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function load(Ruleset $ruleset, Config $config)
);
$filter = new RecursiveCallbackFilterIterator(
$di,
function ($file, $key, $iterator) {
static function ($file, $key, $iterator) {
// Skip non-php files.
$filename = $file->getFilename();
if ($file->isFile() === true && substr($filename, -4) !== '.php') {
Expand Down
2 changes: 1 addition & 1 deletion src/Util/MessageCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private function arrayColumn(array $input, $columnKey)
}

// PHP 5.4.
$callback = function ($row) use ($columnKey) {
$callback = static function ($row) use ($columnKey) {
return $row[$columnKey];
};

Expand Down
8 changes: 4 additions & 4 deletions tests/Core/Tokenizers/PHP/DNFTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,16 @@ public static function dataDNFTypeParentheses()
'testMarker' => '/* testDNFTypeWithPHP84FinalKeywordAndStatic */',
],
'OO property type: asymmetric visibility, private(set)' => [
'testMarker' => '/* testDNFTypePropertyWithPrivateSet */',
'testMarker' => '/* testDNFTypePropertyWithPrivateSet */',
],
'OO property type: asymmetric vis, public private(set)' => [
'testMarker' => '/* testDNFTypePropertyWithPublicPrivateSet */',
'testMarker' => '/* testDNFTypePropertyWithPublicPrivateSet */',
],
'OO property type: asymmetric visibility, protected(set)' => [
'testMarker' => '/* testDNFTypePropertyWithProtectedSet */',
'testMarker' => '/* testDNFTypePropertyWithProtectedSet */',
],
'OO property type: asymmetric vis, public protected(set)' => [
'testMarker' => '/* testDNFTypePropertyWithPublicProtectedSet */',
'testMarker' => '/* testDNFTypePropertyWithPublicProtectedSet */',
],
'OO property type: with only abstract keyword' => [
'testMarker' => '/* testDNFTypeWithPHP84AbstractKeyword */',
Expand Down
Loading