diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index f030d26..82d6b15 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: php-version: - - "8.4" + - "8.5" steps: - name: "Install PHP" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b077f4..258f44e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ cache: &global_cache # Build section Install dependencies and build assets: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - COMPOSER_MEMORY_LIMIT=-1 composer install --no-scripts --no-progress - COMPOSER_MEMORY_LIMIT=-1 composer run-script post-autoload-dump @@ -35,7 +35,7 @@ Install dependencies and build assets: # Code Quality section PHP_CodeSniffer - check code styling: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - php vendor/bin/phpcs --colors --report-full --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-report.json artifacts: @@ -48,7 +48,7 @@ PHP_CodeSniffer - check code styling: - docker PHPStan - check for bugs: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest before_script: - php bin/console cache:warmup --env=dev script: @@ -69,7 +69,7 @@ PHPStan - check for bugs: - docker Twig-CS-Fixer - check code styling: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - php vendor/bin/twig-cs-fixer lint templates/ --report=junit > twigcs-report.xml after_script: @@ -124,7 +124,7 @@ StandardJS - check code styling: # Dependency Scanning section NPM packages - check for vulnerabilities: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - php bin/console importmap:audit --no-interaction --ansi stage: dependency scanning @@ -134,7 +134,7 @@ NPM packages - check for vulnerabilities: allow_failure: true PHP packages - composer audit: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - composer audit --ansi --no-interaction stage: dependency scanning @@ -146,7 +146,7 @@ PHP packages - composer audit: # Outdated packages Scanning section NPM packages - check for outdated packages: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - php bin/console importmap:outdated --no-interaction --ansi stage: outdated packages @@ -156,7 +156,7 @@ NPM packages - check for outdated packages: allow_failure: true PHP packages - composer outdated: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - composer outdated --ansi --no-interaction --strict stage: outdated packages @@ -168,7 +168,7 @@ PHP packages - composer outdated: # Test section PHPUnit - Run tests: - image: sumocoders/framework-php84:latest + image: sumocoders/framework-php85:latest services: - mysql:8.0 before_script: @@ -203,7 +203,7 @@ PHPUnit - Run tests: # Scheduled tasks section Task - Update dependencies: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest script: - git config --global user.email "bot@sumocoders.be" - git config --global user.name "Sumo Bot" @@ -220,7 +220,7 @@ Task - Update dependencies: # Deploy section Deploy - to staging: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest before_script: # Add the private SSH key to the CI environment - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' @@ -234,7 +234,7 @@ Deploy - to staging: - php vendor/bin/dep deploy stage=staging environment: name: staging - url: https://$project.$client.php84.sumocoders.eu + url: https://$project.$client.php85.sumocoders.eu only: - staging stage: deploy @@ -244,7 +244,7 @@ Deploy - to staging: USER: "CI/CD gitlab-runner" Deploy - to production: - image: sumocoders/cli-tools-php84:latest + image: sumocoders/cli-tools-php85:latest before_script: # Add the private SSH key to the CI environment - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' diff --git a/.php-version b/.php-version index c9dc049..188c409 100644 --- a/.php-version +++ b/.php-version @@ -1 +1 @@ -8.4 +8.5 diff --git a/composer.json b/composer.json index bf110ae..cb1294c 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "project", "license": "proprietary", "require": { - "php": "^8.4", + "php": "^8.5", "ext-ctype": "*", "ext-iconv": "*", "ext-sodium": "*", @@ -13,35 +13,35 @@ "beberlei/doctrineextensions": "^1.5", "doctrine/doctrine-migrations-bundle": "^3.3", "sentry/sentry-symfony": "^5.1", - "sumocoders/framework-core-bundle": "^16.0", + "sumocoders/framework-core-bundle": "^17.0", "symfony/apache-pack": "^1.0.1", - "symfony/asset-mapper": "^7.3", - "symfony/debug-bundle": "^7.3", - "symfony/dotenv": "^7.3", - "symfony/expression-language": "^7.3", + "symfony/asset-mapper": "^8.0", + "symfony/debug-bundle": "^8.0", + "symfony/dotenv": "^8.0", + "symfony/expression-language": "^8.0", "symfony/flex": "^2.4", - "symfony/http-client": "^7.3", - "symfony/mailer": "^7.3", - "symfony/messenger": "^7.3", + "symfony/http-client": "^8.0", + "symfony/mailer": "^8.0", + "symfony/messenger": "^8.0", "symfony/monolog-bundle": "^3.10", - "symfony/rate-limiter": "^7.3", - "symfony/runtime": "^7.3", - "symfony/security-bundle": "^7.3", + "symfony/rate-limiter": "^8.0", + "symfony/runtime": "^8.0", + "symfony/security-bundle": "^8.0", "symfony/stimulus-bundle": "^2.22", "symfony/ux-turbo": "^2.22", - "symfony/validator": "^7.3", - "symfony/web-profiler-bundle": "^7.3", - "symfony/yaml": "^7.3", + "symfony/validator": "^8.0", + "symfony/web-profiler-bundle": "^8.0", + "symfony/yaml": "^8.0", "symfonycasts/sass-bundle": "^0.8", "twbs/bootstrap": "^5.3", "twbs/bootstrap-icons": "^1.13", - "nelmio/security-bundle": "^3.5" + "nelmio/security-bundle": "^3.7" }, "require-dev": { }, "flex-require-dev": { "dama/doctrine-test-bundle": "^8.3", - "doctrine/doctrine-fixtures-bundle": "^3.7", + "doctrine/doctrine-fixtures-bundle": "^4.3", "micheh/phpcs-gitlab": "^2.0", "phpstan/phpstan-symfony": "^2.0", "phpstan/phpstan-doctrine": "^2.0", @@ -49,8 +49,8 @@ "squizlabs/php_codesniffer": "^4.0", "symfony/debug-pack": "*", "symfony/maker-bundle": "*", - "symfony/stopwatch": "^7.3", - "tijsverkoyen/deployer-sumo": "^4.1", + "symfony/stopwatch": "^8.0", + "tijsverkoyen/deployer-sumo": "^4.3", "vincentlanglet/twig-cs-fixer": "*" }, "config": { diff --git a/deploy.php b/deploy.php index 001ec84..61496eb 100644 --- a/deploy.php +++ b/deploy.php @@ -12,7 +12,7 @@ set('repository', '$repository'); set('production_url', '$productionUrl'); set('production_user', '$productionUser'); -set('php_version', '8.4'); +set('php_version', '8.5'); // Define staging host('dev03.sumocoders.eu') diff --git a/src/Skeleton/PostCreateProject.php b/src/Skeleton/PostCreateProject.php index a7e47f5..3636a5b 100644 --- a/src/Skeleton/PostCreateProject.php +++ b/src/Skeleton/PostCreateProject.php @@ -178,22 +178,21 @@ private static function reconfigureAnnotations(Event $event): void $projectDir = realpath($event->getComposer()->getConfig()->get('vendor-dir') . '/..'); $io->notice('→ Reconfigure annotations'); - $content = file_get_contents($projectDir . '/config/routes.yaml'); - $matches = []; - preg_match('|controllers:.*attribute|smU', $content, $matches, PREG_OFFSET_CAPTURE); - $offset = $matches[0][1] + mb_strlen($matches[0][0]); - $insert = [ - ' prefix: /{_locale}', - ' requirements:', - ' _locale: \'%locales_regex%\'', - ' trailing_slash_on_root: false', - ]; - $content = self::insertStringAtPosition( - $content, - $offset, - PHP_EOL . implode(PHP_EOL, $insert) - ); - file_put_contents($projectDir . '/config/routes.yaml', $content); + $routesFile = $projectDir . '/config/routes.yaml'; + + $content = implode(PHP_EOL, [ + 'controllers:', + ' resource:', + ' path: ../src/Controller/', + ' namespace: App\Controller', + ' type: attribute', + ' prefix: /{_locale}', + ' requirements:', + ' _locale: \'%locales_regex%\'', + ' trailing_slash_on_root: false', + ]); + + file_put_contents($routesFile, $content); } private static function reconfigureRouting(Event $event): void @@ -301,13 +300,22 @@ private static function reconfigureValidator(Event $event): void $projectDir = realpath($event->getComposer()->getConfig()->get('vendor-dir') . '/..'); $io->notice('→ Reconfigure validator'); - $content = file_get_contents($projectDir . '/config/packages/validator.yaml'); - $content = preg_replace( - '/email_validation_mode: .+/', - 'email_validation_mode: strict', - $content - ); - file_put_contents($projectDir . '/config/packages/validator.yaml', $content); + $file = $projectDir . '/config/packages/validator.yaml'; + $lines = file($file, FILE_IGNORE_NEW_LINES); + + $newLines = []; + $added = false; + + foreach ($lines as $line) { + $newLines[] = $line; + + if (!$added && preg_match('/^\s*validation:/', $line)) { + $newLines[] = ' email_validation_mode: strict'; + $added = true; + } + } + + file_put_contents($file, implode(PHP_EOL, $newLines)); } private static function reconfigureMonolog(Event $event): void