diff --git a/.github/workflows/application.yml b/.github/workflows/application.yml index 60af73ebc0..7189b02bce 100644 --- a/.github/workflows/application.yml +++ b/.github/workflows/application.yml @@ -47,11 +47,11 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get branch name - uses: tj-actions/branch-names@v5.2 + uses: tj-actions/branch-names@v6.2 id: branch-name - @@ -85,12 +85,12 @@ jobs: - name: Get Composer cache directory - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT id: composer-cache - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -99,7 +99,7 @@ jobs: - name: Cache composer.lock - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: composer.lock key: ${{ steps.branch-name.outputs.base_ref_branch }}-${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-lock @@ -107,7 +107,7 @@ jobs: ${{ steps.branch-name.outputs.base_ref_branch }}-${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-lock - name: Check existence of composer.lock - uses: andstor/file-existence-action@v1 + uses: andstor/file-existence-action@v2 id: check-old-composer-lock-existence with: files: composer.lock @@ -126,14 +126,6 @@ jobs: run: composer validate --strict --no-check-version if: always() && steps.end-of-setup.outcome == 'success' - - - name: Generate composer diff - uses: IonBazan/composer-diff-action@v1 - if: steps.check-old-composer-lock-existence.outputs.files_exists == 'true' - id: composer_diff - with: - base: old-composer.lock - - name: Check for security vulnerabilities run: symfony security:check @@ -192,7 +184,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run PHPArkitect @@ -225,7 +217,7 @@ jobs: api-platform: "~2.6.0" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -250,10 +242,10 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -283,7 +275,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Shutdown default MySQL run: sudo service mysql stop @@ -313,11 +305,11 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -431,7 +423,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Shutdown default MySQL run: sudo service mysql stop @@ -467,11 +459,11 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -568,7 +560,7 @@ jobs: - name: Upload Behat logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" @@ -639,7 +631,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Shutdown default MySQL @@ -690,11 +682,11 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -793,7 +785,7 @@ jobs: - name: Upload Behat logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" @@ -828,7 +820,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Shutdown default MySQL @@ -870,11 +862,11 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -887,18 +879,18 @@ jobs: - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: "${{ matrix.node }}" - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} @@ -955,7 +947,7 @@ jobs: - name: Upload Behat logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: "Behat logs (JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" @@ -1233,8 +1225,8 @@ jobs: id: process-data shell: bash run: | - echo "::set-output name=branch::$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" - echo "::set-output name=sha::$(echo ${{ github.sha }} | cut -c 1-12)" + echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT + echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT - name: "Notify on Slack" diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 8dfc6091d4..d98fa6c652 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -7,7 +7,7 @@ jobs: auto-merge: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Auto-merge minor dependencies upgrades diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 628f2de8cc..beaa5a1cd6 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -26,7 +26,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install documentation dependencies @@ -53,8 +53,8 @@ jobs: id: process-data shell: bash run: | - echo "::set-output name=branch::$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" - echo "::set-output name=sha::$(echo ${{ github.sha }} | cut -c 1-12)" + echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT + echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT - name: "Notify on Slack" diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index e3d5686523..37f788b40f 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -28,12 +28,12 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "Provide the list" id: create-list - run: echo "::set-output name=packages::$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)" + run: echo "packages=$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)" >> $GITHUB_OUTPUT outputs: packages: "${{ steps.create-list.outputs.packages }}" @@ -78,7 +78,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -90,11 +90,11 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer-${{ hashFiles(format('src/Sylius/{0}/composer.json', matrix.package)) }} @@ -168,14 +168,14 @@ jobs: - name: Check the existence of phpunit.xml.dist id: phpunit_xml_dist_existence_check - uses: andstor/file-existence-action@v1 + uses: andstor/file-existence-action@v2 with: files: "src/Sylius/${{ matrix.package }}/phpunit.xml.dist" - name: Check the existence of phpunit.xml id: phpunit_xml_existence_check - uses: andstor/file-existence-action@v1 + uses: andstor/file-existence-action@v2 with: files: "src/Sylius/${{ matrix.package }}/phpunit.xml" @@ -202,8 +202,8 @@ jobs: id: process-data shell: bash run: | - echo "::set-output name=branch::$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" - echo "::set-output name=sha::$(echo ${{ github.sha }} | cut -c 1-12)" + echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT + echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT - name: "Notify on Slack" diff --git a/.github/workflows/social-media-notifications.yaml b/.github/workflows/social-media-notifications.yaml index eb9ca85742..0e6f27e157 100644 --- a/.github/workflows/social-media-notifications.yaml +++ b/.github/workflows/social-media-notifications.yaml @@ -13,7 +13,7 @@ jobs: - name: Get current date id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - name: Tweet about new release uses: Eomm/why-don-t-you-tweet@v1 diff --git a/bin/console b/bin/console index 52fd3989fb..13506e61ce 100755 --- a/bin/console +++ b/bin/console @@ -3,36 +3,13 @@ use App\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Debug\Debug; -set_time_limit(0); - -require dirname(__DIR__).'/vendor/autoload.php'; - -if (!class_exists(Application::class)) { - throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); +if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { + throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); } -$input = new ArgvInput(); -if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} +require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); +return static function (array $context) { + return new Application(new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG'])); +}; diff --git a/composer.json b/composer.json index f0f861b0f7..a4fd32bef9 100644 --- a/composer.json +++ b/composer.json @@ -223,6 +223,7 @@ "symfony/debug-bundle": "^5.4 || ^6.0", "symfony/dotenv": "^5.4 || ^6.0", "symfony/flex": "^1.7", + "symfony/runtime": "^5.4 || ^6.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0", "symplify/monorepo-builder": "^11.0", "vimeo/psalm": "^4.19" @@ -239,8 +240,9 @@ }, "sort-packages": true, "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": false, "symfony/flex": true, - "dealerdirect/phpcodesniffer-composer-installer": false + "symfony/runtime": true } }, "extra": { diff --git a/public/index.php b/public/index.php index db05775c9f..508a169254 100644 --- a/public/index.php +++ b/public/index.php @@ -3,27 +3,9 @@ declare(strict_types=1); use App\Kernel; -use Symfony\Component\ErrorHandler\Debug; -use Symfony\Component\HttpFoundation\Request; -require dirname(__DIR__) . '/config/bootstrap.php'; +require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - Debug::enable(); -} - -if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); -} - -if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts([$trustedHosts]); -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$request = Request::createFromGlobals(); -$response = $kernel->handle($request); -$response->send(); -$kernel->terminate($request, $response); +return static function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); +}; diff --git a/src/Kernel.php b/src/Kernel.php index 02a6b93a6f..c0e9b01c99 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -24,7 +24,7 @@ class Kernel extends BaseKernel protected function getContainerBaseClass(): string { - if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { + if (class_exists(MockerContainer::class) && $this->isTestEnvironment()) { return MockerContainer::class; } @@ -33,6 +33,6 @@ class Kernel extends BaseKernel private function isTestEnvironment(): bool { - return 0 === strpos($this->getEnvironment(), 'test'); + return str_starts_with($this->getEnvironment(), 'test'); } } diff --git a/symfony.lock b/symfony.lock index a781f64ee6..c6ec3e47ed 100644 --- a/symfony.lock +++ b/symfony.lock @@ -170,9 +170,6 @@ "felixfbecker/language-server-protocol": { "version": "v1.4.0" }, - "fig/link-util": { - "version": "1.1.0" - }, "friends-of-behat/mink": { "version": "v1.8.0" }, @@ -376,9 +373,6 @@ "pagerfanta/pagerfanta": { "version": "v3.5.2" }, - "paragonie/random_compat": { - "version": "v2.0.18" - }, "payum/iso4217": { "version": "1.0.1" },