You are here

public function Twig_Error_Syntax::addSuggestions in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/lib/Twig/Error/Syntax.php \Twig_Error_Syntax::addSuggestions()

Tweaks the error message to include suggestions.

Parameters

string $name The original name of the item that does not exist:

array $items An array of possible items:

File

vendor/twig/twig/lib/Twig/Error/Syntax.php, line 26

Class

Twig_Error_Syntax
Exception thrown when a syntax error occurs during lexing or parsing of a template.

Code

public function addSuggestions($name, array $items) {
  if (!($alternatives = self::computeAlternatives($name, $items))) {
    return;
  }
  $this
    ->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives)));
}