Update to Symfony 7.4

This commit is contained in:
Javier Eguiluz
2025-11-04 12:20:44 +01:00
parent d3ebca2167
commit d5693df278
18 changed files with 3419 additions and 1263 deletions

7
.env
View File

@@ -17,6 +17,7 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
APP_SHARE_DIR=var/share
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
@@ -32,3 +33,9 @@ DATABASE_URL="sqlite:///%kernel.project_dir%/data/database.sqlite"
###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###
###> symfony/routing ###
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
DEFAULT_URI=http://localhost
###< symfony/routing ###

View File

@@ -1,5 +1,5 @@
// start the Stimulus application
import './bootstrap.js';
import './stimulus_bootstrap.js';
import './styles/app.scss';
import 'highlight.js/styles/github-dark-dimmed.css';
import 'lato-font/css/lato-font.css';

View File

@@ -2,6 +2,8 @@ const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;
const tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;
// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager
// Use `form.requestSubmit()` to ensure that the submit event is triggered. Using `form.submit()` will not trigger the event
// and thus this event-listener will not be executed.
document.addEventListener('submit', function (event) {
generateCsrfToken(event.target);
}, true);
@@ -33,8 +35,8 @@ export function generateCsrfToken (formElement) {
if (!csrfCookie && nameCheck.test(csrfToken)) {
csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);
csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));
csrfField.dispatchEvent(new Event('change', { bubbles: true }));
}
csrfField.dispatchEvent(new Event('change', { bubbles: true }));
if (csrfCookie && tokenCheck.test(csrfToken)) {
const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';

View File

@@ -1,5 +1,6 @@
import { startStimulusApp } from '@symfony/stimulus-bundle';
const app = startStimulusApp();
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

4
bin/phpunit Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';

View File

@@ -3,8 +3,8 @@
"license": "MIT",
"type": "project",
"description": "Symfony Demo Application",
"minimum-stability": "stable",
"prefer-stable": true,
"minimum-stability": "dev",
"prefer-stable": false,
"require": {
"php": ">=8.2",
"ext-ctype": "*",
@@ -111,7 +111,7 @@
"extra": {
"symfony": {
"allow-contrib": true,
"require": "7.3.*"
"require": "7.4.*"
}
}
}

2782
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,8 @@ framework:
paths:
- assets/
missing_import_mode: strict
excluded_patterns:
- '**/assets/styles/**/_*.scss'
when@prod:
framework:

View File

@@ -10,14 +10,6 @@ when@dev:
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
@@ -44,7 +36,8 @@ when@prod:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [ 404, 405 ]
excluded_http_codes: [404, 405]
channels: ["!deprecation"]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream

View File

@@ -2,7 +2,7 @@ framework:
router:
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost
default_uri: '%env(DEFAULT_URI)%'
when@prod:
framework:

View File

@@ -16,7 +16,8 @@ security:
# https://symfony.com/doc/current/security.html#a-authentication-firewalls
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
# Ensure dev tools and static assets are always allowed
pattern: ^/(_profiler|_wdt|assets|build)/
security: false
main:
@@ -69,10 +70,8 @@ when@test:
# See https://symfony.com/doc/current/testing/http_authentication.html
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
# Password hashers are resource-intensive by design to ensure security.
# In tests, it's safe to reduce their cost to improve performance.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt

View File

@@ -0,0 +1,3 @@
symfonycasts_sass:
root_sass:
- 'assets/styles/app.scss'

View File

@@ -1,8 +1,25 @@
# Full configuration reference: https://symfony.com/bundles/ux-icons/current/index.html#configuration
ux_icons:
# Default HTML attributes to add to all icons
default_icon_attributes:
width: 1.2em
height: 1.2em
# Use current text color to fill the icon
fill: currentColor
# Default dimensions
width: '1.2em'
height: '1.2em'
style: 'position: relative; top: -2px;'
aliases:
'tabler:save-changes': 'tabler:device-floppy'
# Throw an exception if an icon is not
ignore_not_found: false
when@prod:
ux_icons:
# Suppress exceptions for missing icons in production
ignore_not_found: true

1750
config/reference.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,12 @@
# yaml-language-server: $schema=../vendor/symfony/routing/Loader/schema/routing.schema.json
# This file is the entry point to configure the routes of your app.
# Methods with the #[Route] attribute are automatically imported.
# See also https://symfony.com/doc/current/routing.html
# To list all registered routes, run the following command:
# php bin/console debug:router
# These lines define a route using YAML configuration. The controller used by
# the route (FrameworkBundle:Template:template) is a convenient shortcut when
# the template can be rendered without executing any logic in your own controller.
@@ -10,10 +19,7 @@ homepage:
_locale: '%app.locale%'
controllers:
resource:
path: '../src/Controller/'
namespace: App\Controller
type: attribute
resource: routing.controllers
prefix: /{_locale}
defaults:
_locale: '%app.locale%'

View File

@@ -1,5 +1,8 @@
# yaml-language-server: $schema=../vendor/symfony/dependency-injection/Loader/schema/services.schema.json
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# See also https://symfony.com/doc/current/service_container/import.html
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration

View File

@@ -33,9 +33,9 @@
</include>
<deprecationTrigger>
<function>trigger_deprecation</function>
<method>Doctrine\Deprecations\Deprecation::trigger</method>
<method>Doctrine\Deprecations\Deprecation::delegateTriggerToBackend</method>
<function>trigger_deprecation</function>
</deprecationTrigger>
</source>

View File

@@ -77,10 +77,11 @@
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "11.1",
"ref": "c6658a60fc9d594805370eacdf542c3d6b5c0869"
"ref": "1117deb12541f35793eec9fff7494d7aa12283fc"
},
"files": [
".env.test",
"bin/phpunit",
"phpunit.dist.xml",
"tests/bootstrap.php"
]
@@ -162,12 +163,12 @@
]
},
"symfony/framework-bundle": {
"version": "7.3",
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.3",
"ref": "5a1497d539f691b96afd45ae397ce5fe30beb4b9"
"version": "7.4",
"ref": "09f6e081c763a206802674ce0cb34a022f0ffc6d"
},
"files": [
".editorconfig",
@@ -203,32 +204,17 @@
}
},
"symfony/monolog-bundle": {
"version": "3.10",
"version": "3.9999999",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.7",
"ref": "aff23899c4440dd995907613c1dd709b6f59503f"
"ref": "1b9efb10c54cb51c713a9391c9300ff8bceda459"
},
"files": [
"config/packages/monolog.yaml"
]
},
"symfony/phpunit-bridge": {
"version": "7.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "a411a0480041243d97382cac7984f7dce7813c08"
},
"files": [
".env.test",
"bin/phpunit",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
},
"symfony/property-info": {
"version": "7.3",
"recipe": {
@@ -242,12 +228,12 @@
]
},
"symfony/routing": {
"version": "7.2",
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.0",
"ref": "21b72649d5622d8f7da329ffb5afb232a023619d"
"version": "7.4",
"ref": "bc94c4fd86f393f3ab3947c18b830ea343e51ded"
},
"files": [
"config/packages/routing.yaml",
@@ -255,12 +241,12 @@
]
},
"symfony/security-bundle": {
"version": "7.2",
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.4",
"ref": "2ae08430db28c8eb4476605894296c82a642028f"
"version": "7.4",
"ref": "c42fee7802181cdd50f61b8622715829f5d2335c"
},
"files": [
"config/packages/security.yaml",
@@ -268,18 +254,18 @@
]
},
"symfony/stimulus-bundle": {
"version": "2.29",
"version": "2.31",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.20",
"ref": "e058471c5502e549c1404ebdd510099107bb5549"
"version": "2.24",
"ref": "3357f2fa6627b93658d8e13baa416b2a94a50c5f"
},
"files": [
"assets/bootstrap.js",
"assets/controllers.json",
"assets/controllers/csrf_protection_controller.js",
"assets/controllers/hello_controller.js"
"assets/controllers/hello_controller.js",
"assets/stimulus_bootstrap.js"
]
},
"symfony/translation": {
@@ -309,15 +295,16 @@
]
},
"symfony/ux-icons": {
"version": "2.23",
"version": "2.9999999",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.17",
"ref": "803a3bbd5893f9584969ab8670290cdfb6a0a5b5"
"version": "2.19",
"ref": "c965ca0bf8a40e03420d57e08cff0bf6045e4ae7"
},
"files": [
"./assets/icons/symfony.svg"
"assets/icons/symfony.svg",
"config/packages/ux_icons.yaml"
]
},
"symfony/ux-live-component": {