Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Removed calls to Twig\Environment::loadTemplate()#33273

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.4fromderrabus:improvement/twig-3-backports
Aug 21, 2019

Conversation

@derrabus
Copy link
Member

QA
Branch?4.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A

This PR prepares#33039. Twig 3 does not have theloadTemplate() anymore, so this PR replaces calls to that method.

if (!$themeinstanceof Template) {
/* @var Template $theme */
$theme =$this->environment->loadTemplate($theme);
$theme =$this->environment->load($theme)->unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

@fabpot the reason why we need to unwrap here is that we rely on the internalgetBlocks function of the Template class. We don't only want to use the block names, so the non-internalgetBlockNames is not enough for us (we are also relying on the internaldisplayBlock signature which has more arguments)

@fabpot
Copy link
Member

@stof is right, I read too fast. We should avoid tounwrap when not strictly needed.

@stof
Copy link
Member

the only place needing to unwrap is the form renderer engine, because it relies on internal Twig APIs to manipulate blocks (which is bad news, as there is no BC guarantee for them)

@nicolas-grekasnicolas-grekas added this to thenext milestoneAug 21, 2019
@derrabusderrabusforce-pushed theimprovement/twig-3-backports branch 2 times, most recently from2fcb90e tob792255CompareAugust 21, 2019 11:16
@derrabusderrabusforce-pushed theimprovement/twig-3-backports branch fromb792255 toea9e375CompareAugust 21, 2019 11:26
@derrabus
Copy link
MemberAuthor

I can't do much about the unwrapping inTwigRendererEngine and would advise against changingTwigEngine: it's a deprecated class anyway and we're risking a BC break.

Status: needs review

@derrabus
Copy link
MemberAuthor

CI failure seems to be an internal hiccup at Travis.

@fabpot
Copy link
Member

Thank you@derrabus.

fabpot added a commit that referenced this pull requestAug 21, 2019
This PR was merged into the 4.4 branch.Discussion----------Removed calls to Twig\Environment::loadTemplate()| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        | N/AThis PR prepares#33039. Twig 3 does not have the `loadTemplate()` anymore, so this PR replaces calls to that method.Commits-------ea9e375 Removed calls to Twig\Environment::loadTemplate().
@fabpotfabpot merged commitea9e375 intosymfony:4.4Aug 21, 2019
@derrabusderrabus deleted the improvement/twig-3-backports branchAugust 21, 2019 11:52
@nicolas-grekasnicolas-grekas modified the milestones:next,4.4Oct 27, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@stofstofstof approved these changes

@xabbuhxabbuhAwaiting requested review from xabbuhxabbuh is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@derrabus@fabpot@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp