Hello to everyone,
I’m reading this article on Glenn Eggleton’s blog and got a doubt about controller callbacks:
He explains it is possible to provide a php array callback to a route as follows:
//Option A $app->get('/hello', /*Route Action*/ [MyAction::class, 'myAction']); //MyAction defines myAction($req, $args)
However when I do so, I’m getting the following error:
Using $this when not in object context in....
The route works ok if I use the ‘classname:method’ style.
Is it really possible to do it that way? Wouldn’t the first field of the array callback need to be an object instead of a class name to be considered a valid php callback?