composer update
This commit is contained in:
+13
-4
@@ -186,7 +186,7 @@ abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope
|
||||
$tokens[$i] instanceof PHP_Token_PROTECTED ||
|
||||
$tokens[$i] instanceof PHP_Token_PUBLIC)) {
|
||||
return strtolower(
|
||||
str_replace('PHP_Token_', '', get_class($tokens[$i]))
|
||||
str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i]))
|
||||
);
|
||||
}
|
||||
if (isset($tokens[$i]) &&
|
||||
@@ -220,7 +220,7 @@ abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope
|
||||
$tokens[$i] instanceof PHP_Token_FINAL ||
|
||||
$tokens[$i] instanceof PHP_Token_ABSTRACT)) {
|
||||
$keywords[] = strtolower(
|
||||
str_replace('PHP_Token_', '', get_class($tokens[$i]))
|
||||
str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i]))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ abstract class PHP_Token_Includes extends PHP_Token
|
||||
if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) {
|
||||
$this->name = trim($tokens[$this->id + 2], "'\"");
|
||||
$this->type = strtolower(
|
||||
str_replace('PHP_Token_', '', get_class($tokens[$this->id]))
|
||||
str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$this->id]))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -405,7 +405,7 @@ class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility
|
||||
$tokens = $this->tokenStream->tokens();
|
||||
|
||||
for ($i = $this->id; $i <= $end; $i++) {
|
||||
switch (get_class($tokens[$i])) {
|
||||
switch (PHP_Token_Util::getClass($tokens[$i])) {
|
||||
case 'PHP_Token_IF':
|
||||
case 'PHP_Token_ELSEIF':
|
||||
case 'PHP_Token_FOR':
|
||||
@@ -1350,3 +1350,12 @@ class PHP_Token_SPACESHIP extends PHP_Token
|
||||
class PHP_Token_YIELD_FROM extends PHP_Token
|
||||
{
|
||||
}
|
||||
|
||||
// Tokens introduced in PHP 7.4
|
||||
class PHP_Token_COALESCE_EQUAL extends PHP_Token
|
||||
{
|
||||
}
|
||||
|
||||
class PHP_Token_FN extends PHP_Token
|
||||
{
|
||||
}
|
||||
|
||||
+12
-10
@@ -303,7 +303,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
||||
];
|
||||
|
||||
foreach ($this->tokens as $token) {
|
||||
switch (get_class($token)) {
|
||||
switch (PHP_Token_Util::getClass($token)) {
|
||||
case 'PHP_Token_REQUIRE_ONCE':
|
||||
case 'PHP_Token_REQUIRE':
|
||||
case 'PHP_Token_INCLUDE_ONCE':
|
||||
@@ -358,7 +358,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
||||
$interfaceEndLine = false;
|
||||
|
||||
foreach ($this->tokens as $token) {
|
||||
switch (get_class($token)) {
|
||||
switch (PHP_Token_Util::getClass($token)) {
|
||||
case 'PHP_Token_HALT_COMPILER':
|
||||
return;
|
||||
|
||||
@@ -392,15 +392,17 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
|
||||
'file' => $this->filename
|
||||
];
|
||||
|
||||
if ($token instanceof PHP_Token_CLASS) {
|
||||
$class[] = $token->getName();
|
||||
$classEndLine[] = $token->getEndLine();
|
||||
if ($token->getName() !== null) {
|
||||
if ($token instanceof PHP_Token_CLASS) {
|
||||
$class[] = $token->getName();
|
||||
$classEndLine[] = $token->getEndLine();
|
||||
|
||||
$this->classes[$class[count($class) - 1]] = $tmp;
|
||||
} else {
|
||||
$trait = $token->getName();
|
||||
$traitEndLine = $token->getEndLine();
|
||||
$this->traits[$trait] = $tmp;
|
||||
$this->classes[$class[count($class) - 1]] = $tmp;
|
||||
} else {
|
||||
$trait = $token->getName();
|
||||
$traitEndLine = $token->getEndLine();
|
||||
$this->traits[$trait] = $tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of php-token-stream.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
final class PHP_Token_Util
|
||||
{
|
||||
public static function getClass($object): string
|
||||
{
|
||||
$parts = explode('\\', get_class($object));
|
||||
|
||||
return array_pop($parts);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user