Skip to content

Harden the debugging of Twig filters and functions #22994

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
May 31, 2017

Conversation

stof
Copy link
Member

@stof stof commented May 31, 2017

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

Removing the environment and context arguments is now based on Twig metadata rather than on some wild guessing which might go wrong:

  • the environment argument may not be typehinted
  • the context argument may not be named $context
  • an argument may be named $context without being the special context argument

Removing the environment and context arguments is now based on Twig metadata
rather than on some wild guessing which might go wrong.

return !$param->getClass() || $param->getClass()->getName() !== 'Twig_Environment';
});
if ($type === 'filters') {
Copy link
Member

Choose a reason for hiding this comment

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

let's use yoda-style then :)

Copy link
Member Author

Choose a reason for hiding this comment

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

none of the conditions in this class are using yoda-style actually

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone May 31, 2017
@fabpot
Copy link
Member

fabpot commented May 31, 2017

Thank you @stof.

@fabpot fabpot merged commit 63a8aff into symfony:2.7 May 31, 2017
fabpot added a commit that referenced this pull request May 31, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

Harden the debugging of Twig filters and functions

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Removing the environment and context arguments is now based on Twig metadata rather than on some wild guessing which might go wrong:

- the environment argument may not be typehinted
- the context argument may not be named `$context`
- an argument may be named `$context` without being the special context argument

Commits
-------

63a8aff Harden the debugging of Twig filters and functions
@stof stof deleted the clean_twig_debug branch May 31, 2017 17:29
This was referenced Jun 5, 2017
@fabpot fabpot mentioned this pull request Jul 4, 2017
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.

4 participants