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 src/PhpCs/FiveLab/PhpCsUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/PhpCs/FiveLab/Sniffs/Formatting/TypedConstantsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down
6 changes: 3 additions & 3 deletions src/PhpCs/FiveLab/Sniffs/Formatting/UnusedImportsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand All @@ -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;
}
Expand All @@ -82,7 +82,7 @@ public function process(File $phpcsFile, mixed $stackPtr): void
return;
}

$pos++;
$pos = (int) $pos + 1;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/PhpStan/ForbiddenNodeTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ForbiddenNodeTypeRule implements Rule
* @param class-string<Node> $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(
Expand Down