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

Change the BladeCompiler::if type-hint to callable like directive #20025

Merged
merged 3 commits into from
Jul 13, 2017
Merged

Change the BladeCompiler::if type-hint to callable like directive #20025

merged 3 commits into from
Jul 13, 2017

Conversation

paulredmond
Copy link
Contributor

@paulredmond paulredmond commented Jul 12, 2017

I proposed a feature in laravel/ideas#682 and noticed that the Blade::if() signature doesn't allow callable like Blade::directive() does.

I've updated the Blade::if() method to a callable type-hint to allow more flexibility in how you define a conditional directive.

The `Blade::if()` method accepts `callable` to allow more flexibility in
how you call the conditional directive. This type-hint matches the
`Blade::directive()` type-hint.
@paulredmond
Copy link
Contributor Author

This might be the smallest PR ever 😄

@@ -358,7 +358,7 @@ public function getExtensions()
* @param \Closure $callback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would need to make this @param callable $callback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laurencei nice catch, thanks

@paulredmond
Copy link
Contributor Author

It was also pointed out to me that \Closure::fromCallable() could be used to convert a callable, but I think its better to make them consistent. Thoughts?

@paulredmond paulredmond changed the title Change the type-hint to callable like directive Change the BladeCompiler::if type-hint to callable like directive Jul 12, 2017
@taylorotwell taylorotwell merged commit 4f689b3 into laravel:master Jul 13, 2017
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

Successfully merging this pull request may close these issues.

3 participants