Skip to content

[TwigBridge] Late deprecation for TwigRendererEngine::setEnvironment() #21021

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
Dec 23, 2016

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Dec 22, 2016

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #20093 (comment)
License MIT
Doc PR n/a

This method should have been deprecated in 3.2 since the twig environment should be injected through the constructor and replacing it later can break things (see #20093 (comment) for details).

Maybe this could target 3.2

@fabpot
Copy link
Member

fabpot commented Dec 22, 2016

Not sure about this one. AFAIU, the user will now receive two deprecation notices as if they don't pass Twig env as a constructor argument, they probably call the setter.

@stof
Copy link
Member

stof commented Dec 22, 2016

well, if they pass it in the constructor and still call the setter later, removing the setter would break their app without warning. So we need a deprecation warning there (to avoid the double deprecation warning, we may trigger it only when we already have an environment)

@chalasr chalasr force-pushed the twig-bridge/deprec-engine-setenv branch 2 times, most recently from 28d55d1 to 5ef1565 Compare December 22, 2016 10:53
@chalasr
Copy link
Member Author

chalasr commented Dec 22, 2016

Indeed, updated to avoid the double warning. Should this target 3.2? If so I'll update the corresponding UPGRADE file

@fabpot
Copy link
Member

fabpot commented Dec 22, 2016

3.3 is fine.

@@ -217,6 +217,9 @@ TwigBridge
* The possibility to inject the Form Twig Renderer into the form extension
has been removed. Inject it into the `TwigRendererEngine` instead.

* The `TwigRendererEngine::setEnvironment()` method has been removed.
Pass the Twig Environment as second argument of the constructor instead.
Copy link
Member

Choose a reason for hiding this comment

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

Should also be documented in the UPGRADE-3.3.md file.

@chalasr chalasr force-pushed the twig-bridge/deprec-engine-setenv branch from 5ef1565 to aabb73c Compare December 22, 2016 11:01
@chalasr
Copy link
Member Author

chalasr commented Dec 22, 2016

UPGRADE files updated

@xabbuh
Copy link
Member

xabbuh commented Dec 22, 2016

👍

@fabpot
Copy link
Member

fabpot commented Dec 23, 2016

Thank you @chalasr.

@fabpot fabpot merged commit aabb73c into symfony:master Dec 23, 2016
fabpot added a commit that referenced this pull request Dec 23, 2016
…tEnvironment() (chalasr)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[TwigBridge] Late deprecation for TwigRendererEngine::setEnvironment()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #20093 (comment)
| License       | MIT
| Doc PR        | n/a

This method should have been deprecated in 3.2 since the twig environment should be injected through the constructor and replacing it later can break things (see #20093 (comment) for details).

Maybe this could target 3.2

Commits
-------

aabb73c Deprecate TwigRendererEngine::setEnvironment()
@chalasr chalasr deleted the twig-bridge/deprec-engine-setenv branch December 23, 2016 13:24
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.

5 participants