Skip to content

Conversation

@mrofi
Copy link

@mrofi mrofi commented Dec 3, 2014

Return of method findClosure() is Closure Object that is callable and must be an object. So only using is_callable() function isn't enough. A string could be callable, example when you adding alias 'app' in your route.
Route::get('apps', array('as' => 'app', function()
{
//
})); will make an error.

screenshot from 2014-12-03 23 16 49

@JoostK
Copy link
Contributor

JoostK commented Dec 3, 2014

Good catch (this has been like this for ages) but why not just use $value instanceof Closure.

@mrofi
Copy link
Author

mrofi commented Dec 3, 2014

Roger that, Mr. JoostK
Thank you. I have changed it.

@mrofi mrofi changed the title adding is_object() in findClosure() method adding $value of Closure in findClosure() method Dec 3, 2014
@JoostK
Copy link
Contributor

JoostK commented Dec 3, 2014

You can further simplify it to just return $value instanceof Closure; (and use Closure; at the top of the file), because is_callable on a closure always returns true.

@mrofi
Copy link
Author

mrofi commented Dec 3, 2014

Sorry, I just a newbie and try to make this working out. Once again thank you Mr. JoostK

@GrahamCampbell
Copy link
Collaborator

Please squash to one commit.

@GrahamCampbell GrahamCampbell changed the title adding $value of Closure in findClosure() method [4.2] Make "findClosure" Actually Find Closures Dec 5, 2014
@ibrasho
Copy link
Contributor

ibrasho commented Dec 6, 2014

If you don't know how to squash: http://davidwalsh.name/squash-commits-git

Return of method findClosure() is Closure Object that is callable and must be an object. So only using is_callabel() function isn't enough. A string could be callable, example when you adding alias 'app' in your route.
Route::get('apps', array('as' => 'app', function()
{
//
})); will make an error.

change is_object to ($value instanceOf \Closure)

we just need $value instanceOf Closure;
@mrofi
Copy link
Author

mrofi commented Dec 7, 2014

Is it done, right?
I just follow the instruction on the website http://davidwalsh.name/squash-commits-git

@jasonlewis
Copy link
Contributor

Yeah mate looks good. 👍

@mrofi
Copy link
Author

mrofi commented Dec 7, 2014

Thank's all..
seems like a long journey for noob like me.

@taylorotwell
Copy link
Member

It should just be findCallable then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants