From 952658a6e05c373e735a1b73f3c803988537065f Mon Sep 17 00:00:00 2001 From: Teoh Han Hui Date: Wed, 4 Apr 2018 13:48:44 +0200 Subject: [PATCH] Sync with Symfony Standard v3.4 --- .gitignore | 5 +- .travis.yml | 6 +-- app/AppKernel.php | 21 ++++++-- app/TestAppKernel.php | 7 +-- app/config/config.yml | 49 ++++++++++--------- app/config/config_dev.yml | 8 +-- app/config/config_prod.yml | 4 +- app/config/config_staging.yml | 6 +-- app/config/config_test.yml | 10 ++-- app/config/config_test_cached.yml | 4 +- app/config/parameters.yml.dist | 24 ++++----- app/config/router_test_cached.php | 2 + app/config/routing.yml | 10 ++-- app/config/routing_dev.yml | 4 +- app/config/security.yml | 42 ++++++++-------- app/config/services.yml | 33 +++++++++++++ bin/console | 11 +++-- composer.json | 3 +- src/AppBundle/AppBundle.php | 4 +- src/{ => AppBundle/Controller}/.gitkeep | 0 .../DependencyInjection/AppExtension.php | 20 -------- .../DependencyInjection/Configuration.php | 17 ------- src/AppBundle/Resources/config/services.yml | 1 - web/app.php | 8 ++- web/app_dev.php | 13 +++-- web/app_staging.php | 2 - web/app_test.php | 10 ++-- web/app_test_cached.php | 10 ++-- 28 files changed, 166 insertions(+), 168 deletions(-) create mode 100644 app/config/services.yml rename src/{ => AppBundle/Controller}/.gitkeep (100%) delete mode 100644 src/AppBundle/DependencyInjection/AppExtension.php delete mode 100644 src/AppBundle/DependencyInjection/Configuration.php delete mode 100644 src/AppBundle/Resources/config/services.yml diff --git a/.gitignore b/.gitignore index 17ae51c5bc..f5a57d328b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/.php_cs /.php_cs.cache /app/config/parameters.yml @@ -11,10 +12,6 @@ /web/js /web/media -/bin/* -!/bin/console -!/bin/symfony_requirements - /vendor /node_modules diff --git a/.travis.yml b/.travis.yml index 343ffb56d7..85c54fbbef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,15 +72,15 @@ before_script: script: - composer validate --strict - - bin/phpspec run --no-interaction -f dot + - vendor/bin/phpspec run --no-interaction -f dot - bin/console sylius:fixtures:load --no-interaction --env=test_cached --no-debug -vvv - echo "Testing (Behat - brand new, regular scenarios; ~@javascript && ~@todo && ~@cli)" "Sylius" - - bin/behat --strict --no-interaction -vvv -f progress -p cached --tags="~@javascript && ~@todo && ~@cli" + - vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags="~@javascript && ~@todo && ~@cli" - echo "Testing (Behat - brand new, javascript scenarios; @javascript && ~@todo && ~@cli)" "Sylius" - - bin/behat --strict --no-interaction -vvv -f progress -p cached --tags="@javascript && ~@todo && ~@cli" || bin/behat --strict --no-interaction -vvv -f progress -p cached --tags="@javascript && ~@todo && ~@cli" --rerun + - vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags="@javascript && ~@todo && ~@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags="@javascript && ~@todo && ~@cli" --rerun after_failure: - vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log" diff --git a/app/AppKernel.php b/app/AppKernel.php index 23eb39392a..8f56f866b4 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -12,11 +12,9 @@ declare(strict_types=1); use Sylius\Bundle\CoreBundle\Application\Kernel; +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; -/** - * @author Paweł Jędrzejewski - * @author Gonzalo Vilaseca - */ class AppKernel extends Kernel { /** @@ -40,4 +38,19 @@ public function registerBundles(): array return array_merge(parent::registerBundles(), $bundles); } + + /** + * {@inheritdoc} + */ + public function registerContainerConfiguration(LoaderInterface $loader): void + { + $loader->load(function (ContainerBuilder $container) { + $container->setParameter('container.autowiring.strict_mode', true); + $container->setParameter('container.dumper.inline_class_loader', true); + + $container->addObjectResource($this); + }); + + parent::registerContainerConfiguration($loader); + } } diff --git a/app/TestAppKernel.php b/app/TestAppKernel.php index fb782f43a9..5de0cca879 100644 --- a/app/TestAppKernel.php +++ b/app/TestAppKernel.php @@ -17,9 +17,6 @@ use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; use Symfony\Component\DependencyInjection\ContainerInterface; -/** - * @author Kamil Kokot - */ class TestAppKernel extends AppKernel { /** @@ -43,7 +40,7 @@ public function shutdown(): void } /** - * Remove all container references from all loaded services + * Remove all container references from all loaded services. * * @param ContainerInterface $container */ @@ -55,7 +52,7 @@ protected function cleanupContainer(ContainerInterface $container): void $services = $containerServicesPropertyReflection->getValue($container) ?: []; foreach ($services as $serviceId => $service) { - if (in_array($serviceId, $this->getServicesToIgnoreDuringContainerCleanup())) { + if (in_array($serviceId, $this->getServicesToIgnoreDuringContainerCleanup(), true)) { continue; } diff --git a/app/config/config.yml b/app/config/config.yml index 2cb8c3bc10..d6f3fca12c 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -2,54 +2,55 @@ # (c) Paweł Jędrzejewski imports: - - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } + - { resource: '@SyliusCoreBundle/Resources/config/app/config.yml' } + - { resource: '@SyliusAdminBundle/Resources/config/app/config.yml' } + - { resource: '@SyliusShopBundle/Resources/config/app/config.yml' } + - { resource: '@SyliusAdminApiBundle/Resources/config/app/config.yml' } - - { resource: "parameters.yml" } - - { resource: "security.yml" } + - { resource: parameters.yml } + - { resource: security.yml } + - { resource: services.yml } parameters: locale: en_US framework: - translator: { fallbacks: ["%locale%"] } - secret: "%secret%" + translator: { fallbacks: ['%locale%'] } + secret: '%secret%' router: - resource: "%kernel.root_dir%/config/routing.yml" - strict_requirements: "%kernel.debug%" + resource: '%kernel.project_dir%/app/config/routing.yml' + strict_requirements: '%kernel.debug%' form: true csrf_protection: true validation: { enable_annotations: true } - templating: { engines: ["twig"] } - default_locale: "%locale%" + templating: { engines: ['twig'] } + default_locale: '%locale%' trusted_proxies: ~ session: handler_id: ~ doctrine: dbal: - driver: "%database_driver%" - host: "%database_host%" - port: "%database_port%" - dbname: "%database_name%" - user: "%database_user%" - password: "%database_password%" - server_version: "5.5" + driver: '%database_driver%' + host: '%database_host%' + port: '%database_port%' + dbname: '%database_name%' + user: '%database_user%' + password: '%database_password%' + server_version: '5.5' charset: UTF8 doctrine_migrations: - dir_name: "%kernel.root_dir%/migrations" + dir_name: '%kernel.project_dir%/app/migrations' namespace: Sylius\Migrations table_name: sylius_migrations name: Sylius Migrations swiftmailer: - transport: "%mailer_transport%" - host: "%mailer_host%" - username: "%mailer_user%" - password: "%mailer_password%" + transport: '%mailer_transport%' + host: '%mailer_host%' + username: '%mailer_user%' + password: '%mailer_password%' fos_rest: exception: ~ diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 9ffe59780b..fe6ede85b5 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -2,21 +2,21 @@ # (c) Paweł Jędrzejewski imports: - - { resource: "config.yml" } + - { resource: config.yml } framework: - router: { resource: "%kernel.root_dir%/config/routing_dev.yml" } + router: { resource: '%kernel.project_dir%/app/config/routing_dev.yml' } profiler: { only_exceptions: false } doctrine: dbal: - dbname: "%database_name%_dev" + dbname: '%database_name%_dev' monolog: handlers: main: type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" + path: '%kernel.logs_dir%/%kernel.environment%.log' level: debug firephp: type: firephp diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 8b975edade..bfb06a2400 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -2,7 +2,7 @@ # (c) Paweł Jędrzejewski imports: - - { resource: "config.yml" } + - { resource: config.yml } monolog: handlers: @@ -12,5 +12,5 @@ monolog: handler: nested nested: type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" + path: '%kernel.logs_dir%/%kernel.environment%.log' level: debug diff --git a/app/config/config_staging.yml b/app/config/config_staging.yml index 75effcb8ea..099a5f242c 100644 --- a/app/config/config_staging.yml +++ b/app/config/config_staging.yml @@ -2,7 +2,7 @@ # (c) Paweł Jędrzejewski imports: - - { resource: "config.yml" } + - { resource: config.yml } monolog: handlers: @@ -12,12 +12,12 @@ monolog: handler: nested nested: type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" + path: '%kernel.logs_dir%/%kernel.environment%.log' level: debug doctrine: dbal: - dbname: "%database_name%_staging" + dbname: '%database_name%_staging' swiftmailer: disable_delivery: true diff --git a/app/config/config_test.yml b/app/config/config_test.yml index cdbbae2e80..afd14a90a2 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -2,7 +2,7 @@ # (c) Paweł Jędrzejewski imports: - - { resource: "config.yml" } + - { resource: config.yml } parameters: locale: en_US @@ -14,20 +14,20 @@ framework: doctrine: dbal: - dbname: "%database_name%_test" + dbname: '%database_name%_test' monolog: handlers: main: type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" + path: '%kernel.logs_dir%/%kernel.environment%.log' level: error payum: gateways: paypal_express_checkout: factory: paypal_express_checkout - payum.http_client: "@sylius.payum.http_client" + payum.http_client: '@sylius.payum.http_client' username: TEST password: TEST signature: TEST @@ -44,7 +44,7 @@ swiftmailer: logging: true spool: type: file - path: "%kernel.cache_dir%/spool" + path: '%kernel.cache_dir%/spool' sylius_theme: sources: diff --git a/app/config/config_test_cached.yml b/app/config/config_test_cached.yml index 199a14c5d6..4e651d6039 100644 --- a/app/config/config_test_cached.yml +++ b/app/config/config_test_cached.yml @@ -2,7 +2,7 @@ # (c) Paweł Jędrzejewski imports: - - { resource: "config_test.yml" } + - { resource: config_test.yml } doctrine: orm: @@ -24,4 +24,4 @@ fos_rest: debug: true doctrine_migrations: - dir_name: "%kernel.root_dir%/../vendor/sylius/sylius/app/migrations" + dir_name: '%kernel.project_dir%/vendor/sylius/sylius/app/migrations' diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 3ab7f6990a..9583234460 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -1,19 +1,19 @@ parameters: - database_driver: "%env(SYLIUS_DATABASE_DRIVER)%" - database_host: "%env(SYLIUS_DATABASE_HOST)%" - database_port: "%env(SYLIUS_DATABASE_PORT)%" - database_name: "%env(SYLIUS_DATABASE_NAME)%" - database_user: "%env(SYLIUS_DATABASE_USER)%" - database_password: "%env(SYLIUS_DATABASE_PASSWORD)%" + database_driver: '%env(SYLIUS_DATABASE_DRIVER)%' + database_host: '%env(SYLIUS_DATABASE_HOST)%' + database_port: '%env(SYLIUS_DATABASE_PORT)%' + database_name: '%env(SYLIUS_DATABASE_NAME)%' + database_user: '%env(SYLIUS_DATABASE_USER)%' + database_password: '%env(SYLIUS_DATABASE_PASSWORD)%' # You should uncomment this if you want use pdo_sqlite. - # database_path: "%kernel.root_dir%/data.db3" + # database_path: '%kernel.project_dir%/var/data/data.sqlite' - mailer_transport: "%env(SYLIUS_MAILER_TRANSPORT)%" - mailer_host: "%env(SYLIUS_MAILER_HOST)%" - mailer_user: "%env(SYLIUS_MAILER_USER)%" - mailer_password: "%env(SYLIUS_MAILER_PASSWORD)%" + mailer_transport: '%env(SYLIUS_MAILER_TRANSPORT)%' + mailer_host: '%env(SYLIUS_MAILER_HOST)%' + mailer_user: '%env(SYLIUS_MAILER_USER)%' + mailer_password: '%env(SYLIUS_MAILER_PASSWORD)%' - secret: "%env(SYLIUS_SECRET)" + secret: '%env(SYLIUS_SECRET)' # Fallback values (used if environmental variables are not set) env(SYLIUS_DATABASE_DRIVER): pdo_mysql diff --git a/app/config/router_test_cached.php b/app/config/router_test_cached.php index d79636f7fa..fab7884294 100644 --- a/app/config/router_test_cached.php +++ b/app/config/router_test_cached.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +declare(strict_types=1); + /* * This file implements rewrite rules for PHP built-in web server. * diff --git a/app/config/routing.yml b/app/config/routing.yml index c45884ce46..d19fad5078 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -2,21 +2,21 @@ # (c) Paweł Jędrzejewski sylius_admin: - resource: "@SyliusAdminBundle/Resources/config/routing.yml" + resource: '@SyliusAdminBundle/Resources/config/routing.yml' prefix: /admin sylius_api: - resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" + resource: '@SyliusAdminApiBundle/Resources/config/routing.yml' prefix: /api sylius_shop: - resource: "@SyliusShopBundle/Resources/config/routing.yml" + resource: '@SyliusShopBundle/Resources/config/routing.yml' prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ sylius_shop_payum: - resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" + resource: '@SyliusShopBundle/Resources/config/routing/payum.yml' sylius_shop_default_locale: path: / @@ -25,4 +25,4 @@ sylius_shop_default_locale: _controller: sylius.controller.shop.locale_switch:switchAction _liip_imagine: - resource: "@LiipImagineBundle/Resources/config/routing.xml" + resource: '@LiipImagineBundle/Resources/config/routing.xml' diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml index 6d458f8544..22df00cdd1 100644 --- a/app/config/routing_dev.yml +++ b/app/config/routing_dev.yml @@ -2,11 +2,11 @@ # (c) Paweł Jędrzejewski _wdt: - resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" + resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' prefix: /_wdt _profiler: - resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" + resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' prefix: /_profiler _main: diff --git a/app/config/security.yml b/app/config/security.yml index 0fbf4559f3..5cf959dd7f 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -2,9 +2,9 @@ # (c) Paweł Jędrzejewski parameters: - sylius.security.admin_regex: "^/admin" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!admin|api/.*|api$|media/.*)[^/]++" + sylius.security.admin_regex: '^/admin' + sylius.security.api_regex: '^/api' + sylius.security.shop_regex: '^/(?!admin|api/.*|api$|media/.*)[^/]++' security: providers: @@ -18,7 +18,7 @@ security: admin: switch_user: true context: admin - pattern: "%sylius.security.admin_regex%" + pattern: '%sylius.security.admin_regex%' form_login: provider: sylius_admin_user_provider login_path: sylius_admin_login @@ -31,7 +31,7 @@ security: csrf_parameter: _csrf_admin_security_token csrf_token_id: admin_authenticate remember_me: - secret: "%secret%" + secret: '%secret%' path: /admin name: APP_ADMIN_REMEMBER_ME lifetime: 31536000 @@ -42,11 +42,11 @@ security: anonymous: true oauth_token: - pattern: "%sylius.security.api_regex%/oauth/v2/token" + pattern: '%sylius.security.api_regex%/oauth/v2/token' security: false api: - pattern: "%sylius.security.api_regex%/.*" + pattern: '%sylius.security.api_regex%/.*' fos_oauth: true stateless: true anonymous: true @@ -54,7 +54,7 @@ security: shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } context: shop - pattern: "%sylius.security.shop_regex%" + pattern: '%sylius.security.shop_regex%' form_login: success_handler: sylius.authentication.success_handler failure_handler: sylius.authentication.failure_handler @@ -69,7 +69,7 @@ security: csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate remember_me: - secret: "%secret%" + secret: '%secret%' name: APP_SHOP_REMEMBER_ME lifetime: 31536000 remember_me_parameter: _remember_me @@ -85,18 +85,18 @@ security: security: false access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: '%sylius.security.admin_regex%/_partial', role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: '%sylius.security.admin_regex%/_partial', role: ROLE_NO_ACCESS } + - { path: '%sylius.security.shop_regex%/_partial', role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: '%sylius.security.shop_regex%/_partial', role: ROLE_NO_ACCESS } - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: '%sylius.security.admin_regex%/login', role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: '%sylius.security.api_regex%/login', role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: '%sylius.security.shop_regex%/login', role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: '%sylius.security.shop_regex%/register', role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: '%sylius.security.shop_regex%/verify', role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + - { path: '%sylius.security.admin_regex%', role: ROLE_ADMINISTRATION_ACCESS } + - { path: '%sylius.security.api_regex%/.*', role: ROLE_API_ACCESS } + - { path: '%sylius.security.shop_regex%/account', role: ROLE_USER } diff --git a/app/config/services.yml b/app/config/services.yml new file mode 100644 index 0000000000..f034313091 --- /dev/null +++ b/app/config/services.yml @@ -0,0 +1,33 @@ +parameters: + #parameter_name: value + +services: + # default configuration for services in *this* file + _defaults: + # automatically injects dependencies in your services + autowire: true + # automatically registers your services as commands, event subscribers, etc. + autoconfigure: true + # this means you cannot fetch services directly from the container via $container->get() + # if you need to do this, you can override this setting on individual services + public: false + + # makes classes in src/AppBundle available to be used as services + # this creates a service per class whose id is the fully-qualified class name + AppBundle\: + resource: '../../src/AppBundle/*' + # you can exclude directories or files + # but if a service is unused, it's removed anyway + exclude: '../../src/AppBundle/{Entity,Repository,Tests}' + + # controllers are imported separately to make sure they're public + # and have a tag that allows actions to type-hint services + AppBundle\Controller\: + resource: '../../src/AppBundle/Controller' + public: true + tags: ['controller.service_arguments'] + + # add more services, or override services that need manual wiring + # AppBundle\Service\ExampleService: + # arguments: + # $someArgument: 'some_value' diff --git a/bin/console b/bin/console index aad92b96b2..bdfacfa0b5 100755 --- a/bin/console +++ b/bin/console @@ -1,23 +1,24 @@ #!/usr/bin/env php getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); -$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; +$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev', true); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption('--no-debug', true) && $env !== 'prod'; if ($debug) { Debug::enable(); diff --git a/composer.json b/composer.json index ee9311f2ba..74bab26961 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,6 @@ ], "require": { "php": "^7.1", - "sylius/sylius": "1.1.*" }, "require-dev": { @@ -70,7 +69,7 @@ "classmap": ["app/AppKernel.php", "app/AppCache.php"] }, "config": { - "bin-dir": "bin" + "sort-packages": true }, "extra": { "symfony-app-dir": "app", diff --git a/src/AppBundle/AppBundle.php b/src/AppBundle/AppBundle.php index f70c361174..931ea9720d 100644 --- a/src/AppBundle/AppBundle.php +++ b/src/AppBundle/AppBundle.php @@ -1,9 +1,11 @@ processConfiguration($configuration, $configs); - - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); - } -} \ No newline at end of file diff --git a/src/AppBundle/DependencyInjection/Configuration.php b/src/AppBundle/DependencyInjection/Configuration.php deleted file mode 100644 index ffa9813dcc..0000000000 --- a/src/AppBundle/DependencyInjection/Configuration.php +++ /dev/null @@ -1,17 +0,0 @@ -root('app'); - - return $treeBuilder; - } -} \ No newline at end of file diff --git a/src/AppBundle/Resources/config/services.yml b/src/AppBundle/Resources/config/services.yml deleted file mode 100644 index e3b0dff0ff..0000000000 --- a/src/AppBundle/Resources/config/services.yml +++ /dev/null @@ -1 +0,0 @@ -services: ~ \ No newline at end of file diff --git a/web/app.php b/web/app.php index 06a7bf843d..e768cc20a1 100644 --- a/web/app.php +++ b/web/app.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\HttpFoundation\Request; /* @@ -16,15 +18,11 @@ * Live (production) environment. */ -/** @var \Composer\Autoload\ClassLoader $loader */ -$loader = require __DIR__.'/../vendor/autoload.php'; +require __DIR__.'/../vendor/autoload.php'; $kernel = new AppKernel('prod', false); -$kernel->loadClassCache(); $request = Request::createFromGlobals(); - $response = $kernel->handle($request); $response->send(); - $kernel->terminate($request, $response); diff --git a/web/app_dev.php b/web/app_dev.php index b6da1b850d..fee9852dc1 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\Debug\Debug; use Symfony\Component\HttpFoundation\Request; @@ -21,25 +23,22 @@ * * SetEnv SYLIUS_APP_DEV_PERMITTED 1 */ -if (!getenv("SYLIUS_APP_DEV_PERMITTED") && ( + +if (!getenv('SYLIUS_APP_DEV_PERMITTED') && ( isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '113.0.0.1', '10.0.0.1'], true) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '113.0.0.1', '10.0.0.1'], true) || PHP_SAPI === 'cli-server') )) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } -/** @var \Composer\Autoload\ClassLoader $loader */ -$loader = require __DIR__.'/../vendor/autoload.php'; - +require __DIR__.'/../vendor/autoload.php'; Debug::enable(); $kernel = new AppKernel('dev', true); $request = Request::createFromGlobals(); - $response = $kernel->handle($request); $response->send(); - $kernel->terminate($request, $response); diff --git a/web/app_staging.php b/web/app_staging.php index 812810fb3c..fc6a104071 100644 --- a/web/app_staging.php +++ b/web/app_staging.php @@ -23,8 +23,6 @@ $kernel = new AppKernel('staging', false); $request = Request::createFromGlobals(); - $response = $kernel->handle($request); $response->send(); - $kernel->terminate($request, $response); diff --git a/web/app_test.php b/web/app_test.php index 76680a5dc4..4be289e3b8 100644 --- a/web/app_test.php +++ b/web/app_test.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\Debug\Debug; use Symfony\Component\HttpFoundation\Request; @@ -19,22 +21,18 @@ if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '113.0.0.1', '10.0.0.1'], true) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '113.0.0.1', '10.0.0.1'], true) || PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } -/** @var \Composer\Autoload\ClassLoader $loader */ -$loader = require __DIR__.'/../vendor/autoload.php'; - +require __DIR__.'/../vendor/autoload.php'; Debug::enable(); $kernel = new AppKernel('test', true); $request = Request::createFromGlobals(); - $response = $kernel->handle($request); $response->send(); - $kernel->terminate($request, $response); diff --git a/web/app_test_cached.php b/web/app_test_cached.php index 4a58b5afe1..6d977a0a0b 100644 --- a/web/app_test_cached.php +++ b/web/app_test_cached.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\HttpFoundation\Request; /* @@ -18,21 +20,17 @@ if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '113.0.0.1', '10.0.0.1'], true) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '113.0.0.1', '10.0.0.1'], true) || PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } -/** @var \Composer\Autoload\ClassLoader $loader */ -$loader = require __DIR__.'/../vendor/autoload.php'; +require __DIR__.'/../vendor/autoload.php'; $kernel = new AppKernel('test_cached', false); -$kernel->loadClassCache(); $request = Request::createFromGlobals(); - $response = $kernel->handle($request); $response->send(); - $kernel->terminate($request, $response);