Skip to content

Commit

Permalink
Update TokenGetAllToObjectRector to use the correct method name (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrrgn committed Jul 13, 2021
1 parent f7eeeba commit b6039d7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class CodeSnifferCase
{
$code = '<?php echo 1;';

$stringTokens = \PhpToken::getAll($code);
$stringTokens = \PhpToken::tokenize($code);
foreach ($stringTokens as $token) {
if ($token->is(T_VARIABLE)) {
$error = 'Variable "%s" not allowed in double quoted string; use concatenation instead';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Fixture
{
$code = '<?php echo 1;';

$tokens = \PhpToken::getAll($code);
$tokens = \PhpToken::tokenize($code);
foreach ($tokens as $token) {
$name = $token->getTokenName();
$text = $token->text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class NotArrayFirst
{
$code = '<?php echo 1;';

$tokens = \PhpToken::getAll($code);
$tokens = \PhpToken::tokenize($code);
foreach ($tokens as $token) {
$name = $token->getTokenName();
$text = $token->text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class ProcessTokenGetAllButKeepNonTokenArray
{
$code = '<?php echo 1;';

$stringTokens = \PhpToken::getAll($code);
$stringTokens = \PhpToken::tokenize($code);

$nonToken = 'blaaa';
foreach ($stringTokens as $token) {
Expand Down
6 changes: 3 additions & 3 deletions rules/Php80/Rector/FuncCall/TokenGetAllToObjectRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Convert `token_get_all` to `PhpToken::getAll`',
'Convert `token_get_all` to `PhpToken::tokenize`',
[
new CodeSample(
<<<'CODE_SAMPLE'
Expand All @@ -61,7 +61,7 @@ final class SomeClass
{
public function run()
{
$tokens = \PhpToken::getAll($code);
$tokens = \PhpToken::tokenize($code);
foreach ($tokens as $phpToken) {
$name = $phpToken->getTokenName();
$text = $phpToken->text;
Expand Down Expand Up @@ -93,7 +93,7 @@ public function refactor(Node $node): ?Node

$this->refactorTokensVariable($node);

return $this->nodeFactory->createStaticCall('PhpToken', 'getAll', $node->args);
return $this->nodeFactory->createStaticCall('PhpToken', 'tokenize', $node->args);
}

private function refactorTokensVariable(FuncCall $funcCall): void
Expand Down

0 comments on commit b6039d7

Please sign in to comment.