Otherwise let $this inside of closure fail.
I must have missed this...
Can I get some clarification? :)
The container is becoming 100% optional in v4. Currently in v3, there is always a container, and we bind all route callable closures' state to the container (i.e. $this inside of a route callable closure is the container). In v4, if no container is provided, we cannot bind the closure state.
Would it make more sense to completely remove that? Callables would be bound to a container whose API is undefined.
I'm assuming that we'll continue to require that the container is must conform to the container-interop interface.
@akrabat so $this->service should be removed in favor of $this->get('...') only?
@akrabat so $this->service should be removed in favor of $this->get('...') only?
Now that's a good question that we'll have to think about.
We're doing away with Pimple. And if we're going to support third-party containers, they should adhere to container-interop. And if that means only supporting $this->get('...') inside of route callable closures, that's the way I would go.
Related to #2100
Done. See https://github.com/slimphp/Slim/blob/4.x/Slim/App.php#L539-L541
Most helpful comment
We're doing away with Pimple. And if we're going to support third-party containers, they should adhere to container-interop. And if that means only supporting
$this->get('...')inside of route callable closures, that's the way I would go.