php-mvc-framework
php-mvc-framework copied to clipboard
PHP 8.0: Calling non-static class methods statically result in a fatal error
Php8 does not accept
$app->router->post('/contact', [SiteController::class, 'handleContact']);
It accepts
$app->router->post('/contact', [new SiteController(), 'handleContact']);
The problem occurs if you are building the framework following the steps in the video. It is solved later in Router->resolve()
The Problem is resolved later, here.
You can specify like this $app->router->post('/contact', [SiteController::class, 'handleContact']); and it will create an instance behind