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

[VarDumper] Fix source links with latests Twig versions#20175

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
nicolas-grekas merged 1 commit intosymfony:2.8fromnicolas-grekas:dump-twig
Oct 18, 2016

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?2.8
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Sibling to#20173

@fabpot
Copy link
Member

Closing in favor of#20224

@fabpotfabpot closed thisOct 17, 2016
@nicolas-grekasnicolas-grekasforce-pushed thedump-twig branch 3 times, most recently fromcdaa6dc to6401a33CompareOctober 18, 2016 09:58
$templateInfo =$template->getDebugInfo();
if (isset($templateInfo[$f['line']])) {
if (method_exists($template,'getSourceContext')) {
$templateName =$template->getSourceContext()->getPath();
Copy link
Member

Choose a reason for hiding this comment

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

you should overwrite it only when the path is not null (not all loaders can give you a path, as not all of them are based on a file)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

$templateInfo =$template->getDebugInfo();
if (isset($templateInfo[$f['line']])) {
$templateName =$template->getTemplateName();
$templateSrc =method_exists($template,'getSourceContext') ?$template->getSourceContext()->getCode() : (method_exists($template,'getSource') ?$template->getSource() :false);
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 empty string rather thanfalse, to have a consistent variable type (getCode() will return the empty string in non-debug mode anyway)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

twig source
";
returnnewTwig_Source(" foo bar\n twig source\n\n",'foo.twig','foo.twig');
Copy link
Member

Choose a reason for hiding this comment

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

Please also add tests for other cases:

  • Twig_Source with an empty code string (i.e. a non-debug compilation)
  • Twig_Source without a path (i.e. a loader not based on the filesystem, or a loader not updated to use new features)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Bof, that's only a caster, adding a test for that would be quite a bit of work for a minor thing to me...

Copy link
Member

Choose a reason for hiding this comment

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

well, it would avoid issues when refactoring it, reintroducing the bugs I spotted during the review

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

tests added

@nicolas-grekasnicolas-grekasforce-pushed thedump-twig branch 2 times, most recently fromd71fcd9 to888e4bdCompareOctober 18, 2016 14:18
@nicolas-grekasnicolas-grekas merged commitf3b09d9 intosymfony:2.8Oct 18, 2016
nicolas-grekas added a commit that referenced this pull requestOct 18, 2016
…icolas-grekas)This PR was merged into the 2.8 branch.Discussion----------[VarDumper] Fix source links with latests Twig versions| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Sibling to#20173Commits-------f3b09d9 [VarDumper] Fix source links with latests Twig versions
@nicolas-grekasnicolas-grekas deleted the dump-twig branchOctober 18, 2016 16:01
This was referencedOct 27, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof requested changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@fabpot@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp