laravel-6 support
This commit is contained in:
@@ -29,17 +29,12 @@ class TokenStream
|
||||
/**
|
||||
* @var Token[]
|
||||
*/
|
||||
private $tokens = array();
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $frozen = false;
|
||||
private $tokens = [];
|
||||
|
||||
/**
|
||||
* @var Token[]
|
||||
*/
|
||||
private $used = array();
|
||||
private $used = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
@@ -49,7 +44,7 @@ class TokenStream
|
||||
/**
|
||||
* @var Token|null
|
||||
*/
|
||||
private $peeked = null;
|
||||
private $peeked;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
@@ -59,11 +54,9 @@ class TokenStream
|
||||
/**
|
||||
* Pushes a token.
|
||||
*
|
||||
* @param Token $token
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function push(Token $token)
|
||||
public function push(Token $token): self
|
||||
{
|
||||
$this->tokens[] = $token;
|
||||
|
||||
@@ -75,21 +68,17 @@ class TokenStream
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function freeze()
|
||||
public function freeze(): self
|
||||
{
|
||||
$this->frozen = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns next token.
|
||||
*
|
||||
* @return Token
|
||||
*
|
||||
* @throws InternalErrorException If there is no more token
|
||||
*/
|
||||
public function getNext()
|
||||
public function getNext(): Token
|
||||
{
|
||||
if ($this->peeking) {
|
||||
$this->peeking = false;
|
||||
@@ -107,10 +96,8 @@ class TokenStream
|
||||
|
||||
/**
|
||||
* Returns peeked token.
|
||||
*
|
||||
* @return Token
|
||||
*/
|
||||
public function getPeek()
|
||||
public function getPeek(): Token
|
||||
{
|
||||
if (!$this->peeking) {
|
||||
$this->peeked = $this->getNext();
|
||||
@@ -125,7 +112,7 @@ class TokenStream
|
||||
*
|
||||
* @return Token[]
|
||||
*/
|
||||
public function getUsed()
|
||||
public function getUsed(): array
|
||||
{
|
||||
return $this->used;
|
||||
}
|
||||
@@ -137,7 +124,7 @@ class TokenStream
|
||||
*
|
||||
* @throws SyntaxErrorException If next token is not an identifier
|
||||
*/
|
||||
public function getNextIdentifier()
|
||||
public function getNextIdentifier(): string
|
||||
{
|
||||
$next = $this->getNext();
|
||||
|
||||
@@ -151,11 +138,11 @@ class TokenStream
|
||||
/**
|
||||
* Returns nex identifier or star delimiter token.
|
||||
*
|
||||
* @return null|string The identifier token value or null if star found
|
||||
* @return string|null The identifier token value or null if star found
|
||||
*
|
||||
* @throws SyntaxErrorException If next token is not an identifier or a star delimiter
|
||||
*/
|
||||
public function getNextIdentifierOrStar()
|
||||
public function getNextIdentifierOrStar(): ?string
|
||||
{
|
||||
$next = $this->getNext();
|
||||
|
||||
@@ -163,8 +150,8 @@ class TokenStream
|
||||
return $next->getValue();
|
||||
}
|
||||
|
||||
if ($next->isDelimiter(array('*'))) {
|
||||
return;
|
||||
if ($next->isDelimiter(['*'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next);
|
||||
|
Reference in New Issue
Block a user