8000 [TwigBundle] Non-existing method call · Issue #20435 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] Non-existing method call #20435

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
FrancescoBorzi opened this issue Nov 7, 2016 · 8 comments
Closed

[TwigBundle] Non-existing method call #20435

FrancescoBorzi opened this issue Nov 7, 2016 · 8 comments

Comments

@FrancescoBorzi
Copy link
Contributor

In: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php#L137

there is this line:

$loader->getSource($template);

both my IDE and phpunit complain that the method getSource() does not exist, which is causing me troubles when writing unit tests.

Also I don't understand the purpose of that call, it is a get method so it is supposed to return something, but we are never using the returned value.

I guess lines 136-141 can just be removed, in that case I can open a PR.

@stof
Copy link
Member
stof commented Nov 7, 2016

Are you using the dev version of Twig 2.x ? This could be the issue. Twig 2.x is a fast moving target these days, with lots of APIs being deprecated in 1.x and removed in the dev version of 2.x (Fabien dedicated time to Twig to move towards a 2.0 release). Symfony code may not be fully updated yet for all these changes (especially if you use a stable release of Symfony rather than the dev version as well).
I suggest you to stick to Twig 1.x for now.

@FrancescoBorzi
Copy link
Contributor Author

I'm using Symfony dev version

@javiereguiluz
Copy link
Member

@ShinDarth can you please show the output of this command? Thanks!

$ composer show twig/twig

@FrancescoBorzi
Copy link
Contributor Author

@javiereguiluz sure:

name     : twig/twig
descrip. : Twig, the flexible, fast, and secure template language for PHP
keywords : templating
versions : * 2.x-dev
type     : library
license  : BSD 3-clause "New" or "Revised" License (BSD-3-Clause) (OSI approved) https://spdx.org/licenses/BSD-3-Clause.html#licenseText
source   : [git] https://github.com/twigphp/Twig.git 50c8024766a97c39d7c28a6ab3a34be43f2a7493
dist     : [zip] https://api.github.com/repos/twigphp/Twig/zipball/50c8024766a97c39d7c28a6ab3a34be43f2a7493 50c8024766a97c39d7c28a6ab3a34be43f2a7493
names    : twig/twig

autoload
psr-0
Twig_ => lib/

requires
php >=5.5
symfony/polyfill-mbstring ~1.0

requires (dev)
symfony/debug ~2.7
symfony/phpunit-bridge ~2.7

@xabbuh
Copy link
Member
xabbuh commented Nov 7, 2016

@ShinDarth Can you please check if #20440 solves the issue for you?

@FrancescoBorzi
Copy link
Contributor Author

@xabbuh at the moment I can't, I can check tomorrow. Anyway thanks for that PR, I left a comment btw.

fabpot added a commit that referenced this issue Nov 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/a

Commits
-------

adbc529 prefer getSourceContext() over getSource()
@fabpot fabpot closed this as completed Nov 7, 2016
@FrancescoBorzi
Copy link
Contributor Author

@xabbuh I've just tested and it works, thanks again.

@xabbuh
Copy link
Member
xabbuh commented Nov 8, 2016

@ShinDarth Thank you for reporting the issue initially and for providing quick feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0