Skip to content

Commit 7078972

Browse files
authored
Allow squizlabs/php_codesniffer ^4.0 (#76)
* Allow squizlabs/php_codesniffer ^4.0 * Ditch 3.x * Rector * Fix PHPStan errors * Fix PHPStan
1 parent 55c4ce3 commit 7078972

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"require-dev": {
1111
"symplify/easy-coding-standard": "^12.5",
12-
"squizlabs/php_codesniffer": "^3.12",
12+
"squizlabs/php_codesniffer": "^4.0",
1313
"phpunit/phpunit": "^11.5",
1414
"phpstan/extension-installer": "^1.4",
1515
"phpstan/phpstan": "^2.1",

phpstan.neon

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ parameters:
2727
message: '#Comparison operation ">\=" between int<80200, 80599> and (.*?) is always true#'
2828
path: src/TokenAnalyzer/DocblockRelatedParamNamesResolver.php
2929

30-
# offset access issues
31-
-
32-
message: '#Offset int\|null might not exist on PhpCsFixer\\Tokenizer\\Tokens#'
33-
path: src/Fixer/Naming/ClassNameResolver.php
34-
35-
-
36-
message: '#Offset int\|null might not exist on PhpCsFixer\\Tokenizer\\Tokens#'
37-
path: src/Fixer/Naming/MethodNameResolver.php
38-
3930
# array filter issue
4031
-
4132
message: '#Parameter \#1 \$array \(array<int, PhpCsFixer\\Tokenizer\\Token>\) to function array_filter does not contain falsy values, the array will always stay the same#'

src/Fixer/Naming/ClassNameResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ private function resolveFromTokens(Tokens $tokens): ?string
4545
}
4646

4747
$nextNextMeaningfulTokenIndex = $tokens->getNextMeaningfulToken($position + 1);
48+
49+
if (null === $nextNextMeaningfulTokenIndex) {
50+
continue;
51+
}
52+
4853
$nextNextMeaningfulToken = $tokens[$nextNextMeaningfulTokenIndex];
4954

5055
// skip anonymous classes

src/Fixer/Naming/MethodNameResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public function resolve(Tokens $tokens, int $currentPosition): ?string
2424
}
2525

2626
$nextNextMeaningfulTokenIndex = $tokens->getNextMeaningfulToken($position + 1);
27+
28+
if (null === $nextNextMeaningfulTokenIndex) {
29+
continue;
30+
}
31+
2732
$nextNextMeaningfulToken = $tokens[$nextNextMeaningfulTokenIndex];
2833

2934
// skip anonymous functions

0 commit comments

Comments
 (0)