Issues (40)

src/Kernel.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App;
4
5
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
6
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
7
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
8
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
9
10
class Kernel extends BaseKernel
11
{
12
    use MicroKernelTrait;
0 ignored issues
show
The trait Symfony\Bundle\Framework...Kernel\MicroKernelTrait requires the property $instanceof which is not provided by App\Kernel.
Loading history...
13
14
    public function __construct(string $environment, bool $debug)
15
    {
16
        date_default_timezone_set( 'UTC' );
17
18
        parent::__construct($environment, $debug);
19
    }
20
21
    protected function configureContainer(ContainerConfigurator $container): void
22
    {
23
        $container->import('../config/{packages}/*.yaml');
24
        $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
25
26
        if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
27
            $container->import('../config/services.yaml');
28
            $container->import('../config/{services}_'.$this->environment.'.yaml');
29
        } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
30
            (require $path)($container->withPath($path), $this);
31
        }
32
    }
33
34
    protected function configureRoutes(RoutingConfigurator $routes): void
35
    {
36
        $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
37
        $routes->import('../config/{routes}/*.yaml');
38
39
        if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
40
            $routes->import('../config/routes.yaml');
41
        } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
42
            (require $path)($routes->withPath($path), $this);
43
        }
44
    }
45
}
46