scotteuser/twigcs-fractal

Checkstyle automation for Fractal Twig

dev-main 2022-03-18 10:13 UTC

This package is auto-updated.

Last update: 2024-04-18 14:52:06 UTC


README

This extends the excellent Twigcs to provide a ruleset for the Fractal Render component.

Installation

This is available as a package on packagist: https://packagist.org/packages/scotteuser/twigcs-fractal

composer require scotteuser/twigcs-fractal

What does this do?

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.

How do you use it?

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);