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 visibility on the add method to protected #1550

Merged
merged 2 commits into from
Oct 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Slim/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@
class App
{
use CallableResolverAwareTrait;
use MiddlewareAwareTrait {
add as addMiddleware;
}
use MiddlewareAwareTrait;

/**
* Current version
Expand Down
2 changes: 1 addition & 1 deletion Slim/MiddlewareAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ trait MiddlewareAwareTrait
* @throws RuntimeException If middleware is added while the stack is dequeuing
* @throws UnexpectedValueException If the middleware doesn't return an instance of \Psr\Http\Message\ResponseInterface
*/
public function add(callable $callable)
protected function addMiddleware(callable $callable)
{
if ($this->middlewareLock) {
throw new RuntimeException('Middleware can’t be added once the stack is dequeuing');
Expand Down
4 changes: 1 addition & 3 deletions Slim/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
*/
class Route extends Routable implements RouteInterface
{
use MiddlewareAwareTrait {
add as addMiddleware;
}
use MiddlewareAwareTrait;

/**
* HTTP methods supported by this route
Expand Down
6 changes: 6 additions & 0 deletions tests/Mocks/Stackable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public function testMiddlewareKernel(ServerRequestInterface $req, ResponseInterf
{
return $res->write('hello from testMiddlewareKernel');
}

public function add($callable)
{
$this->addMiddleware($callable);
return $this;
}
}