Passed
Push — dependabot/composer/doctrine/d... ( bc1a80...bcc5a8 )
by
unknown
47:19 queued 41:28
created

autoload.php (1 issue)

1
<?php
2
3
// @TODO rename this file to bootstrap.php to better reflect its function
4
5
use Doctrine\Common\Annotations\AnnotationRegistry;
6
use Symfony\Component\Dotenv\Dotenv;
7
8
// use vendor generated autoloader
9
$loader = require __DIR__ . '/vendor/autoload.php';
10
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
1 ignored issue
show
Deprecated Code introduced by
The function Doctrine\Common\Annotati...istry::registerLoader() has been deprecated: This method is deprecated and will be removed in doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

10
/** @scrutinizer ignore-deprecated */ AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
11
12
// Spoon is not autoloaded via Composer but uses its own old skool autoloader
13
set_include_path(__DIR__ . '/vendor/spoon/library' . PATH_SEPARATOR . get_include_path());
14
require_once 'spoon/spoon.php';
15
16
// load server variables
17
if (!array_key_exists('FORK_ENV', $_SERVER)) {
18
    $_SERVER['FORK_ENV'] = $_ENV['FORK_ENV'] ?? null;
19
}
20
21
if ('prod' !== $_SERVER['FORK_ENV']) {
22
    if (!class_exists(Dotenv::class)) {
23
        throw new RuntimeException('The "FORK_ENV" environment variable is not set to "prod". Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
24
    }
25
    $dotenv = new Dotenv();
26
27
    $dotenv->load(__DIR__ . '/.env');
28
29
    // @TODO when updating to Fork 6, using Symfony 4, check if we still need to check the file's existence
30
    if (file_exists(__DIR__ . '/.env.local')) {
31
        $dotenv->load(__DIR__ . '/.env.local');
32
    }
33
}
34
35
$_SERVER['FORK_ENV'] = $_ENV['FORK_ENV'] = $_SERVER['APP_ENV'] = $_SERVER['FORK_ENV'] ?: $_ENV['FORK_ENV'] ?: 'dev';
36
$_SERVER['FORK_DEBUG'] = $_SERVER['FORK_DEBUG'] ?? $_ENV['FORK_DEBUG'] ?? 'prod' !== $_SERVER['FORK_ENV'];
37
$_SERVER['FORK_DEBUG'] = $_ENV['FORK_DEBUG'] = $_SERVER['APP_DEBUG'] = (int) $_SERVER['FORK_DEBUG'] || filter_var($_SERVER['FORK_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
38
39
return $loader;
40