Twig icon indicating copy to clipboard operation
Twig copied to clipboard

Can we detect dump function

Open nevercodealone opened this issue 5 years ago • 3 comments

Hi,

often i forget to delete dump functions in twig templates. Is there a way to detect them and use this in a prehook in git?

See you Roland

nevercodealone avatar Dec 26 '19 18:12 nevercodealone

If you use Symfony, you could run the lint:twig command in the prod environment which should error when the dump() function is used but not defined (which should be the case in the prod environment).

xabbuh avatar Dec 27 '19 09:12 xabbuh

So maybe this is a feature request ;) Or should we close it?

nevercodealone avatar Dec 27 '19 13:12 nevercodealone

A feature request is not necessary since @xabbuh has shown a way to detect a dump() call. Just use php bin/console lint:twig templates --env=prod in the CLI.

dsentker avatar Jan 16 '20 14:01 dsentker

I'm running into something when I try that:

bin/console lint:twig templates/ --env=prod

In Container.php line 264:

You have requested a non-existent service "debug.error_handler_configurator".

Any ideas? I can't tell what that's related to. It happens when I try to clear the cache too.

tacman avatar Jun 05 '23 18:06 tacman

@tacman might be fixed by symfony/symfony#50498 (which was not released yet)

xabbuh avatar Jun 06 '23 06:06 xabbuh