You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to support -> for object property access in Volt, either as an alternative to . or as the preferred syntax?
PHP developers are already accustomed to using -> for object properties, while Volt currently uses .. Arrays already use the familiar PHP syntax (['key']), so allowing -> for objects would make the transition between PHP and Volt more intuitive and reduce the mental context switch when moving between templates and PHP code.
I realize this would be a language-level change and may have backward compatibility considerations, but I think it would improve consistency with standard PHP syntax and make Volt feel more natural to PHP developers.
The problem is not "->" being the same as "." for objects. That is the 3 line change. The issue is the arrays, and that will require a lot more changes.
Activity
niden commentedon Aug 1, 2026
I am putting this for consideration in v7.
The problem is not "->" being the same as "." for objects. That is the 3 line change. The issue is the arrays, and that will require a lot more changes.