Merge branch '3.x' into 4.x

* 3.x:
  Update PHPUnit config
  Optimize sprintf() calls for PHP 8.4
This commit is contained in:
Fabien Potencier
2024-06-21 08:27:27 +02:00
53 changed files with 285 additions and 364 deletions
+4 -4
View File
@@ -71,7 +71,7 @@ class Parser
public function getVarName(): string
{
return sprintf('__internal_parse_%d', $this->varNameSalt++);
return \sprintf('__internal_parse_%d', $this->varNameSalt++);
}
public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode
@@ -173,13 +173,13 @@ class Parser
if (!$subparser = $this->env->getTokenParser($token->getValue())) {
if (null !== $test) {
$e = new SyntaxError(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
$e = new SyntaxError(\sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
if (\is_array($test) && isset($test[0]) && $test[0] instanceof TokenParserInterface) {
$e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno));
$e->appendMessage(\sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno));
}
} else {
$e = new SyntaxError(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
$e = new SyntaxError(\sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
$e->addSuggestions($token->getValue(), array_keys($this->env->getTokenParsers()));
}