Skip to content

Commit 023af49

Browse files
authored
Merge pull request #11 from adamwojs/php_8_support
Added support for PHP8
2 parents d1a236a + 04a993a commit 023af49

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
],
1111
"require": {
12-
"php": "^7.1",
12+
"php": "^7.1||^8.0",
1313
"friendsofphp/php-cs-fixer": "^2.7"
1414
},
1515
"autoload": {

src/Analyzer/NamespaceAnalyzer.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public function getNamespaces(): array
3838
];
3939
}
4040

41-
$this->tokens->rewind();
41+
if (\PHP_VERSION_ID < 80000) {
42+
$this->tokens->rewind();
43+
}
44+
4245
foreach ($this->tokens as $index => $token) {
4346
if (!$token->isGivenKind(T_NAMESPACE)) {
4447
continue;

src/Fixer/Phpdoc/ForceFQCNFixer.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function fix(SplFileInfo $file, Tokens $tokens): void
5757
{
5858
$namespaces = (new NamespaceAnalyzer($tokens))->getNamespaces();
5959

60-
$tokens->rewind();
60+
if (\PHP_VERSION_ID < 80000) {
61+
$tokens->rewind();
62+
}
6163

6264
foreach ($tokens as $index => $token) {
6365
if ($token->isGivenKind(T_DOC_COMMENT)) {

0 commit comments

Comments
 (0)