Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::parseVariableDeclaration

Parses a variable declarations

Return value

Node\VariableDeclarator|null

File

vendor/mck89/peast/lib/Peast/Syntax/Parser.php, line 1906

Class

Parser
Parser class

Namespace

Peast\Syntax

Code

protected function parseVariableDeclaration() {
    if ($id = $this->parseIdentifier(static::$bindingIdentifier)) {
        $node = $this->createNode("VariableDeclarator", $id);
        $node->setId($id);
        if ($init = $this->parseInitializer()) {
            $node->setInit($init);
        }
        return $this->completeNode($node);
    }
    elseif ($id = $this->parseBindingPattern()) {
        if ($init = $this->parseInitializer()) {
            $node = $this->createNode("VariableDeclarator", $id);
            $node->setId($id);
            $node->setInit($init);
            return $this->completeNode($node);
        }
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal