Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.0: Calling non-static class methods statically result in a fatal error #7

Open
ERP-Academia opened this issue May 11, 2021 · 1 comment

Comments

@ERP-Academia
Copy link

ERP-Academia commented May 11, 2021

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()

@thecodeholic
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants