diff --git a/composer.lock b/composer.lock index 3a67b9e8b..a65599b2b 100644 --- a/composer.lock +++ b/composer.lock @@ -1695,16 +1695,16 @@ }, { "name": "imagine/imagine", - "version": "1.3.5", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/php-imagine/Imagine.git", - "reference": "7151d553edec4dc2bbac60419f7a74ff34700e7f" + "reference": "2c8887dc7e84e97283037f02dd9c957d4b3a0b82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-imagine/Imagine/zipball/7151d553edec4dc2bbac60419f7a74ff34700e7f", - "reference": "7151d553edec4dc2bbac60419f7a74ff34700e7f", + "url": "https://api.github.com/repos/php-imagine/Imagine/zipball/2c8887dc7e84e97283037f02dd9c957d4b3a0b82", + "reference": "2c8887dc7e84e97283037f02dd9c957d4b3a0b82", "shasum": "" }, "require": { @@ -1751,9 +1751,9 @@ ], "support": { "issues": "https://github.com/php-imagine/Imagine/issues", - "source": "https://github.com/php-imagine/Imagine/tree/1.3.5" + "source": "https://github.com/php-imagine/Imagine/tree/1.4.0" }, - "time": "2023-06-07T14:49:52+00:00" + "time": "2024-11-18T07:44:52+00:00" }, { "name": "jms/metadata", @@ -7823,7 +7823,7 @@ }, { "name": "twig/cssinliner-extra", - "version": "v3.13.0", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/cssinliner-extra.git", @@ -7876,7 +7876,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.13.0" + "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.15.0" }, "funding": [ { @@ -7892,23 +7892,23 @@ }, { "name": "twig/extra-bundle", - "version": "v3.13.0", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "21a9a7aa9f79d4493bb6fed4eb2794339f9551f5" + "reference": "9746573ca4bc1cd03a767a183faadaf84e0c31fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/21a9a7aa9f79d4493bb6fed4eb2794339f9551f5", - "reference": "21a9a7aa9f79d4493bb6fed4eb2794339f9551f5", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/9746573ca4bc1cd03a767a183faadaf84e0c31fa", + "reference": "9746573ca4bc1cd03a767a183faadaf84e0c31fa", "shasum": "" }, "require": { "php": ">=8.0.2", "symfony/framework-bundle": "^5.4|^6.4|^7.0", "symfony/twig-bundle": "^5.4|^6.4|^7.0", - "twig/twig": "^3.0|^4.0" + "twig/twig": "^3.2|^4.0" }, "require-dev": { "league/commonmark": "^1.0|^2.0", @@ -7950,7 +7950,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.13.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.15.0" }, "funding": [ { @@ -7962,11 +7962,11 @@ "type": "tidelift" } ], - "time": "2024-09-01T20:39:12+00:00" + "time": "2024-09-26T19:22:23+00:00" }, { "name": "twig/inky-extra", - "version": "v3.13.0", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/inky-extra.git", @@ -8020,7 +8020,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/inky-extra/tree/v3.13.0" + "source": "https://github.com/twigphp/inky-extra/tree/v3.15.0" }, "funding": [ { @@ -8036,7 +8036,7 @@ }, { "name": "twig/markdown-extra", - "version": "v3.13.0", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/markdown-extra.git", @@ -8092,7 +8092,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/markdown-extra/tree/v3.13.0" + "source": "https://github.com/twigphp/markdown-extra/tree/v3.15.0" }, "funding": [ { @@ -8108,16 +8108,16 @@ }, { "name": "twig/string-extra", - "version": "v3.13.0", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/string-extra.git", - "reference": "148e869d87cf4bea9d97896ab49e048e4add3310" + "reference": "b098bd4910aba185afb70e40b8e23071fce8c656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/string-extra/zipball/148e869d87cf4bea9d97896ab49e048e4add3310", - "reference": "148e869d87cf4bea9d97896ab49e048e4add3310", + "url": "https://api.github.com/repos/twigphp/string-extra/zipball/b098bd4910aba185afb70e40b8e23071fce8c656", + "reference": "b098bd4910aba185afb70e40b8e23071fce8c656", "shasum": "" }, "require": { @@ -8159,7 +8159,7 @@ "unicode" ], "support": { - "source": "https://github.com/twigphp/string-extra/tree/v3.13.0" + "source": "https://github.com/twigphp/string-extra/tree/v3.15.0" }, "funding": [ { @@ -8171,20 +8171,20 @@ "type": "tidelift" } ], - "time": "2024-09-03T13:08:40+00:00" + "time": "2024-11-03T14:08:48+00:00" }, { "name": "twig/twig", - "version": "v3.14.2", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a" + "reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", - "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/2d5b3964cc21d0188633d7ddce732dc8e874db02", + "reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02", "shasum": "" }, "require": { @@ -8238,7 +8238,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.14.2" + "source": "https://github.com/twigphp/Twig/tree/v3.15.0" }, "funding": [ { @@ -8250,20 +8250,20 @@ "type": "tidelift" } ], - "time": "2024-11-07T12:36:22+00:00" + "time": "2024-11-17T15:59:19+00:00" }, { "name": "vich/uploader-bundle", - "version": "v2.4.2", + "version": "v2.4.3", "source": { "type": "git", "url": "https://github.com/dustin10/VichUploaderBundle.git", - "reference": "5eb6c3a19655383e392816bc5d1c9f069fbe2414" + "reference": "7925bea64df77991caacf8967f602efb268a3724" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dustin10/VichUploaderBundle/zipball/5eb6c3a19655383e392816bc5d1c9f069fbe2414", - "reference": "5eb6c3a19655383e392816bc5d1c9f069fbe2414", + "url": "https://api.github.com/repos/dustin10/VichUploaderBundle/zipball/7925bea64df77991caacf8967f602efb268a3724", + "reference": "7925bea64df77991caacf8967f602efb268a3724", "shasum": "" }, "require": { @@ -8357,9 +8357,9 @@ ], "support": { "issues": "https://github.com/dustin10/VichUploaderBundle/issues", - "source": "https://github.com/dustin10/VichUploaderBundle/tree/v2.4.2" + "source": "https://github.com/dustin10/VichUploaderBundle/tree/v2.4.3" }, - "time": "2024-10-12T17:01:14+00:00" + "time": "2024-11-18T06:29:52+00:00" } ], "packages-dev": [ diff --git a/src/Service/RecaptchaService.php b/src/Service/RecaptchaService.php index 557a52f2c..7d22f38cc 100644 --- a/src/Service/RecaptchaService.php +++ b/src/Service/RecaptchaService.php @@ -13,7 +13,6 @@ namespace App\Service; use App\Traits\MathTrait; -use App\Traits\TranslatorTrait; use ReCaptcha\ReCaptcha; use ReCaptcha\Response; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -26,7 +25,6 @@ class RecaptchaService { use MathTrait; - use TranslatorTrait; public const ERROR_PREFIX = 'recaptcha.'; @@ -91,11 +89,6 @@ public function getSiteKey(): string return $this->siteKey; } - public function getTranslator(): TranslatorInterface - { - return $this->translator; - } - /** * Sets a timeout, in seconds, to test against the challenge timestamp in verify(). */ @@ -135,7 +128,7 @@ public function setScoreThreshold(float $scoreThreshold): self */ public function translateError(string $id): string { - return $this->trans(self::ERROR_PREFIX . $id, [], 'validators'); + return $this->translator->trans(id: self::ERROR_PREFIX . $id, domain: 'validators'); } /** diff --git a/src/Twig/EnumExtension.php b/src/Twig/EnumExtension.php deleted file mode 100644 index d93d84034..000000000 --- a/src/Twig/EnumExtension.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace App\Twig; - -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * Twig extension for enumeration types. - */ -class EnumExtension extends AbstractExtension -{ - public function getFunctions(): array - { - return [ - new TwigFunction('enum', $this->enum(...)), - ]; - } - - private function enum(string $fullClassName): object - { - $parts = \explode('::', $fullClassName); - /** @psalm-var class-string<\UnitEnum> $className */ - $className = $parts[0]; - $enumName = $parts[1] ?? null; - if (!\enum_exists($className)) { - throw new \InvalidArgumentException(\sprintf('"%s" is not an enum.', $className)); - } - if (null !== $enumName) { - return (object) \constant($fullClassName); - } - - return new class($fullClassName) { - public function __construct(private readonly string $fullClassName) - { - } - - public function __call(string $name, array $arguments): mixed - { - /** @psalm-var callable $callable */ - $callable = [$this->fullClassName, $name]; - - return \call_user_func_array($callable, $arguments); - } - }; - } -} diff --git a/src/Twig/Node/CaseNode.php b/src/Twig/Node/CaseNode.php new file mode 100644 index 000000000..b5a8b04fc --- /dev/null +++ b/src/Twig/Node/CaseNode.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace App\Twig\Node; + +use Twig\Attribute\YieldReady; +use Twig\Node\Node; +use Twig\Node\Nodes; + +/** + * Class CaseNode. + */ +#[YieldReady] +class CaseNode extends Node +{ + /** + * @param Node[] $values + */ + public function __construct(array $values, Node $body) + { + parent::__construct([ + 'values' => new Nodes($values), + 'body' => $body, + ]); + } +} diff --git a/src/Twig/Node/SwitchNode.php b/src/Twig/Node/SwitchNode.php index 0d16336f6..6aaeb552b 100644 --- a/src/Twig/Node/SwitchNode.php +++ b/src/Twig/Node/SwitchNode.php @@ -36,9 +36,7 @@ public function compile(Compiler $compiler): void ->raw(") {\n") ->indent(); - /** @psalm-var Node $case */ foreach ($this->getNode('cases') as $case) { - /** @psalm-var Node $value */ foreach ($case->getNode('values') as $value) { $compiler->write('case ') ->subcompile($value) diff --git a/src/Twig/TokenParser/SwitchTokenParser.php b/src/Twig/TokenParser/SwitchTokenParser.php index 31d4b8858..c7b87cc82 100644 --- a/src/Twig/TokenParser/SwitchTokenParser.php +++ b/src/Twig/TokenParser/SwitchTokenParser.php @@ -12,9 +12,11 @@ namespace App\Twig\TokenParser; +use App\Twig\Node\CaseNode; use App\Twig\Node\SwitchNode; use Twig\Error\SyntaxError; use Twig\Node\Node; +use Twig\Node\Nodes; use Twig\Token; use Twig\TokenParser\AbstractTokenParser; @@ -69,10 +71,7 @@ public function parse(Token $token): SwitchNode } $stream->expect(Token::BLOCK_END_TYPE); $body = $this->parser->subparse(fn (Token $token): bool => $this->isFork($token)); - $cases[] = new Node([ - 'values' => new Node($values), - 'body' => $body, - ]); + $cases[] = new CaseNode($values, $body); break; case 'default': @@ -85,10 +84,10 @@ public function parse(Token $token): SwitchNode break; default: - throw new SyntaxError(\sprintf('Unexpected end of template. Twig was looking for the following tags "case", "default", or "endswitch" to close the "switch" block started at line %d).', $lineno), -1); + throw new SyntaxError(\sprintf('Unexpected end of template. Twig was looking for the following tags "case", "default", or "endswitch" to close the "switch" block started at line %d).', $lineno)); } } - $nodes['cases'] = new Node($cases); + $nodes['cases'] = new Nodes($cases); $stream->expect(Token::BLOCK_END_TYPE); return new SwitchNode($nodes, [], $lineno); diff --git a/templates/about/about.html.twig b/templates/about/about.html.twig index 7e0047b40..3ab1d557c 100644 --- a/templates/about/about.html.twig +++ b/templates/about/about.html.twig @@ -62,12 +62,12 @@ {% block body %} {{ parent() }}
- {{ _self.card('licence', 'about_licence_pdf', false, 'about_licence_word') }} - {{ _self.card('policy', 'about_policy_pdf', false, 'about_policy_word') }} + {{ _self.card(id: 'licence', pdf_route: 'about_licence_pdf', word_route: 'about_licence_word') }} + {{ _self.card(id: 'policy', pdf_route: 'about_policy_pdf', word_route: 'about_policy_word') }} {% if is_admin %} - {{ _self.card('symfony', 'about_symfony_pdf', 'about_symfony_excel') }} - {{ _self.card('php', 'about_php_pdf', 'about_php_excel') }} - {{ _self.card('mysql', 'about_mysql_pdf', 'about_mysql_excel', false) }} + {{ _self.card(id: 'symfony', pdf_route: 'about_symfony_pdf', excel_route: 'about_symfony_excel') }} + {{ _self.card(id: 'php', pdf_route: 'about_php_pdf', excel_route: 'about_php_excel') }} + {{ _self.card(id: 'mysql', pdf_route: 'about_mysql_pdf', excel_route: 'about_mysql_excel') }} {% endif %}
diff --git a/templates/customer/customer_show.html.twig b/templates/customer/customer_show.html.twig index e3cb0d4d2..8bdfaa779 100644 --- a/templates/customer/customer_show.html.twig +++ b/templates/customer/customer_show.html.twig @@ -17,5 +17,5 @@ {{ property('customer.fields.zipCode', item.zipCode) }} {{ property('customer.fields.city', item.city) }} {{ email(item.email, null, 'customer.fields.email') }} -{{ externalLink(item.webSite, null, null, 'customer.fields.webSite') }} +{{ externalLink(href: item.webSite, name: 'customer.fields.webSite') }} {% endblock %} diff --git a/templates/dialog/dialog_edit.html.twig b/templates/dialog/dialog_edit.html.twig index d420ee03d..0ee33451f 100644 --- a/templates/dialog/dialog_edit.html.twig +++ b/templates/dialog/dialog_edit.html.twig @@ -15,7 +15,7 @@
diff --git a/templates/dialog/dialog_raw_data.html.twig b/templates/dialog/dialog_raw_data.html.twig index fb5b47a3a..950b7ed32 100644 --- a/templates/dialog/dialog_raw_data.html.twig +++ b/templates/dialog/dialog_raw_data.html.twig @@ -8,7 +8,7 @@ diff --git a/templates/dialog/dialog_theme.html.twig b/templates/dialog/dialog_theme.html.twig index a4bdfc120..6ecb6bd27 100644 --- a/templates/dialog/dialog_theme.html.twig +++ b/templates/dialog/dialog_theme.html.twig @@ -37,7 +37,7 @@