-
Notifications
You must be signed in to change notification settings - Fork 13
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
Error when trying to use an object & method as a handler #25
Comments
The |
After doing some additional testing the only ways I have found to make a static method call are by setting the handler to Below is how the Middlewares are implemented
|
This is the code of RequestHandler middleware that decided how to handle your callable: https://github.com/middlewares/request-handler/blob/master/src/RequestHandler.php#L75 If it's a string (your case now), seems to work fine. If it's an array (like your previous case |
The class can be instantiated the method it is calling is static. |
Ok, I'll take a look. Thanks |
I am trying to register a route with fast route using an Object and static method with the following code:
instead of the handler being called I instead get the following error message:
Argument 1 passed to Middlewares\Utils\CallableHandler::__construct() must be callable, object given, called in /src/vendor/middlewares/utils/src/RequestHandlerContainer.php on line 51
In the course of trying to debug I decided to test if what I was passing was callable using the following:
This test code ran as expected and called the static object's method. Is this a bug or is there another way I should be passing an object and method as the handler?
The text was updated successfully, but these errors were encountered: