slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.94k stars 1.95k forks source link

[Slim3] Allow callable #1430

Closed harikt closed 9 years ago

harikt commented 9 years ago

Hi,

I have noticed the resolve https://github.com/slimphp/Slim/blob/3.x/Slim/CallableResolver.php#L77 is not checking if it is callable.

So even if you create a route like

class LoginAction
{
    public function __invoke(...)
    {
    }
}

$app->get('/login', 'App\Controllers\Login\LoginAction')
    ->setName('login');

is not calling and throwing exception could not resolve. It can be resolved getting from the container and checking is callable ?

silentworks commented 9 years ago

This is now fixed, thanks for the feedback @harikt

harikt commented 9 years ago

Thank you @silentworks and @akrabat .

Sorry that I wasn't able to send a PR than opening an issue :-/ . Got a bit busy .

akrabat commented 9 years ago

we're always happy with an issue report :)