#1: Switch Config to PHP
Some checks are pending
Quality Check / Check (push) Waiting to run

This commit is contained in:
Snoweuph 2024-04-22 22:26:40 +02:00
parent a5f1725109
commit a9f6e950fc
Signed by: Snoweuph
GPG key ID: A494330694B208EF
38 changed files with 1270 additions and 1056 deletions

View file

@ -6,3 +6,5 @@ APP_SECRET=3a451032bf2c8c9a639dfb642ce825d0
###> doctrine/doctrine-bundle ### ###> doctrine/doctrine-bundle ###
DATABASE_URL="mysql://root:empty@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" DATABASE_URL="mysql://root:empty@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###
TEST_TOKEN=

View file

@ -10,23 +10,24 @@
"doctrine/doctrine-bundle": "^2.12", "doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.0", "doctrine/orm": "^3.0",
"symfony/asset": "6.3.*", "symfony/asset": "6.4.*",
"symfony/console": "6.3.*", "symfony/console": "6.4.*",
"symfony/dotenv": "6.3.*", "symfony/dotenv": "6.4.*",
"symfony/flex": "^2", "symfony/flex": "^2",
"symfony/form": "6.3.*", "symfony/form": "6.4.*",
"symfony/framework-bundle": "6.3.*", "symfony/framework-bundle": "6.4.*",
"symfony/monolog-bundle": "^3.10", "symfony/monolog-bundle": "^3.10",
"symfony/runtime": "6.3.*", "symfony/runtime": "6.4.*",
"symfony/stimulus-bundle": "^2.12", "symfony/stimulus-bundle": "^2.12",
"symfony/stopwatch": "6.3.*", "symfony/stopwatch": "6.4.*",
"symfony/twig-bundle": "6.3.*", "symfony/twig-bundle": "6.4.*",
"symfony/uid": "6.3.*", "symfony/uid": "6.4.*",
"symfony/validator": "6.3.*", "symfony/validator": "6.4.*",
"symfony/webpack-encore-bundle": "^2.1", "symfony/webpack-encore-bundle": "^2.1",
"symfony/yaml": "6.3.*", "symfony/yaml": "6.4.*",
"twig/extra-bundle": "^2.12|^3.0", "twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0" "twig/twig": "^2.12|^3.0",
"webmozart/assert": "*"
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {
@ -44,7 +45,8 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"App\\Tests\\": "tests/" "App\\Tests\\": "tests/",
"DoctrineFixtures\\": "fixtures/"
} }
}, },
"replace": { "replace": {
@ -74,7 +76,7 @@
"extra": { "extra": {
"symfony": { "symfony": {
"allow-contrib": false, "allow-contrib": false,
"require": "6.3.*" "require": "6.4.*"
} }
}, },
"require-dev": { "require-dev": {
@ -85,11 +87,11 @@
"phpstan/phpstan": "^1.10", "phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.6", "phpunit/phpunit": "^9.6",
"symfony/browser-kit": "6.3.*", "symfony/browser-kit": "6.4.*",
"symfony/css-selector": "6.3.*", "symfony/css-selector": "6.4.*",
"symfony/debug-bundle": "6.3.*", "symfony/debug-bundle": "6.4.*",
"symfony/phpunit-bridge": "^7.0", "symfony/phpunit-bridge": "^7.0",
"symfony/web-profiler-bundle": "6.3.*", "symfony/web-profiler-bundle": "6.4.*",
"vincentlanglet/twig-cs-fixer": "^2.4" "vincentlanglet/twig-cs-fixer": "^2.4"
} }
} }

1653
app/composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'cache' => null,
]);
};

View file

@ -1,2 +0,0 @@
framework:
cache:

View file

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('dama_doctrine_test', [
'enable_static_connection' => true,
'enable_static_meta_data_cache' => true,
'enable_static_query_cache' => true,
]);
}
};

View file

@ -1,5 +0,0 @@
when@test:
dama_doctrine_test:
enable_static_connection: true
enable_static_meta_data_cache: true
enable_static_query_cache: true

View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
if ($containerConfigurator->env() === 'dev') {
$containerConfigurator->extension('debug', [
'dump_destination' => 'tcp://%env(VAR_DUMPER_SERVER)%',
]);
}
};

View file

@ -1,3 +0,0 @@
when@dev:
debug:
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View file

@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('doctrine', [
'dbal' => [
'url' => '%env(resolve:DATABASE_URL)%',
'profiling_collect_backtrace' => '%kernel.debug%',
],
'orm' => [
'auto_generate_proxy_classes' => true,
'enable_lazy_ghost_objects' => true,
'report_fields_where_declared' => true,
'validate_xml_mapping' => true,
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware',
'auto_mapping' => true,
'mappings' => [
'App' => [
'type' => 'attribute',
'is_bundle' => false,
'dir' => '%kernel.project_dir%/src',
'prefix' => 'App',
'alias' => 'App',
],
],
],
]);
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('doctrine', [
'dbal' => [
'connections' => [
'default' => [
'dbname_suffix' => '%env(TEST_TOKEN)%',
'use_savepoints' => true,
],
],
],
]);
}
if ($containerConfigurator->env() === 'prod') {
$containerConfigurator->extension('doctrine', [
'orm' => [
'auto_generate_proxy_classes' => false,
'proxy_dir' => '%kernel.build_dir%/doctrine/orm/Proxies',
'query_cache_driver' => [
'type' => 'pool',
'pool' => 'doctrine.system_cache_pool',
],
'result_cache_driver' => [
'type' => 'pool',
'pool' => 'doctrine.result_cache_pool',
],
],
]);
$containerConfigurator->extension('framework', [
'cache' => [
'pools' => [
'doctrine.result_cache_pool' => [
'adapter' => 'cache.app',
],
'doctrine.system_cache_pool' => [
'adapter' => 'cache.system',
],
],
],
]);
}
};

View file

@ -1,46 +0,0 @@
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
profiling_collect_backtrace: '%kernel.debug%'
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
type: attribute
is_bundle: false
dir: '%kernel.project_dir%/src'
prefix: 'App'
alias: App
when@test:
doctrine:
dbal:
connections:
default:
dbname_suffix: '%env(TEST_TOKEN)%'
use_savepoints: true
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View file

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('doctrine_migrations', [
'migrations_paths' => [
'DoctrineMigrations' => '%kernel.project_dir%/migrations',
],
'enable_profiler' => false,
]);
};

View file

@ -1,4 +0,0 @@
doctrine_migrations:
migrations_paths:
'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: false

View file

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'secret' => '%env(APP_SECRET)%',
'http_method_override' => false,
'handle_all_throwables' => true,
'session' => [
'handler_id' => null,
'cookie_secure' => 'auto',
'cookie_samesite' => 'lax',
'storage_factory_id' => 'session.storage.factory.native',
],
'php_errors' => [
'log' => true,
],
]);
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('framework', [
'test' => true,
'session' => [
'storage_factory_id' => 'session.storage.factory.mock_file',
],
]);
}
if ($containerConfigurator->env() === 'prod') {
$containerConfigurator->extension('framework', [
'session' => [
'handler_id' => 'file://%kernel_project_dir%/var/sessions',
],
]);
}
};

View file

@ -1,24 +0,0 @@
framework:
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
php_errors:
log: true
when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file
when@prod:
framework:
session:
handler_id: 'file://%kernel_project_dir%/var/sessions'

View file

@ -0,0 +1,96 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('monolog', [
'channels' => [
'deprecation',
],
]);
if ($containerConfigurator->env() === 'dev') {
$containerConfigurator->extension('monolog', [
'handlers' => [
'main' => [
'type' => 'stream',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
'level' => 'debug',
'channels' => [
'!event',
],
],
'console' => [
'type' => 'console',
'process_psr_3_messages' => false,
'channels' => [
'!event',
'!doctrine',
'!console',
],
],
],
]);
}
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('monolog', [
'handlers' => [
'main' => [
'type' => 'fingers_crossed',
'action_level' => 'error',
'handler' => 'nested',
'excluded_http_codes' => [
404,
405,
],
'channels' => [
'!event',
],
],
'nested' => [
'type' => 'stream',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
'level' => 'debug',
],
],
]);
}
if ($containerConfigurator->env() === 'prod') {
$containerConfigurator->extension('monolog', [
'handlers' => [
'main' => [
'type' => 'fingers_crossed',
'action_level' => 'error',
'handler' => 'nested',
'excluded_http_codes' => [
404,
405,
],
'buffer_size' => 50,
],
'nested' => [
'type' => 'stream',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
'level' => 'debug',
'formatter' => 'monolog.formatter.json',
],
'console' => [
'type' => 'console',
'process_psr_3_messages' => false,
'channels' => [
'!event',
'!doctrine',
],
],
'deprecation' => [
'type' => 'stream',
'channels' => [
'deprecation',
],
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
],
],
]);
}
};

View file

@ -1,53 +0,0 @@
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
when@dev:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
when@test:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
when@prod:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
channels: [deprecation]
path: "%kernel.logs_dir%/%kernel.environment%.log"

View file

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'router' => [
'utf8' => true,
],
]);
if ($containerConfigurator->env() === 'prod') {
$containerConfigurator->extension('framework', [
'router' => [
'strict_requirements' => null,
],
]);
}
};

