Fix twig deprecations for php 8

Ref: https://github.com/twigphp/Twig/issues/3327
Upstream: https://github.com/twigphp/Twig/pull/3331

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-05-28 09:33:58 +02:00
parent ee9630b4cb
commit 43564f5f5f
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -28,21 +28,21 @@ class NodeTrans extends TransNode
* The attributes are automatically made available as array items ($this['name']). * The attributes are automatically made available as array items ($this['name']).
* *
* @param Node $body Body of node trans * @param Node $body Body of node trans
* @param Node $plural Node plural * @param Node|null $plural Node plural
* @param AbstractExpression $count Node count * @param AbstractExpression $count Node count
* @param Node $context Node context * @param Node|null $context Node context
* @param Node $notes Node notes * @param Node|null $notes Node notes
* @param int $lineno The line number * @param int $lineno The line number
* @param string $tag The tag name associated with the Node * @param string $tag The tag name associated with the Node
*/ */
public function __construct( public function __construct(
Node $body, Node $body,
Node $plural = null, ?Node $plural,
AbstractExpression $count = null, ?AbstractExpression $count,
Node $context = null, ?Node $context,
Node $notes = null, ?Node $notes,
$lineno, int $lineno,
$tag = null string $tag
) { ) {
$nodes = ['body' => $body]; $nodes = ['body' => $body];
if (null !== $count) { if (null !== $count) {
@ -160,7 +160,7 @@ class NodeTrans extends TransNode
* *
* @return string * @return string
*/ */
protected function getTransFunction($plural, $hasMsgContext = false) protected function getTransFunction($plural, bool $hasMsgContext = false): string
{ {
if ($hasMsgContext) { if ($hasMsgContext) {
return $plural ? '_ngettext' : '_pgettext'; return $plural ? '_ngettext' : '_pgettext';