idea-php-toolbox-json-files
idea-php-toolbox-json-files copied to clipboard
Add completion for Symfony FlashBag types
Today I thought about adding completion for Symfony FlashBag types ('error', 'info', etc) in Twig via PHP Toolbox for the new app.flashes method (and also the old app.session.flashBag.get one).
But there are a few deal breakers which stopped me from doing so:
- It's not possible to add completion for PHP method arguments: https://github.com/Haehnchen/idea-php-toolbox/issues/62
appvariable is not correctly resolved for Symfony 3.3: https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/903
To avoid a static list of FlashBag types (since it's user defined), it would be good to be able to get them from all Controller::addFlash and FlashBagInterface::set calls.
This requires: https://github.com/Haehnchen/idea-php-toolbox/issues/41
Example usage:
// inside Controller:
$this->addFlash('error', 'Something went wrong');
{# inside Template #}
{% for message in app.flashes('<CARET>') %}
<div class="alert alert-notice">
{{ message }}
</div>
{% endfor %}