Issues (13)

public/index.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
use Yiisoft\ErrorHandler\ErrorHandler;
0 ignored issues
show
The type Yiisoft\ErrorHandler\ErrorHandler was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Yiisoft\ErrorHandler\Renderer\JsonRenderer;
7
use Yiisoft\Log\Logger;
8
use Yiisoft\Log\Target\File\FileTarget;
9
use Yiisoft\Yii\Runner\Http\HttpApplicationRunner;
10
11
/**
12
 * @psalm-var string $_SERVER['REQUEST_URI']
13
 */
14
15
// PHP built-in server routing.
16
if (PHP_SAPI === 'cli-server') {
17
    // Serve static files as is.
18
    /** @psalm-suppress MixedArgument */
19
    $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
20
    if (is_file(__DIR__ . $path)) {
21
        return false;
22
    }
23
24
    // Explicitly set for URLs with dot.
25
    $_SERVER['SCRIPT_NAME'] = '/index.php';
26
}
27
28
require_once dirname(__DIR__) . '/autoload.php';
29
30
if (getenv('YII_C3')) {
31
    $c3 = dirname(__DIR__) . '/c3.php';
32
    if (file_exists($c3)) {
33
        require_once $c3;
34
    }
35
}
36
37
/**
38
 * Run HTTP application runner
39
 *
40
 * @psalm-suppress RedundantCast
41
 */
42
$runner = (
43
    new HttpApplicationRunner(
44
        rootPath: dirname(__DIR__),
45
        debug: (bool) $_ENV['YII_DEBUG'],
46
        checkEvents: (bool) $_ENV['YII_DEBUG'],
47
        environment: $_ENV['YII_ENV']
48
    )
49
)
50
    ->withTemporaryErrorHandler(new ErrorHandler(
51
        new Logger([new FileTarget(dirname(__DIR__) . '/runtime/logs/app.log')]),
52
        new JsonRenderer(),
53
    ))
54
;
55
$runner->run();
56