8000 Added source file in debug info when available by nicolas-grekas · Pull Request #2170 · twigphp/Twig · GitHub
[go: up one dir, main page]

Skip to content

Added source file in debug info when available #2170

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

Closed
wants to merge 1 commit into from

Conversation

nicolas-grekas
Copy link
Contributor

We need the source file to create IDE links from $template objects found in e.g. exceptions'' trace/context.

switch (false) {
case $env->isDebug():
case ($loader = $env->getLoader()) instanceof Twig_Loader_Filesystem:
case file_exists($file = $loader->getCacheKey($this->getAttribute('filename'))):
Copy link
Member

Choose a reason for hiding this comment

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

This code defining a variable in a case statement to use it in the next one (but only when the condition is false) is totally unreadable.

Copy link
Member

Choose a reason for hiding this comment

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

btw, I had to read it 5 times before being convinced it does actually the right thing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at least the PHP engine understands me ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to a more boring CS :)

@nicolas-grekas nicolas-grekas force-pushed the debug-file branch 2 times, most recently from 8311939 to a0d5f8d Compare October 7, 2016 08:23
@nicolas-grekas
Copy link
Contributor Author

I can't see any better way, except maybe undeprecating getEnvironment().

@nicolas-grekas
Copy link
Contributor Author

Closed in favor of #2182

@nicolas-grekas nicolas-grekas deleted the debug-file branch October 15, 2016 22:25
fabpot added a commit that referenced this pull request Oct 17, 2016
…l template (fabpot)

This PR was merged into the 1.x branch.

Discussion
----------

added Twig_Source to hold information about the original template

Alternative to #2170

Commits
-------

6c76583 added Twig_Source to hold information about the original template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0