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

Breadcrumb

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

function Enum_::addStmt

Adds a statement.

Parameters

Stmt|PhpParser\Builder $stmt The statement to add:

Return value

$this The builder instance (for fluid interface)

Overrides Declaration::addStmt

File

vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php, line 72

Class

Enum_

Namespace

PhpParser\Builder

Code

public function addStmt($stmt) {
    $stmt = BuilderHelpers::normalizeNode($stmt);
    if ($stmt instanceof Stmt\EnumCase) {
        $this->enumCases[] = $stmt;
    }
    elseif ($stmt instanceof Stmt\ClassMethod) {
        $this->methods[] = $stmt;
    }
    elseif ($stmt instanceof Stmt\TraitUse) {
        $this->uses[] = $stmt;
    }
    elseif ($stmt instanceof Stmt\ClassConst) {
        $this->constants[] = $stmt;
    }
    else {
        throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
    }
    return $this;
}

API Navigation

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