Skip to content

Commit 4b4ed2f

Browse files
committed
PHPStan level 5.
1 parent cc7d5bb commit 4b4ed2f

7 files changed

+8
-8
lines changed

PSR2R/Sniffs/Commenting/InlineDocBlockSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ protected function checkInlineComments(File $phpCsFile, $startIndex, $endIndex)
165165
* @param array $tokens
166166
* @param int $from
167167
* @param int $to
168-
* @param int $tagType
168+
* @param string $tagType
169169
*
170170
* @return int|null
171171
*/

PSR2R/Sniffs/ControlStructures/ConditionalExpressionOrderSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function applyFix(File $phpCsFile,
185185
/**
186186
* @param array $token
187187
*
188-
* @return int
188+
* @return string
189189
*/
190190
protected function getComparisonValue(array $token) {
191191
$comparisonIndexValue = $token['content'];
@@ -200,7 +200,7 @@ protected function getComparisonValue(array $token) {
200200
$comparisonIndexValue = $mapping[$token['code']];
201201
}
202202

203-
return (int)$comparisonIndexValue;
203+
return $comparisonIndexValue;
204204
}
205205

206206
}

PSR2R/Sniffs/ControlStructures/ControlStructureSpacingSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function process(File $phpcsFile, $stackPtr) {
101101
$spaceBeforeClose = strlen(ltrim($tokens[$parenCloser - 1]['content'], $phpcsFile->eolChar));
102102
}
103103

104-
$phpcsFile->recordMetric($stackPtr, 'Spaces before control structure close parenthesis', $spaceBeforeClose);
104+
$phpcsFile->recordMetric($stackPtr, 'Spaces before control structure close parenthesis', (string)$spaceBeforeClose);
105105

106106
if ($spaceBeforeClose !== $this->requiredSpacesBeforeClose) {
107107
$error = 'Expected %s spaces before closing bracket; %s found';

PSR2R/Sniffs/Files/EndFileNewlineSniff.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

6969
$lastCodeLine = $tokens[$lastCode]['line'];
7070
$blankLines = ($lastLine - $lastCodeLine + 1);
71-
$phpcsFile->recordMetric($stackPtr, 'Number of newlines at EOF', $blankLines);
71+
$phpcsFile->recordMetric($stackPtr, 'Number of newlines at EOF', (string)$blankLines);
7272

7373
if ($blankLines > 1) {
7474
$error = 'Expected 1 blank line at end of file; %s found';

PSR2R/Sniffs/Namespaces/NoInlineFullyQualifiedClassNameSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ protected function generateUniqueAlias($shortName, $fullName) {
374374
$alias = $shortName;
375375

376376
/** @noinspection PhpParamsInspection */
377-
if (count($pieces) - 1 < $count && !in_array($pieces, 'Php', true)) {
377+
if (count($pieces) - 1 < $count && !in_array('Php', $pieces, true)) {
378378
$pieces[] = 'Php';
379379
}
380380
if (count($pieces) - 1 < $count) {

PSR2R/Tools/AbstractSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class AbstractSniff implements Sniff {
1818
* Checks if the given token scope contains a single or multiple token codes/types.
1919
*
2020
* @param \PHP_CodeSniffer\Files\File $phpcsFile
21-
* @param string|array $search
21+
* @param string|int|array $search
2222
* @param int $start
2323
* @param int $end
2424
* @param bool $skipNested

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"test-setup": "[ ! -f phpunit.phar ] && wget https://phar.phpunit.de/phpunit-5.7.phar && mv phpunit-5.7.phar phpunit.phar || true",
4040
"test-setup-mac": "[ ! -f phpunit.phar ] && curl -OL https://phar.phpunit.de/phpunit-5.7.phar && mv phpunit-5.7.phar phpunit.phar || true",
4141
"test-coverage": "php phpunit.phar --log-junit tmp/coverage/unitreport.xml --coverage-html tmp/coverage --coverage-clover tmp/coverage/coverage.xml",
42-
"phpstan": "phpstan analyse -c tests/phpstan.neon -l 4 PSR2R/",
42+
"phpstan": "phpstan analyse -c tests/phpstan.neon -l 5 PSR2R/",
4343
"phpstan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json"
4444
}
4545
}

0 commit comments

Comments
 (0)