diff --git a/composer.json b/composer.json index dc1416e..10dc1b9 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "php": "^7.1", + "php": "^7.1||^8.0", "friendsofphp/php-cs-fixer": "^2.7" }, "autoload": { diff --git a/src/Analyzer/NamespaceAnalyzer.php b/src/Analyzer/NamespaceAnalyzer.php index efe80d1..da8aa04 100644 --- a/src/Analyzer/NamespaceAnalyzer.php +++ b/src/Analyzer/NamespaceAnalyzer.php @@ -38,7 +38,10 @@ public function getNamespaces(): array ]; } - $this->tokens->rewind(); + if (\PHP_VERSION_ID < 80000) { + $this->tokens->rewind(); + } + foreach ($this->tokens as $index => $token) { if (!$token->isGivenKind(T_NAMESPACE)) { continue; diff --git a/src/Fixer/Phpdoc/ForceFQCNFixer.php b/src/Fixer/Phpdoc/ForceFQCNFixer.php index dd8545d..3c7f5ef 100644 --- a/src/Fixer/Phpdoc/ForceFQCNFixer.php +++ b/src/Fixer/Phpdoc/ForceFQCNFixer.php @@ -57,7 +57,9 @@ public function fix(SplFileInfo $file, Tokens $tokens): void { $namespaces = (new NamespaceAnalyzer($tokens))->getNamespaces(); - $tokens->rewind(); + if (\PHP_VERSION_ID < 80000) { + $tokens->rewind(); + } foreach ($tokens as $index => $token) { if ($token->isGivenKind(T_DOC_COMMENT)) {