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

Breadcrumb

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

function TokenStream::nextIf

Tests a token, sets the pointer to the next one and returns it or throws a syntax error.

Return value

Token|null The next token if the condition is true, null otherwise

File

vendor/twig/twig/src/TokenStream.php, line 64

Class

TokenStream
Represents a token stream.

Namespace

Twig

Code

public function nextIf($primary, $secondary = null) {
    return $this->tokens[$this->current]
        ->test($primary, $secondary) ? $this->next() : null;
}
RSS feed
Powered by Drupal