Where to add "#[YieldReady]"? #4428
-
We are getting the error Where does this need to be added? Is there any documentation to follow? The entirety of the class that is being flagged is as below. We have also "flagged" every custom class associated with Twig but to no avail.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
It should be: namespace Common\General\Site\TwigDebugger;
use jblond\TwigTrans\TransNode;
use Twig\Attribute\YieldReady;
#[YieldReady]
class TransNodeDebug extends TransNode
{
#[YieldReady]
protected function getTransFunction(bool $plural): string
{
return $plural ? 'ngettext' : 'gettextDebug';
}
} Notice the missing |
Beta Was this translation helpful? Give feedback.
-
Thank you for the response, Fabien. Yes, it was the "use" that was missing. (For anyone else catching up, the second "YieldReady" in my code was not needed - just the one outside the class). |
Beta Was this translation helpful? Give feedback.
-
Would #4446 have been helpful? |
Beta Was this translation helpful? Give feedback.
-
Awesome! Yes, that would have saved a fair chunk of searching and testing. Thanks (on behalf of others) for adding. |
Beta Was this translation helpful? Give feedback.
It should be:
Notice the missing
use
statement:use Twig\Attribute\YieldReady;