8000 [TwigBridge] Fix upgrade/changelog notes by chalasr · Pull Request #21022 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBridge] Fix upgrade/changelog notes #21022

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 28, 2016

Conversation

chalasr
Copy link
Member
@chalasr chalasr commented Dec 22, 2016
Q A
Branch? 3.2

The current upgrade note is wrong, the renderer cannot be injected in the TwigRendererEngine, only the Twig Environment can be.
Also added a missing note about the deprecated TwigRendererEngineInterface.

@@ -134,7 +134,10 @@ TwigBridge
----------

* Deprecated the possibility to inject the Form Twig Renderer into the form
extension. Inject it into the `TwigRendererEngine` instead.
extension. Inject the Twig Environment into the `TwigRendererEngine` and load
the Twig Renderer using the Twig FactoryRuntimeLoader instead.
Copy link
Member

Choose a reason for hiding this comment

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

I would use the class name here. And we should probably also mention that you need Twig 1.30 for it.

@chalasr chalasr force-pushed the twig-bridge/fix-upgrade-notes branch 2 times, most recently from b765377 to 455f105 Compare December 26, 2016 11:26
@chalasr
Copy link
Member Author
chalasr commented Dec 26, 2016

Added a before/after 8000 in upgrade files, flagged the change as BC break in the changelog and fixed @xabbuh's line note

@nicolas-grekas nicolas-grekas added this to the 3.2 milestone Dec 26, 2016
@@ -186,8 +186,36 @@ Translation
TwigBridge
----------

* The possibility to inject the Form Twig Renderer into the form extension
has been removed. Inject it into the `TwigRendererEngine` instead.
* Removed the possibility to inject the Form `TwigRenderer` into the form extension.
Copy link
Member

Choose a reason for hiding this comment

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

Missing space before *?

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, fixed

@chalasr chalasr force-pushed the twig-bridge/fix-upgrade-notes branch from 455f105 to cfd2e44 Compare December 26, 2016 20:41
@@ -5,8 +5,10 @@ CHANGELOG
-----

* added `AppVariable::getToken()`
* Deprecated the possibility to inject the Form Twig Renderer into the form
extension. Inject it on TwigRendererEngine instead.
* [BC BREAK] Deprecated the possibility to inject the Form `TwigRenderer` into the form extension.
Copy link
Member

Choose a reason for hiding this comment

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

A deprecation is not a BC break. This is the whole point of deprecation: the old way still works.

Copy link
Member Author

Choose a reason for hiding this comment

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

@stof But it is a BC break, the old way doesn't work anymore (see #21008).

Copy link
Contributor
@ogizanagi ogizanagi Dec 27, 2016

Choose a reason for hiding this comment

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

@chalasr : Thus, maybe don't mention it anymore as a deprecated possibility? 😅

[BC BREAK] Injecting the Form TwigRenderer into the FormExtension does not work anymore.

Copy link
Member Author
@chalasr chalasr Dec 27, 2016

Choose a reason for hiding this comment

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

Passing the argument still works until 4.0, the deprecation is technically valid on the method scope as calling it won't break, hence the keep of the mention. What breaks is the behavior around it, and only when using the extension outside of the full stack framework.

Updated:

[BC BREAK] Injecting the Form TwigRenderer into the FormExtension is deprecated and has no more effect.

Copy link
Member

Choose a reason for hiding this comment

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

Well, the BC break is that you have to configure a runtime loader for the TwigRenderer.

Copy link
Member

Choose a reason for hiding this comment

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

I would also add the code example to the changelog. In fact, you will probably only need the example if you are not using the full-stack framework. But then, you will also not have the upgrade files, but read the changelog instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, I moved the BC break to its own line and added the example

@chalasr chalasr force-pushed the twig-bridge/fix-upgrade-notes branch from cfd2e44 to 5934b8b Compare December 27, 2016 09:41
$twig->addExtension(new FormExtension());
```

* Deprecated the `TwigRendererEngineInterface` interface, will be removed in 4.0.
Copy link
Member

Choose a reason for hiding this comment

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

it will be removed [...]

```php
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
Renderer::class => function () use ($rendererEngine, $csrfTokenManager) {
Copy link
Member

Choose a reason for hiding this comment

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

TwigRenderer::class

```php
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
Renderer::class => function () use ($rendererEngine, $csrfTokenManager) {
Copy link
Member

Choose a reason for hiding this comment

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

TwigRenderer::class

@chalasr chalasr force-pushed the twig-bridge/fix-upgrade-notes branch 4 times, most recently from a34a899 to dd6c21e Compare December 27, 2016 13:24

```php
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
Copy link
Member

Choose a reason for hiding this comment

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

\Twig_FactoryRuntimeLoader


```php
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
Copy link
Member

Choose a reason for hiding this comment

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

\Twig_FactoryRuntimeLoader

// ...
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
// require Twig 1.30+
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
Copy link
Member

Choose a reason for hiding this comment

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

\Twig_FactoryRuntimeLoader

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@chalasr chalasr force-pushed the twig-bridge/fix-upgrade-notes branch from dd6c21e to a7ebe9c Compare December 27, 2016 19:04
@xabbuh
Copy link
Member
xabbuh commented Dec 28, 2016

👍

Status: Reviewed

@chalasr
Copy link
Member Author
chalasr commented Dec 28, 2016

Thank you for your reviews @xabbuh

@fabpot fabpot merged commit a7ebe9c into symfony:3.2 Dec 28, 2016
fabpot added a commit that referenced this pull request Dec 28, 2016
This PR was merged into the 3.2 branch.

Discussion
----------

[TwigBridge] Fix upgrade/changelog notes

| Q             | A
| ------------- | ---
| Branch?       | 3.2

The current upgrade note is wrong, the renderer cannot be injected in the `TwigRendererEngine`, only the Twig Environment can be.
Also added a missing note about the deprecated `TwigRendererEngineInterface`.

Commits
-------

a7ebe9c [TwigBridge] Fix upgrade/changelog notes
@chalasr chalasr deleted the twig-bridge/fix-upgrade-notes branch December 28, 2016 10:05
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.

7 participants
0