PhpParser\Lexer\Emulative::__construct PHP Method

__construct() public method

public __construct ( array $options = [] )
$options array
    public function __construct(array $options = array())
    {
        parent::__construct($options);
        $newKeywordsPerVersion = array();
        $this->newKeywords = array();
        foreach ($newKeywordsPerVersion as $version => $newKeywords) {
            if (version_compare(PHP_VERSION, $version, '>=')) {
                break;
            }
            $this->newKeywords += $newKeywords;
        }
        if (version_compare(PHP_VERSION, self::PHP_7_0, '>=')) {
            return;
        }
        $this->tokenMap[self::T_COALESCE] = Tokens::T_COALESCE;
        $this->tokenMap[self::T_SPACESHIP] = Tokens::T_SPACESHIP;
        $this->tokenMap[self::T_YIELD_FROM] = Tokens::T_YIELD_FROM;
        if (version_compare(PHP_VERSION, self::PHP_5_6, '>=')) {
            return;
        }
        $this->tokenMap[self::T_ELLIPSIS] = Tokens::T_ELLIPSIS;
        $this->tokenMap[self::T_POW] = Tokens::T_POW;
        $this->tokenMap[self::T_POW_EQUAL] = Tokens::T_POW_EQUAL;
    }

Usage Example

Example #1
0
 public function __construct(array $options = array())
 {
     parent::__construct($options);
 }