When you add a route to a controller function that does not exist, laravel throws a ReflectionException instead of a BadMethodCallException. The exception says that the function () does not exist.

web.php file like this (does not happen when you pass the controller and function as string)Route::get('/test', [TestController::class, 'index']);
TestController but don't create function index<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class TestController extends Controller
{
//
}
Expected behaviour would be that laravel tells which function does not exist.
Hmm, I can see why this is a problem indeed although I wouldn't necessarily label this as a bug but rather an enhancement. Welcoming PRs which might improve this error message.
Is it even the good syntax? I mean even if you put a name of existing method it wouldn't work.
The syntax is correct. I think this is possible since 5.6 or 5.7, not sure.
Am 30.01.2019 um 17:25 schrieb Inani El Houssain notifications@github.com:
Is it even the good syntax? I mean even if you put a name of existing method it wouldn't work.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Yeah it was added here: https://github.com/laravel/framework/pull/24385
may be something related to the version of PHP 7.1.20
A PR was merged that should address this: https://github.com/laravel/framework/pull/28397
Thanks @570studio