Skip to content

Commit

Permalink
Merge pull request #11 from adamwojs/php_8_support
Browse files Browse the repository at this point in the history
Added support for PHP8
  • Loading branch information
adamwojs authored Mar 3, 2021
2 parents d1a236a + 04a993a commit 023af49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"require": {
"php": "^7.1",
"php": "^7.1||^8.0",
"friendsofphp/php-cs-fixer": "^2.7"
},
"autoload": {
Expand Down
5 changes: 4 additions & 1 deletion src/Analyzer/NamespaceAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/Fixer/Phpdoc/ForceFQCNFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 023af49

Please sign in to comment.