Thanks, it did cross my mind to check the source, but I did not. The question I was pondering is why Laravel would make such a regressive change given that Route:: still accepts the array syntax. I'm curious what the issue might be, because I have the same L8 and L9 code running on PHP 8.1.
I think new and resolve will instantiate the class at registration and not only upon use, correct?
@laracoft Laravel didnt make any changes? That was what I pointed out. I cannot say how your original code ever worked, as it isnt valid! You need to pass a class instance and a method name.. Are you sure you didnt change it at all since it worked?
And yes it will instantiate the class (as it should) but not call the method.
I did not click the links, you said you don't see any difference. And I just checked, both links are using callable ..., what is the difference?
When we call Route::get("/url", [MyController::class, "method"]);, it is valid code, there is no instantiation, that's more efficient and is what I'm alluding to. Blade::directive(...) used to be like this as well.
@laracoft Exactly. Again Laravel didnt change anything. So asking for it to work like with a route would be a new feature. You can try making a PR to allow it if you want
Ok, I don't have time to get into the meat of it right now, but I used Blade::directive(...) to insert javascripts, the website would not have worked if those JS were missing, thus implying directive accepted arrays, there might be some explanation for all this.. when I get to it.
@laracoft Ah ok interesting to know :) And as I understood, it was a requirement that it was not static? So I assume it was static when you used laravel 8