View file

@ -1,8 +0,0 @@
framework:
router:
utf8: true
when@prod:
framework:
router:
strict_requirements: null

View file

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('twig', [
'default_path' => '%kernel.project_dir%/templates',
]);
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('twig', [
'strict_variables' => true,
]);
}
};

View file

@ -1,6 +0,0 @@
twig:
default_path: '%kernel.project_dir%/templates'
when@test:
twig:
strict_variables: true

View file

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'uid' => [
'default_uuid_version' => 7,
'time_based_uuid_version' => 7,
],
]);
};

View file

@ -1,4 +0,0 @@
framework:
uid:
default_uuid_version: 7
time_based_uuid_version: 7

View file

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'validation' => [
'email_validation_mode' => 'html5',
],
]);
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('framework', [
'validation' => [
'not_compromised_password' => false,
],
]);
}
};

View file

@ -1,8 +0,0 @@
framework:
validation:
email_validation_mode: html5
when@test:
framework:
validation:
not_compromised_password: false

View file

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
if ($containerConfigurator->env() === 'dev') {
$containerConfigurator->extension('web_profiler', [
'toolbar' => true,
'intercept_redirects' => false,
]);
$containerConfigurator->extension('framework', [
'profiler' => [
'only_exceptions' => false,
'collect_serializer_data' => true,
],
]);
}
if ($containerConfigurator->env() === 'test') {
$containerConfigurator->extension('web_profiler', [
'toolbar' => false,
'intercept_redirects' => false,
]);
$containerConfigurator->extension('framework', [
'profiler' => [
'collect' => false,
],
]);
}
};

View file

@ -1,17 +0,0 @@
when@dev:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler:
only_exceptions: false
collect_serializer_data: true
when@test:
web_profiler:
toolbar: false
intercept_redirects: false
framework:
profiler: { collect: false }

View file

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('webpack_encore', [
'output_path' => '%kernel.project_dir%/public/build',
'script_attributes' => [
'defer' => true,
],
]);
$containerConfigurator->extension('framework', [
'assets' => [
'json_manifest_path' => '%kernel.project_dir%/public/build/manifest.json',
],
]);
};

View file

@ -1,8 +0,0 @@
webpack_encore:
output_path: '%kernel.project_dir%/public/build'
script_attributes:
defer: true
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

View file

@ -2,6 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) { if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php'; require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
} }

View file

@ -1,7 +1,9 @@
<?php <?php
declare(strict_types=1);
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return function (RoutingConfigurator $routes) { return function (RoutingConfigurator $routes): void {
$routes->import('../src/*', 'attribute'); $routes->import('../src/*', 'attribute');
}; };

View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routingConfigurator): void {
if ($routingConfigurator->env() === 'dev') {
$routingConfigurator->import('@FrameworkBundle/Resources/config/routing/errors.xml')
->prefix('/_error')
;
}
};

View file

@ -1,4 +0,0 @@
when@dev:
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

View file

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routingConfigurator): void {
if ($routingConfigurator->env() === 'dev') {
$routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/wdt.xml')
->prefix('/_wdt')
;
$routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')
->prefix('/_profiler')
;
}
};

View file

@ -1,8 +0,0 @@
when@dev:
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return function (ContainerConfigurator $container): void { return function (ContainerConfigurator $container): void {
$services = $container->services() $services = $container->services()
@ -15,4 +15,4 @@ return function (ContainerConfigurator $container): void {
->load('App\\', '../src/') ->load('App\\', '../src/')
->exclude('../src/{DependencyInjection,Entity,Kernel.php}') ->exclude('../src/{DependencyInjection,Entity,Kernel.php}')
; ;
}; };

View file

@ -2,13 +2,14 @@
declare(strict_types=1); declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return function (ContainerConfigurator $container): void { return function (ContainerConfigurator $container): void {
$services = $container->services() $services = $container->services()
->defaults() ->defaults()
->autowire() ->autowire()
->autoconfigure(); ->autoconfigure()
;
$services->load('DoctrineFixtures\\', '../fixtures'); $services->load('DoctrineFixtures\\', '../fixtures');
}; };

View file

@ -2,13 +2,14 @@
declare(strict_types=1); declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return function (ContainerConfigurator $container): void { return function (ContainerConfigurator $container): void {
$services = $container->services() $services = $container->services()
->defaults() ->defaults()
->autowire() ->autowire()
->autoconfigure(); ->autoconfigure()
;
$services->load('DoctrineFixtures\\', '../fixtures'); $services->load('DoctrineFixtures\\', '../fixtures');
}; };