Skip to content

Commit

Permalink
Finally gave in to removing preceding space on return type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
philipobenito committed Jun 30, 2019
1 parent 9fcb2bf commit ccea1e7
Show file tree
Hide file tree
Showing 28 changed files with 174 additions and 174 deletions.
2 changes: 1 addition & 1 deletion docs/4.x/controllers.md
Expand Up @@ -266,4 +266,4 @@ $router->map('GET', '/', 'Acme\controller');

## Dependency Injection

Where Route is instantiating the objects for your defined controller, a dependency injection container can be used to resolve those objects. Read more on dependency injection [here](/docs/4.x/dependency-injection.md).
Where Route is instantiating the objects for your defined controller, a dependency injection container can be used to resolve those objects. Read more on dependency injection [here](/docs/4.x/dependency-injection/).
4 changes: 2 additions & 2 deletions src/ContainerAwareInterface.php
Expand Up @@ -11,7 +11,7 @@ interface ContainerAwareInterface
*
* @return ContainerInterface|null
*/
public function getContainer() : ?ContainerInterface;
public function getContainer(): ?ContainerInterface;

/**
* Set the container implementation
Expand All @@ -20,5 +20,5 @@ public function getContainer() : ?ContainerInterface;
*
* @return static
*/
public function setContainer(ContainerInterface $container) : ContainerAwareInterface;
public function setContainer(ContainerInterface $container): ContainerAwareInterface;
}
4 changes: 2 additions & 2 deletions src/ContainerAwareTrait.php
Expand Up @@ -14,15 +14,15 @@ trait ContainerAwareTrait
/**
* {@inheritdoc}
*/
public function getContainer() : ?ContainerInterface
public function getContainer(): ?ContainerInterface
{
return $this->container;
}

