@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Return a response for application/json content not found |
64 | 64 | * |
65 | - * @return ResponseInterface |
|
65 | + * @return string |
|
66 | 66 | */ |
67 | 67 | protected function renderJsonNotFoundOutput() |
68 | 68 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Return a response for xml content not found |
74 | 74 | * |
75 | - * @return ResponseInterface |
|
75 | + * @return string |
|
76 | 76 | */ |
77 | 77 | protected function renderXmlNotFoundOutput() |
78 | 78 | { |
@@ -121,6 +121,6 @@ |
||
121 | 121 | <a href='$homeUrl'>Visit the Home Page</a> |
122 | 122 | </body> |
123 | 123 | </html> |
124 | -END; |
|
124 | +end; |
|
125 | 125 | } |
126 | 126 | } |
@@ -26,12 +26,12 @@ |
||
26 | 26 | * argument for `Slim::get`, `Slim::post`, `Slim::put`, `Slim::patch`, and `Slim::delete` |
27 | 27 | * is an anonymous function. |
28 | 28 | */ |
29 | -$app->get('/', function ($request, $response, $args) { |
|
29 | +$app->get('/', function($request, $response, $args) { |
|
30 | 30 | $response->write("Welcome to Slim!"); |
31 | 31 | return $response; |
32 | 32 | }); |
33 | 33 | |
34 | -$app->get('/hello[/{name}]', function ($request, $response, $args) { |
|
34 | +$app->get('/hello[/{name}]', function($request, $response, $args) { |
|
35 | 35 | $response->write("Hello, " . $args['name']); |
36 | 36 | return $response; |
37 | 37 | })->setArgument('name', 'World!'); |
@@ -207,7 +207,7 @@ |
||
207 | 207 | */ |
208 | 208 | protected function filterStatus($status) |
209 | 209 | { |
210 | - if (!is_integer($status) || $status<100 || $status>599) { |
|
210 | + if (!is_integer($status) || $status < 100 || $status > 599) { |
|
211 | 211 | throw new InvalidArgumentException('Invalid HTTP status code'); |
212 | 212 | } |
213 | 213 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $key = strtoupper($key); |
57 | 57 | if (isset(static::$special[$key]) || strpos($key, 'HTTP_') === 0) { |
58 | 58 | if ($key !== 'HTTP_CONTENT_LENGTH') { |
59 | - $data[$key] = $value; |
|
59 | + $data[$key] = $value; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | $host = $matches[1]; |
187 | 187 | |
188 | 188 | if ($matches[2]) { |
189 | - $port = (int) substr($matches[2], 1); |
|
189 | + $port = (int)substr($matches[2], 1); |
|
190 | 190 | } |
191 | 191 | } else { |
192 | 192 | $pos = strpos($host, ':'); |
193 | 193 | if ($pos !== false) { |
194 | - $port = (int) substr($host, $pos + 1); |
|
194 | + $port = (int)substr($host, $pos + 1); |
|
195 | 195 | $host = strstr($host, ':', true); |
196 | 196 | } |
197 | 197 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | { |
620 | 620 | return preg_replace_callback( |
621 | 621 | '/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', |
622 | - function ($match) { |
|
622 | + function($match) { |
|
623 | 623 | return rawurlencode($match[0]); |
624 | 624 | }, |
625 | 625 | $path |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | { |
693 | 693 | return preg_replace_callback( |
694 | 694 | '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', |
695 | - function ($match) { |
|
695 | + function($match) { |
|
696 | 696 | return rawurlencode($match[0]); |
697 | 697 | }, |
698 | 698 | $query |
@@ -193,25 +193,25 @@ discard block |
||
193 | 193 | $this->headers->set('Host', $this->uri->getHost()); |
194 | 194 | } |
195 | 195 | |
196 | - $this->registerMediaTypeParser('application/json', function ($input) { |
|
196 | + $this->registerMediaTypeParser('application/json', function($input) { |
|
197 | 197 | return json_decode($input, true); |
198 | 198 | }); |
199 | 199 | |
200 | - $this->registerMediaTypeParser('application/xml', function ($input) { |
|
200 | + $this->registerMediaTypeParser('application/xml', function($input) { |
|
201 | 201 | $backup = libxml_disable_entity_loader(true); |
202 | 202 | $result = simplexml_load_string($input); |
203 | 203 | libxml_disable_entity_loader($backup); |
204 | 204 | return $result; |
205 | 205 | }); |
206 | 206 | |
207 | - $this->registerMediaTypeParser('text/xml', function ($input) { |
|
207 | + $this->registerMediaTypeParser('text/xml', function($input) { |
|
208 | 208 | $backup = libxml_disable_entity_loader(true); |
209 | 209 | $result = simplexml_load_string($input); |
210 | 210 | libxml_disable_entity_loader($backup); |
211 | 211 | return $result; |
212 | 212 | }); |
213 | 213 | |
214 | - $this->registerMediaTypeParser('application/x-www-form-urlencoded', function ($input) { |
|
214 | + $this->registerMediaTypeParser('application/x-www-form-urlencoded', function($input) { |
|
215 | 215 | parse_str($input, $data); |
216 | 216 | return $data; |
217 | 217 | }); |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | // look for a media type with a structured syntax suffix (RFC 6839) |
972 | 972 | $parts = explode('+', $mediaType); |
973 | 973 | if (count($parts) >= 2) { |
974 | - $mediaType = 'application/' . $parts[count($parts)-1]; |
|
974 | + $mediaType = 'application/' . $parts[count($parts) - 1]; |
|
975 | 975 | } |
976 | 976 | |
977 | 977 | if (isset($this->bodyParsers[$mediaType]) === true) { |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * These values MAY be prepared from $_FILES or the message body during |
802 | 802 | * instantiation, or MAY be injected via withUploadedFiles(). |
803 | 803 | * |
804 | - * @return array An array tree of UploadedFileInterface instances; an empty |
|
804 | + * @return UploadedFileInterface[] An array tree of UploadedFileInterface instances; an empty |
|
805 | 805 | * array MUST be returned if no data is present. |
806 | 806 | */ |
807 | 807 | public function getUploadedFiles() |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | * @param string $key |
1135 | 1135 | * @param mixed $default |
1136 | 1136 | * |
1137 | - * @return mixed |
|
1137 | + * @return null|string |
|
1138 | 1138 | */ |
1139 | 1139 | public function getParsedBodyParam($key, $default = null) |
1140 | 1140 | { |
@@ -17,7 +17,6 @@ |
||
17 | 17 | use Psr\Http\Message\StreamInterface; |
18 | 18 | use Slim\Collection; |
19 | 19 | use Slim\Exception\InvalidMethodException; |
20 | -use Slim\Exception\MethodNotAllowedException; |
|
21 | 20 | use Slim\Interfaces\Http\HeadersInterface; |
22 | 21 | |
23 | 22 | /** |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $router = $this->container->get('router'); |
434 | 434 | |
435 | 435 | // If router hasn't been dispatched or the URI changed then dispatch |
436 | - if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string) $request->getUri()])) { |
|
436 | + if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string)$request->getUri()])) { |
|
437 | 437 | $request = $this->dispatchRouterAndPrepareRoute($request, $router); |
438 | 438 | $routeInfo = $request->getAttribute('routeInfo'); |
439 | 439 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $request = $request->withAttribute('route', $route); |
526 | 526 | } |
527 | 527 | |
528 | - $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()]; |
|
528 | + $routeInfo['request'] = [$request->getMethod(), (string)$request->getUri()]; |
|
529 | 529 | |
530 | 530 | return $request->withAttribute('routeInfo', $routeInfo); |
531 | 531 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | } |
555 | 555 | $size = $response->getBody()->getSize(); |
556 | 556 | if ($size !== null && !$response->hasHeader('Content-Length')) { |
557 | - $response = $response->withHeader('Content-Length', (string) $size); |
|
557 | + $response = $response->withHeader('Content-Length', (string)$size); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 |
@@ -126,7 +126,7 @@ |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - throw new \BadMethodCallException("Method $method is not a valid method"); |
|
129 | + throw new \BadMethodCallException("method $method is not a valid method"); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /******************************************************************************** |
@@ -12,7 +12,6 @@ discard block |
||
12 | 12 | use Throwable; |
13 | 13 | use Closure; |
14 | 14 | use InvalidArgumentException; |
15 | -use Psr\Http\Message\RequestInterface; |
|
16 | 15 | use Psr\Http\Message\ServerRequestInterface; |
17 | 16 | use Psr\Http\Message\ResponseInterface; |
18 | 17 | use Interop\Container\ContainerInterface; |
@@ -24,7 +23,6 @@ discard block |
||
24 | 23 | use Slim\Http\Headers; |
25 | 24 | use Slim\Http\Body; |
26 | 25 | use Slim\Http\Request; |
27 | -use Slim\Interfaces\Http\EnvironmentInterface; |
|
28 | 26 | use Slim\Interfaces\RouteGroupInterface; |
29 | 27 | use Slim\Interfaces\RouteInterface; |
30 | 28 | use Slim\Interfaces\RouterInterface; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function __construct($displayErrorDetails = false) |
27 | 27 | { |
28 | - $this->displayErrorDetails = (bool) $displayErrorDetails; |
|
28 | + $this->displayErrorDetails = (bool)$displayErrorDetails; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * |
95 | 95 | * @return array|\ArrayAccess |
96 | 96 | */ |
97 | - $this['settings'] = function () use ($userSettings, $defaultSettings) { |
|
97 | + $this['settings'] = function() use ($userSettings, $defaultSettings) { |
|
98 | 98 | return new Collection(array_merge($defaultSettings, $userSettings)); |
99 | 99 | }; |
100 | 100 |