Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #2009 Clarify exception message in Twig_Template::getAttribut…
…e (chalasr) This PR was merged into the 1.x branch. Discussion ---------- Clarify exception message in Twig_Template::getAttribute When a non existing property/method is called for an object, the exception message is: > Method "property()" for object "[class]" does not exist in [template]" But in fact the `Twig_Template::getAttribute()` method check for (at least) 3 more methods (`isProperty()`, `getProperty()` and `__call__()`). It could be more adapted and easier to be debugged if the message would be: > Neither the property "property" nor one of the methods "property]()", "getProperty()"/"isPropertyt()" or "__call()" exist and have public access in class "[class]" in [template] This message is mostly inspired from the one used in the PropertyAccess component. BTW I think that it would be great to replace all the checks listed above by a `PropertyAccessor::isReadable([property])`. I can work on a PR if it's not overkill. Commits ------- d455b52 Clarify exception message in Twig_Template::getAttribute
- Loading branch information