Does not understand 'Higher Order Messages'
Dylan-DutchAndBold opened this issue · 2 comments
I have this line of code in Twig:
user.roles.first.is(role)
to truth check if I should set an option to selected. This should translate to $user->roles->first->is($role)
. But it seems to do something more in the ballpark of this $user->roles->first()->is($role)
I believe it goes bad on line 582
of Twig\Template
. It does an isset check of the property. But since the HigherOrderCollectionProxy
is created in the magic __get
method of a Collection
. It returns false and tries it as a function.
I have created a possible solution to this issue, it actually does the same as what it does for a Model class objects. However this does mean that if you'd use to use something like this before: user.roles.first.name
, it will now no longer work. You'd now have to write user.roles.first().name
. So this might be unwanted.