-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix Laravel 5.4 support #10
Conversation
Since Laravel 5.4: > the container's make method no longer accepts a second array of parameters.
We could wait for this to be tagged: laravel/framework@5d9b363 |
Oh, I wasn't aware of this |
Sounds good |
Since Laravel 5.4.16, the Container::makeWith($class, $params) method replace the old behavior of Container::make() method.
Ready to go? |
No, I need to do some manual tests... |
The |
I successfully call the In // Add kernel as 'app' parameter
$params['app'] = $kernel;
$makeMethod = method_exists($this->container, 'makeWith') ? 'makeWith' : 'make';
$middleware = $this->container->$makeMethod($callable, $params); And in my Turbolinks Service Provider $stack->bind(
'Frenzy\Turbolinks\Middleware\StackTurbolinks',
'Helthe\Component\Turbolinks\StackTurbolinks',
[$this->app['turbolinks']]
); By this one: $stack->bind(
'Frenzy\Turbolinks\Middleware\StackTurbolinks',
'Helthe\Component\Turbolinks\StackTurbolinks',
['turbolinks' => $this->app['turbolinks']]
); See The |
I've open an issue on the Laravel Framework repository, see: laravel/framework#18474 |
According to @themsaid laravel/framework#18474 (comment),
So it's a breaking change compared to the behavior of $stack->bind(
'Frenzy\Turbolinks\Middleware\StackTurbolinks',
'Helthe\Component\Turbolinks\StackTurbolinks',
[$this->app['turbolinks']]
); We need to bind Laravel Stack Middleware, like that: $stack->bind(
'Frenzy\Turbolinks\Middleware\StackTurbolinks',
'Helthe\Component\Turbolinks\StackTurbolinks',
['turbolinks' => $this->app['turbolinks']]
); |
OK can you update the pr? |
@barryvdh Done, but these breaking changes should be documented in the README.md |
Is it breaking? |
When I said "it's a breaking change", I mean, you can't do this anymore: app('stack')->bind('AddRobotsHeaders', 'League\StackRobots\Robots', ['production', 'APP_ENV']); Instead, you need to do this: app('stack')->bind('AddRobotsHeaders', 'League\StackRobots\Robots', ['env' => 'production', 'envVar' => 'APP_ENV']); |
Fix the
BindingResolutionException
:Because, since Laravel 5.4:
We also can use this line of code, but it's only compatible with PHP >= 5.6.0:
Source: http://stackoverflow.com/a/2409288