/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container) : ContainerAwareInterface
public function setContainer(ContainerInterface $container): ContainerAwareInterface
{
$this->container = $container;

Expand Down
12 changes: 6 additions & 6 deletions src/Dispatcher.php
Expand Up @@ -25,7 +25,7 @@ class Dispatcher extends GroupCountBasedDispatcher implements
*
* @return ResponseInterface
*/
public function dispatchRequest(ServerRequestInterface $request) : ResponseInterface
public function dispatchRequest(ServerRequestInterface $request): ResponseInterface
{
$httpMethod = $request->getMethod();
$uri = $request->getUri()->getPath();
Expand Down Expand Up @@ -58,7 +58,7 @@ public function dispatchRequest(ServerRequestInterface $request) : ResponseInter
* @return Route
*
*/
private function ensureHandlerIsRoute($matchingHandler, $httpMethod, $uri) : Route
private function ensureHandlerIsRoute($matchingHandler, $httpMethod, $uri): Route
{
if (is_a($matchingHandler, Route::class)) {
return $matchingHandler;
Expand All @@ -69,7 +69,7 @@ private function ensureHandlerIsRoute($matchingHandler, $httpMethod, $uri) : Rou
/**
* {@inheritdoc}
*/
public function handle(ServerRequestInterface $request) : ResponseInterface
public function handle(ServerRequestInterface $request): ResponseInterface
{
$middleware = $this->shiftMiddleware();

Expand All @@ -83,7 +83,7 @@ public function handle(ServerRequestInterface $request) : ResponseInterface
*
* @return void
*/
protected function setFoundMiddleware(Route $route) : void
protected function setFoundMiddleware(Route $route): void
{
if ($route->getStrategy() === null) {
$route->setStrategy($this->getStrategy());
Expand Down Expand Up @@ -118,7 +118,7 @@ protected function setFoundMiddleware(Route $route) : void
*
* @return void
*/
protected function setNotFoundDecoratorMiddleware() : void
protected function setNotFoundDecoratorMiddleware(): void
{
$middleware = $this->getStrategy()->getNotFoundDecorator(new NotFoundException);
$this->prependMiddleware($middleware);
Expand All @@ -131,7 +131,7 @@ protected function setNotFoundDecoratorMiddleware() : void
*
* @return void
*/
protected function setMethodNotAllowedDecoratorMiddleware(array $allowed) : void
protected function setMethodNotAllowedDecoratorMiddleware(array $allowed): void
{
$middleware = $this->getStrategy()->getMethodNotAllowedDecorator(
new MethodNotAllowedException($allowed)
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Exception.php
Expand Up @@ -48,23 +48,23 @@ public function __construct(
/**
* {@inheritdoc}
*/
public function getStatusCode() : int
public function getStatusCode(): int
{
return $this->status;
}

/**
* {@inheritdoc}
*/
public function getHeaders() : array
public function getHeaders(): array
{
return $this->headers;
}

/**
* {@inheritdoc}
*/
public function buildJsonResponse(ResponseInterface $response) : ResponseInterface
public function buildJsonResponse(ResponseInterface $response): ResponseInterface
{
$this->headers['content-type'] = 'application/json';

Expand Down
6 changes: 3 additions & 3 deletions src/Http/Exception/HttpExceptionInterface.php
Expand Up @@ -11,14 +11,14 @@ interface HttpExceptionInterface
*
* @return integer
*/
public function getStatusCode() : int;
public function getStatusCode(): int;

/**
* Return an array of headers provided when the exception was thrown
*
* @return array
*/
public function getHeaders() : array;
public function getHeaders(): array;

/**
* Accepts a response object and builds it in to a json representation of the exception.
Expand All @@ -27,5 +27,5 @@ public function getHeaders() : array;
*
* @return ResponseInterface
*/
public function buildJsonResponse(ResponseInterface $response) : ResponseInterface;
public function buildJsonResponse(ResponseInterface $response): ResponseInterface;
}
10 changes: 5 additions & 5 deletions src/Middleware/MiddlewareAwareInterface.php
Expand Up @@ -13,7 +13,7 @@ interface MiddlewareAwareInterface
*
* @return static
*/
public function middleware(MiddlewareInterface $middleware) : MiddlewareAwareInterface;
public function middleware(MiddlewareInterface $middleware): MiddlewareAwareInterface;

/**
* Add multiple middleware to the stack
Expand All @@ -22,7 +22,7 @@ public function middleware(MiddlewareInterface $middleware) : MiddlewareAwareInt
*
* @return static
*/
public function middlewares(array $middlewares) : MiddlewareAwareInterface;
public function middlewares(array $middlewares): MiddlewareAwareInterface;

/**
* Prepend a middleware to the stack
Expand All @@ -31,19 +31,19 @@ public function middlewares(array $middlewares) : MiddlewareAwareInterface;
*
* @return static
*/
public function prependMiddleware(MiddlewareInterface $middleware) : MiddlewareAwareInterface;
public function prependMiddleware(MiddlewareInterface $middleware): MiddlewareAwareInterface;

/**
* Shift a middleware from beginning of stack
*
* @return MiddlewareInterface|null
*/
public function shiftMiddleware() : MiddlewareInterface;
public function shiftMiddleware(): MiddlewareInterface;

/**
* Get the stack of middleware
*
* @return MiddlewareInterface[]
*/
public function getMiddlewareStack() : iterable;
public function getMiddlewareStack(): iterable;
}
18 changes: 9 additions & 9 deletions src/Middleware/MiddlewareAwareTrait.php
Expand Up @@ -17,7 +17,7 @@ trait MiddlewareAwareTrait
/**
* {@inheritdoc}
*/
public function middleware(MiddlewareInterface $middleware) : MiddlewareAwareInterface
public function middleware(MiddlewareInterface $middleware): MiddlewareAwareInterface
{
$this->middleware[] = $middleware;

Expand All @@ -27,7 +27,7 @@ public function middleware(MiddlewareInterface $middleware) : MiddlewareAwareInt
/**
* {@inheritdoc}
*/
public function middlewares(array $middlewares) : MiddlewareAwareInterface
public function middlewares(array $middlewares): MiddlewareAwareInterface
{
foreach ($middlewares as $middleware) {
$this->middleware($middleware);
Expand All @@ -39,7 +39,7 @@ public function middlewares(array $middlewares) : MiddlewareAwareInterface
/**
* {@inheritdoc}
*/
public function prependMiddleware(MiddlewareInterface $middleware) : MiddlewareAwareInterface
public function prependMiddleware(MiddlewareInterface $middleware): MiddlewareAwareInterface
{
array_unshift($this->middleware, $middleware);

Expand All @@ -53,7 +53,7 @@ public function prependMiddleware(MiddlewareInterface $middleware) : MiddlewareA
*
* @return static
*/
public function lazyMiddleware(string $middleware) : MiddlewareAwareInterface
public function lazyMiddleware(string $middleware): MiddlewareAwareInterface
{
$this->middleware[] = $middleware;

Expand All @@ -67,7 +67,7 @@ public function lazyMiddleware(string $middleware) : MiddlewareAwareInterface
*
* @return static
*/
public function lazyMiddlewares(array $middlewares) : MiddlewareAwareInterface
public function lazyMiddlewares(array $middlewares): MiddlewareAwareInterface
{
foreach ($middlewares as $middleware) {
$this->lazyMiddleware($middleware);
Expand All @@ -83,7 +83,7 @@ public function lazyMiddlewares(array $middlewares) : MiddlewareAwareInterface
*
* @return static
*/
public function lazyPrependMiddleware(string $middleware) : MiddlewareAwareInterface
public function lazyPrependMiddleware(string $middleware): MiddlewareAwareInterface
{
array_unshift($this->middleware, $middleware);

Expand All @@ -93,7 +93,7 @@ public function lazyPrependMiddleware(string $middleware) : MiddlewareAwareInter
/**
* {@inheritdoc}
*/
public function shiftMiddleware() : MiddlewareInterface
public function shiftMiddleware(): MiddlewareInterface
{
$middleware = array_shift($this->middleware);

Expand All @@ -107,7 +107,7 @@ public function shiftMiddleware() : MiddlewareInterface
/**
* {@inheritdoc}
*/
public function getMiddlewareStack() : iterable
public function getMiddlewareStack(): iterable
{
return $this->middleware;
}
Expand All @@ -120,7 +120,7 @@ public function getMiddlewareStack() : iterable
*
* @return MiddlewareInterface
*/
protected function resolveMiddleware($middleware, ?ContainerInterface $container = null) : MiddlewareInterface
protected function resolveMiddleware($middleware, ?ContainerInterface $container = null): MiddlewareInterface
{
if ($container === null && is_string($middleware) && class_exists($middleware)) {
$middleware = new $middleware;
Expand Down
16 changes: 8 additions & 8 deletions src/Route.php
Expand Up @@ -65,7 +65,7 @@ public function __construct(string $method, string $path, $handler)
public function process(
ServerRequestInterface $request,
RequestHandlerInterface $requestHandler
) : ResponseInterface {
): ResponseInterface {
return $this->getStrategy()->invokeRouteCallable($this, $request);
}

Expand All @@ -78,7 +78,7 @@ public function process(
*
* @throws InvalidArgumentException
*/
public function getCallable(?ContainerInterface $container = null) : callable
public function getCallable(?ContainerInterface $container = null): callable
{
$callable = $this->handler;

Expand Down Expand Up @@ -127,7 +127,7 @@ protected function resolveClass(?ContainerInterface $container = null, string $c
*
* @return array
*/
public function getVars() : array
public function getVars(): array
{
return $this->vars;
}
Expand All @@ -139,7 +139,7 @@ public function getVars() : array
*
* @return Route
*/
public function setVars(array $vars) : self
public function setVars(array $vars): self
{
$this->vars = $vars;

Expand All @@ -151,7 +151,7 @@ public function setVars(array $vars) : self
*
* @return RouteGroup
*/
public function getParentGroup() : ?RouteGroup
public function getParentGroup(): ?RouteGroup
{
return $this->group;
}
Expand All @@ -163,7 +163,7 @@ public function getParentGroup() : ?RouteGroup
*
* @return Route
*/
public function setParentGroup(RouteGroup $group) : self
public function setParentGroup(RouteGroup $group): self
{
$this->group = $group;
$prefix = $this->group->getPrefix();
Expand All @@ -182,7 +182,7 @@ public function setParentGroup(RouteGroup $group) : self
*
* @return string
*/
public function getPath() : string
public function getPath(): string
{
return $this->path;
}
Expand All @@ -192,7 +192,7 @@ public function getPath() : string
*
* @return string
*/
public function getMethod() : string
public function getMethod(): string
{
return $this->method;
}
Expand Down
2 changes: 1 addition & 1 deletion src/RouteCollectionInterface.php
Expand Up @@ -13,7 +13,7 @@ interface RouteCollectionInterface
*
* @return Route
*/
public function map(string $method, string $path, $handler) : Route;
public function map(string $method, string $path, $handler): Route;

/**
* Add a route that responds to GET HTTP method
Expand Down

0 comments on commit ccea1e7

Please sign in to comment.