Skip to content

Commit

Permalink
minor #15663 Mark deprecated Twig functions as deprecated with the Tw…
Browse files Browse the repository at this point in the history
…ig feature (stof)

This PR was merged into the 2.7 branch.

Discussion
----------

Mark deprecated Twig functions as deprecated with the Twig feature

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

We were not able to trigger the deprecation for ``form_enctype`` because we were trying to trigger it at runtime, and we failed at it.
Twig now has a builtin way to mark functions as deprecated so here is the PR using it.

Commits
-------

cd167f4 Mark deprecated Twig functions as deprecated with the Twig feature
  • Loading branch information
fabpot committed Sep 1, 2015
2 parents 3b9756c + cd167f4 commit f972fa4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/AppVariable.php
Expand Up @@ -14,8 +14,8 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/AssetExtension.php
Expand Up @@ -42,7 +42,7 @@ public function getFunctions()
return array(
new \Twig_SimpleFunction('asset', array($this, 'getAssetUrl')),
new \Twig_SimpleFunction('asset_version', array($this, 'getAssetVersion')),
new \Twig_SimpleFunction('assets_version', array($this, 'getAssetsVersion')),
new \Twig_SimpleFunction('assets_version', array($this, 'getAssetsVersion'), array('deprecated' => true, 'alternative' => 'asset_version')),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/FormExtension.php
Expand Up @@ -61,7 +61,7 @@ public function getTokenParsers()
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'))),
new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'), 'deprecated' => true, 'alternative' => 'form_start')),
new \Twig_SimpleFunction('form_widget', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
new \Twig_SimpleFunction('form_errors', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
new \Twig_SimpleFunction('form_label', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
Expand Down

0 comments on commit f972fa4

Please sign in to comment.