diff --git a/src/PhpCs/FiveLab/PhpCsUtils.php b/src/PhpCs/FiveLab/PhpCsUtils.php index 91f6b9d..763f1b0 100644 --- a/src/PhpCs/FiveLab/PhpCsUtils.php +++ b/src/PhpCs/FiveLab/PhpCsUtils.php @@ -63,7 +63,7 @@ public static function getDiffLines(File $file, int $fromPtr, int $toPtr): int $diffLines++; } elseif (\in_array($token['code'], Tokens::COMMENT_TOKENS, true)) { if ($token['code'] === T_DOC_COMMENT_OPEN_TAG) { - $i = $file->findNext([T_DOC_COMMENT_CLOSE_TAG], $i + 1); + $i = (int) $file->findNext([T_DOC_COMMENT_CLOSE_TAG], $i + 1); } elseif ($token['code'] === T_COMMENT) { $tokensOnLine = self::getTokensOnLine($file, $token['line']); $existCodeOnLine = false; diff --git a/src/PhpCs/FiveLab/Sniffs/Formatting/TypedConstantsSniff.php b/src/PhpCs/FiveLab/Sniffs/Formatting/TypedConstantsSniff.php index 5f3fad8..caa10c3 100644 --- a/src/PhpCs/FiveLab/Sniffs/Formatting/TypedConstantsSniff.php +++ b/src/PhpCs/FiveLab/Sniffs/Formatting/TypedConstantsSniff.php @@ -31,10 +31,6 @@ public function register(): array public function process(File $phpcsFile, mixed $stackPtr): void { - if (PHP_VERSION_ID < 80300) { - return; - } - $tokens = $phpcsFile->getTokens(); if (T_STRING === $tokens[$stackPtr + 2]['code'] && T_STRING === $tokens[$stackPtr + 4]['code']) { diff --git a/src/PhpCs/FiveLab/Sniffs/Formatting/UnusedImportsSniff.php b/src/PhpCs/FiveLab/Sniffs/Formatting/UnusedImportsSniff.php index d70c933..620471d 100644 --- a/src/PhpCs/FiveLab/Sniffs/Formatting/UnusedImportsSniff.php +++ b/src/PhpCs/FiveLab/Sniffs/Formatting/UnusedImportsSniff.php @@ -50,7 +50,7 @@ public function process(File $phpcsFile, mixed $stackPtr): void return; } - $currentStackPtr = $phpcsFile->findNext(T_SEMICOLON, $stackPtr); + $currentStackPtr = (int) $phpcsFile->findNext(T_SEMICOLON, $stackPtr); $import = $tokens[$currentStackPtr - 1]['content']; @@ -59,7 +59,7 @@ public function process(File $phpcsFile, mixed $stackPtr): void $importStackPtr = $stackPtr; - while ($currentStackPtr = $phpcsFile->findNext(T_USE, ++$currentStackPtr)) { + while ($currentStackPtr = (int) $phpcsFile->findNext(T_USE, ++$currentStackPtr)) { if (1 === $tokens[$currentStackPtr]['column'] && 0 === $tokens[$currentStackPtr]['level']) { $importStackPtr = $currentStackPtr; } @@ -82,7 +82,7 @@ public function process(File $phpcsFile, mixed $stackPtr): void return; } - $pos++; + $pos = (int) $pos + 1; } } diff --git a/src/PhpStan/ForbiddenNodeTypeRule.php b/src/PhpStan/ForbiddenNodeTypeRule.php index 8bbb074..19836c5 100644 --- a/src/PhpStan/ForbiddenNodeTypeRule.php +++ b/src/PhpStan/ForbiddenNodeTypeRule.php @@ -36,7 +36,7 @@ class ForbiddenNodeTypeRule implements Rule * @param class-string $nodeType * @param string|null $message */ - public function __construct(string $nodeType, string $message = null) + public function __construct(string $nodeType, ?string $message = null) { if (!\is_a($nodeType, Node::class, true)) { // @phpstan-ignore phpstanApi.runtimeReflection, function.alreadyNarrowedType throw new \InvalidArgumentException(\sprintf(