pug-php / pug-symfony

Pug (Jade) template engine for Symfony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mixins with arguments seem to break on Twig functions' interpolation

butteredptarmigan opened this issue · comments

Environment

  • PHP 7.4.4
  • Symfony 5
  • Pug-symfony 3.0.0
  • All optional node dependencies installed via Composer
  • Configured expression language is javascript, but it also applies to php-style expressions

Description

When I write a mixin and make it take some arguments, I see the following error: "Notice: Undefined offset: 1". It derives from line 199 of trait HelpersHandler, inside a method interpolateTwigFunctions.

There are some cases when it does not occur, for example:

mixin withoutParentheses
    p foo

mixin withParentheses()
    p bar

However, it occurs if an argument is defined – even if the mixin was not actually called or the argument was not used inside the mixin body. For example, this snippet from the documentation does not work:

mixin pet(name)
  li.pet= name
ul
  +pet('cat')
  +pet('dog')
  +pet('pig')
commented

Hello, thank you for the report. I fixed it and released a patch 3.0.1. Please try to update.

You're the best! It works as expected now.