Skip to content

fixed Twig deprecation notices #16331

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

Merged
merged 1 commit into from
Oct 30, 2015
Merged

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Oct 24, 2015

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

To avoid deprecation notices when upgrading to Twig 1.23.

@fabpot fabpot changed the title fixed Twig deprecations notive fixed Twig deprecation notices Oct 24, 2015
@@ -29,12 +29,18 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE
*/
private $template;

public function __construct(array $defaultThemes = array(), \Twig_Environment $environment)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we have the BC break as the environment is now required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which breaks Silex for instance.

@fabpot
Copy link
Member Author

fabpot commented Oct 24, 2015

I can see two other options:

  • Deprecate initRuntime in Twig 2.1 but that means waiting for Twig 3.0 to implement the performance optimization :(
  • Adding a new interface in Twig 1.x for the initRuntime method that needs to be implemented to avoid the deprecation notice. We would then deprecate this new interface in Twig 2.1.

@nicolas-grekas
Copy link
Member

I don't know if it's relevant here (I read quickly), but we didn't try to avoid deprecation notices in 2.3.

@@ -15,6 +15,8 @@

/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated in 2.8, to be removed in 3.0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be new deprecatations in a maintanance branch. This PR is for 2.3

@fabpot fabpot force-pushed the form-extension-deprecations branch from 9dd07b0 to 1bdd127 Compare October 24, 2015 20:26
@fabpot
Copy link
Member Author

fabpot commented Oct 24, 2015

Totally new implementation where I just implement the new interface from twigphp/Twig#1886. Another PR for 2.8 does the other changes (see #16333).

@@ -21,7 +21,7 @@
* @author Fabien Potencier <fabien@symfony.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class FormExtension extends \Twig_Extension
class FormExtension extends \Twig_Extension implements \Twig_Extension_InitRuntimeInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this interface defined? Travis fails when trying to load it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I missed the link to twigphp/Twig#1886.

@xabbuh
Copy link
Member

xabbuh commented Oct 29, 2015

👍

Status: Reviewed

Can we merge here to make Travis builds pass again?

@fabpot
Copy link
Member Author

fabpot commented Oct 29, 2015

I need to release Twig 1.23 first.

@@ -34,7 +34,7 @@
"symfony/process": "~2.0,>=2.0.5",
"symfony/validator": "~2.2",
"symfony/yaml": "~2.0,>=2.0.5",
"twig/twig": "~1.20|~2.0"
"twig/twig": "~1.23|~2.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed? The LogoutUrlExtension does not make use of the setEnvironment() method.

@fabpot fabpot merged commit 1bdd127 into symfony:2.3 Oct 30, 2015
fabpot added a commit that referenced this pull request Oct 30, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

fixed Twig deprecation notices

| 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

To avoid deprecation notices when upgrading to Twig 1.23.

Commits
-------

1bdd127 fixed Twig deprecation notices
@hjanuschka hjanuschka mentioned this pull request Nov 2, 2015
@Tobion
Copy link
Contributor

Tobion commented Nov 4, 2015

@fabpot @nicolas-grekas This produces a deprecation warning through the DebugClassLoader on every request in symfony standard edition.

The Symfony\Bridge\Twig\Extension\FormExtension class implements Twig_Extension_InitRuntimeInterface that is deprecated to be removed in 3.0

@stof
Copy link
Member

stof commented Nov 4, 2015

Twig_Extension_InitRuntimeInterface should not be marked as deprecated in Twig IMO, as it is precisely meant to be implemented by extensions not wanting the deprecation warning

@xabbuh
Copy link
Member

xabbuh commented Nov 4, 2015

This happens when using the dev version of Twig 2.0 I guess (the interface is not tagged as deprecated in Twig 1.23, is it?).

This was referenced Nov 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants