1 | <?php |
||
2 | /** |
||
3 | * This file is part of the Divergence package. |
||
4 | * |
||
5 | * (c) Henry Paradiz <[email protected]> |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | */ |
||
10 | |||
11 | namespace Divergence\Controllers; |
||
12 | |||
13 | use Psr\Http\Message\ResponseInterface; |
||
14 | use Psr\Http\Message\ServerRequestInterface; |
||
15 | |||
16 | class SiteRequestHandler extends RequestHandler |
||
17 | { |
||
18 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
19 | { |
||
20 | // @codeCoverageIgnoreStart |
||
21 | phpinfo(); |
||
22 | exit; |
||
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return Psr\Http\Message\ResponseInterface . Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
Loading history...
|
|||
23 | // @codeCoverageIgnoreEnd |
||
24 | } |
||
25 | } |
||
26 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.