Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0 | Let T_STATIC be T_STATIC #37

Open
wants to merge 1 commit into
base: 4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function process(File $phpcsFile, $stackPtr)
if ($tokens[$stackPtr]['code'] === T_STATIC) {
if (($nextToken === false || $tokens[$nextToken]['code'] === T_DOUBLE_COLON)
|| $tokens[$prevToken]['code'] === T_NEW
|| $tokens[$prevToken]['code'] === T_INSTANCEOF
) {
// Late static binding, e.g., static:: OR new static() usage or live coding.
return;
Expand Down
18 changes: 0 additions & 18 deletions src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -2940,24 +2940,6 @@ protected function processAdditional()
}
}

continue;
} else if ($this->tokens[$i]['code'] === T_STATIC) {
for ($x = ($i - 1); $x > 0; $x--) {
if (isset(Tokens::$emptyTokens[$this->tokens[$x]['code']]) === false) {
break;
}
}

if ($this->tokens[$x]['code'] === T_INSTANCEOF) {
$this->tokens[$i]['code'] = T_STRING;
$this->tokens[$i]['type'] = 'T_STRING';

if (PHP_CODESNIFFER_VERBOSITY > 1) {
$line = $this->tokens[$i]['line'];
Common::printStatusMessage("* token $i on line $line changed from T_STATIC to T_STRING", 1);
}
}

continue;
} else if ($this->tokens[$i]['code'] === T_TRUE
|| $this->tokens[$i]['code'] === T_FALSE
Expand Down