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

Breadcrumb

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

function ParserAbstract::fixupAlternativeElse

Parameters

ElseIf_|Else_ $node :

File

vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php, line 1004

Class

ParserAbstract

Namespace

PhpParser

Code

protected function fixupAlternativeElse($node) : void {
    // Make sure a trailing nop statement carrying comments is part of the node.
    $numStmts = \count($node->stmts);
    if ($numStmts !== 0 && $node->stmts[$numStmts - 1] instanceof Nop) {
        $nopAttrs = $node->stmts[$numStmts - 1]
            ->getAttributes();
        if (isset($nopAttrs['endLine'])) {
            $node->setAttribute('endLine', $nopAttrs['endLine']);
        }
        if (isset($nopAttrs['endFilePos'])) {
            $node->setAttribute('endFilePos', $nopAttrs['endFilePos']);
        }
        if (isset($nopAttrs['endTokenPos'])) {
            $node->setAttribute('endTokenPos', $nopAttrs['endTokenPos']);
        }
    }
}

API Navigation

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