This extends the excellent Twigcs to provide a ruleset for the Fractal Render component.
This is available as a package on packagist: https://packagist.org/packages/scotteuser/twigcs-fractal
composer require scotteuser/twigcs-fractal
Consider the following Fractal code:
{% set card_label = 'Hello' %}
{% render "@card" with {
label: card_label
} %}
Twigcs by default will consider card_label
as an unused
variable because it does not know of Fractal's render
tag.
Add a file .twig_cs.dist
to your project root and change your
project to use this ruleset.
<?php
return \FriendsOfTwig\Twigcs\Config\Config::create()
->setRuleSet(ScottEuser\FractalTwigcs\Ruleset\Fractal::class);