[7.x] Parameterless Component Methods Invokable With & Without Parens#32560
Conversation
|
For the record, this fixes a concern brought up in laravel/ideas#2129 I still think this is a backwards-incompatible change. Say we have a function on the Blade component: public function foo()
{
return 'bar';
}Which in turn we used in the Blade with Prior to this change, With this change, it would now only execute the I'm not using the former behaviour myself, but still, see it as a breaking change. I like the change and more consistent behaviour myself and would love to see it in 8.x Edit: I'd also note that this doesn't fix the discrepancy between whether or not |
|
I'm not particularly concerned about that breaking change as I very sincerely doubt anyone is doing that. |
Because we need the feature from laravel/framework#32560
Because we need the feature from laravel/framework#32560
Because we need the feature from laravel/framework#32560
This change allows parameterless Blade component methods to be invoked using no parameters or using parameters:
{{ $foo }} {{ $foo() }}It's easy to forget that these methods currently are not able to called with parentheses. I have stumbled on this myself. This should be backward compatible since both ways of echoing the value are supported.