8000 Deprecated class on TwigBundle · Issue #16872 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Deprecated class on TwigBundle #16872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DavidGarciaCat opened this issue Dec 6, 2015 · 5 comments
Closed

Deprecated class on TwigBundle #16872

DavidGarciaCat opened this issue Dec 6, 2015 · 5 comments

Comments

@DavidGarciaCat
Copy link

Hello,

I have been updating my vendors recently, and SensioLabs Insight has reported me that there is 1 deprecated class on TwigBundle. Given this is an updated vendor, I presume (from my humble point of vire) it should not be tagged as @deprecated or it should not be checked on SensioLabs Insight if that class will be removed on next TwigBundle release.

This is the error reported by SensioLabs Insight:

Info Architecture

The 846826759222eeac8b8b34e803951c07468c406717a71aa7cd45edcdf3463c61_55 service uses the Symfony\Bundle\TwigBundle\Extension\ActionsExtension class, which has been deprecated in Symfony 2.2.

Cheers,

@Tobion
Copy link
Contributor
Tobion commented Dec 7, 2015

It looks like the error report from sensio labs insight is wrong. The ActionsExtension is deprecated indeed, but it is only added automatically in the TwigBundle for BC. So the depreaction is only triggered if you actually use the {% render %} tag in your templates. So just instantiating the ActionsExtension does not and should not be reported as problem. Ref #13233
Please open an issue on SensioLabs Insight.

@Tobion Tobion closed this as completed Dec 7, 2015
@DavidGarciaCat
Copy link
Author
DavidGarciaCat commented Dec 7, 2015 via email

@DavidGarciaCat
Copy link
Author

Hey,

Just to keep you up to date: this is the SensioLabs Insight answer about this case I posted here:


Hello David,

Removing this violation programmatically is not really possible, as we can't determine in an automatic way if this service is a vendor one or yours.

But you can easily just ignore the violation.

Best regards,

@tvlooy
Copy link
Contributor
tvlooy commented Jan 14, 2016

If you really want to get rid of it you could overwrite the service. Tested and works with SensioLabsInsight Eg:

services.yml

services:
    # Nullify this service. It is deprecated and raises an error on SensioLabs Insight
    twig.extension.actions:
        class: AppBundle\Twig\NullExtension

AppBundle\Twig\NullExtension.php

<?php

namespace AppBundle\Twig;

class NullExtension implements \Twig_ExtensionInterface
{
    /**
     * {@inheritdoc}
     */
    public function initRuntime(\Twig_Environment $environment)
    {}

    /**
     * {@inheritdoc}
     */
    public function getTokenParsers()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getNodeVisitors()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getFilters()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getTests()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getFunctions()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getOperators()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getGlobals()
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'null_extension';
    }
}

@DavidGarciaCat
Copy link
Author

Hi Tom,

Many thanks for your message.
I'm going to try this update. Hope it helps my SensioLabs Insight checks.

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0