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

[TwigBridge][TwigBundle][HttpKernel] prefer getSourceContext() over getSource()#20440

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:2.7fromxabbuh:issue-20435
Nov 7, 2016

Conversation

@xabbuh
Copy link
Member

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#20435
LicenseMIT
Doc PRn/a

$loader =$this->environment->getLoader();

if ($loaderinstanceof \Twig_ExistsLoaderInterface) {
if ($loaderinstanceof \Twig_ExistsLoaderInterface ||method_exists($loader,'exists')) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

In Twig 2.0, theexists() method will be present in theTwig_LoaderInterface.

Copy link
Member

Choose a reason for hiding this comment

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

This is not needed asTwig_ExistsLoaderInterface still exist in 2.0. It will be removed in 3.0 only.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The call toexists() will never be made though if the loader does not implementTwig_ExistsLoaderInterface, but is just an instance ofTwig_LoaderInterface.

Copy link
Member

Choose a reason for hiding this comment

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

indeed

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

And this seems to happen. Otherwise, I don't see how#20435 would ever reach thegetSource() call.

$loader->getSourceContext($template);
}else {
$loader->getSource($template);
}
Copy link
Contributor

@FrancescoBorziFrancescoBorziNov 7, 2016
edited
Loading

Choose a reason for hiding this comment

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

I would suggest:... } else if (method_exists($loader, 'getSource')) { ... instead of line150


try {
$loader->getSource($template);
if (method_exists($loader,'getSourceContext')) {
Copy link
Member

Choose a reason for hiding this comment

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

👍 as HttpKernel does not constrain Twig version.

@xabbuh
Copy link
MemberAuthor

fabbot failures are unrelated.

@fabpot
Copy link
Member

Thank you@xabbuh.

@fabpotfabpot merged commitadbc529 intosymfony:2.7Nov 7, 2016
fabpot added a commit that referenced this pull requestNov 7, 2016
…xt() over getSource() (xabbuh)This PR was merged into the 2.7 branch.Discussion----------[TwigBridge][TwigBundle][HttpKernel] prefer getSourceContext() over getSource()| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#20435| License       | MIT| Doc PR        | n/aCommits-------adbc529 prefer getSourceContext() over getSource()
fabpot added a commit to twigphp/Twig that referenced this pull requestNov 7, 2016
This PR was merged into the 1.x branch.Discussion----------add machine-readable version constantsThis will make it easier to implement version depending features (seesymfony/symfony#20440 (comment) for an example).Commits-------bf07db4 add machine-readable version constants
@xabbuhxabbuh deleted the issue-20435 branchNovember 7, 2016 19:39
@FrancescoBorzi
Copy link
Contributor

good job@xabbuh

This was referencedNov 17, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

+1 more reviewer

@FrancescoBorziFrancescoBorziFrancescoBorzi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@xabbuh@fabpot@FrancescoBorzi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp