| @@ -43,9 +43,9 @@ | ||
| 43 | 43 | * @param (callable(RequestInterface, array): PromiseInterface)|null $handler HTTP handler function to use with the stack. If no |
| 44 | 44 | * handler is provided, the best handler for your |
| 45 | 45 | * system will be utilized. |
| 46 | 46 | */ |
| 47 | - public static function create(callable $handler = null): self | |
| 47 | + public static function create(?callable $handler = null): self | |
| 48 | 48 | { |
| 49 | 49 | $stack = new self($handler ?: Utils::chooseHandler()); |
| 50 | 50 | $stack->push(Middleware::httpErrors(), 'http_errors'); |
| 51 | 51 | $stack->push(Middleware::redirect(), 'allow_redirects'); |
| @@ -85,16 +85,16 @@ | ||
| 85 | 85 | $depth = 0; |
| 86 | 86 | $stack = []; |
| 87 | 87 | |
| 88 | 88 | if ($this->handler !== null) { |
| 89 | - $stack[] = '0) Handler: '.$this->debugCallable($this->handler); | |
| 89 | + $stack[] = "0) Handler: " . $this->debugCallable($this->handler); | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $result = ''; |
| 93 | 93 | foreach (\array_reverse($this->stack) as $tuple) { |
| 94 | - ++$depth; | |
| 94 | + $depth++; | |
| 95 | 95 | $str = "{$depth}) Name: '{$tuple[1]}', "; |
| 96 | - $str .= 'Function: '.$this->debugCallable($tuple[0]); | |
| 96 | + $str .= "Function: " . $this->debugCallable($tuple[0]); | |
| 97 | 97 | $result = "> {$str}\n{$result}"; |
| 98 | 98 | $stack[] = $str; |
| 99 | 99 | } |
| 100 | 100 | |
| @@ -121,9 +121,9 @@ | ||
| 121 | 121 | * Returns true if the builder has a handler. |
| 122 | 122 | */ |
| 123 | 123 | public function hasHandler(): bool |
| 124 | 124 | { |
| 125 | - return $this->handler !== null; | |
| 125 | + return $this->handler !== null ; | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * Unshift a middleware to the bottom of the stack. |
| @@ -130,9 +130,9 @@ | ||
| 130 | 130 | * |
| 131 | 131 | * @param callable(callable): callable $middleware Middleware function |
| 132 | 132 | * @param string $name Name to register for this middleware. |
| 133 | 133 | */ |
| 134 | - public function unshift(callable $middleware, string $name = null): void | |
| 134 | + public function unshift(callable $middleware, ?string $name = null): void | |
| 135 | 135 | { |
| 136 | 136 | \array_unshift($this->stack, [$middleware, $name]); |
| 137 | 137 | $this->cached = null; |
| 138 | 138 | } |
| @@ -265,11 +265,11 @@ | ||
| 265 | 265 | |
| 266 | 266 | if (\is_array($fn)) { |
| 267 | 267 | return \is_string($fn[0]) |
| 268 | 268 | ? "callable({$fn[0]}::{$fn[1]})" |
| 269 | - : "callable(['".\get_class($fn[0])."', '{$fn[1]}'])"; | |
| 269 | + : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])"; | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** @var object $fn */ |
| 273 | - return 'callable('.\spl_object_hash($fn).')'; | |
| 273 | + return 'callable(' . \spl_object_hash($fn) . ')'; | |
| 274 | 274 | } |
| 275 | 275 | } |