Skip to content

Commit

Permalink
Apply CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirone committed Nov 4, 2023
1 parent a7e33de commit 5b522f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Fixer/FunctionNotation/PhpdocToParamTypeFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected function createTokensFromRawType(string $type): Tokens
{
$typeTokens = Tokens::fromCode(sprintf(self::TYPE_CHECK_TEMPLATE, $type));
$typeTokens->clearRange(0, 4);
$typeTokens->clearRange(count($typeTokens) - 6, count($typeTokens) - 1);
$typeTokens->clearRange(\count($typeTokens) - 6, \count($typeTokens) - 1);
$typeTokens->clearEmptyTokens();

return $typeTokens;
Expand Down
20 changes: 10 additions & 10 deletions src/Fixer/FunctionNotation/PhpdocToPropertyTypeFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
}
}

protected function createTokensFromRawType(string $type): Tokens
{
$typeTokens = Tokens::fromCode(sprintf(self::TYPE_CHECK_TEMPLATE, $type));
$typeTokens->clearRange(0, 8);
$typeTokens->clearRange(\count($typeTokens) - 5, \count($typeTokens) - 1);
$typeTokens->clearEmptyTokens();

return $typeTokens;
}

private function fixClass(Tokens $tokens, int $index): void
{
$index = $tokens->getNextTokenOfKind($index, ['{']);
Expand Down Expand Up @@ -154,16 +164,6 @@ private function fixClass(Tokens $tokens, int $index): void
}
}

protected function createTokensFromRawType(string $type): Tokens
{
$typeTokens = Tokens::fromCode(sprintf(self::TYPE_CHECK_TEMPLATE, $type));
$typeTokens->clearRange(0, 8);
$typeTokens->clearRange(count($typeTokens) - 5, count($typeTokens) - 1);
$typeTokens->clearEmptyTokens();

return $typeTokens;
}

/**
* @return array<string, int>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/FunctionNotation/PhpdocToReturnTypeFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected function createTokensFromRawType(string $type): Tokens
{
$typeTokens = Tokens::fromCode(sprintf(self::TYPE_CHECK_TEMPLATE, $type));
$typeTokens->clearRange(0, 7);
$typeTokens->clearRange(count($typeTokens) - 3, count($typeTokens) - 1);
$typeTokens->clearRange(\count($typeTokens) - 3, \count($typeTokens) - 1);
$typeTokens->clearEmptyTokens();

return $typeTokens;
Expand Down
2 changes: 0 additions & 2 deletions src/Tokenizer/Analyzer/CommentsAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
use PhpCsFixer\Tokenizer\Token;
use PhpCsFixer\Tokenizer\Tokens;

use const T_RETURN;

/**
* @author Kuba Werłos <werlos@gmail.com>
*
Expand Down

0 comments on commit 5b522f8

Please sign in to comment.