Skip to content

Commit

Permalink
Updated Twig to version 3.15.0. Remove enum extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Nov 18, 2024
1 parent 07213bd commit dbec91f
Show file tree
Hide file tree
Showing 20 changed files with 107 additions and 190 deletions.
74 changes: 37 additions & 37 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions src/Service/RecaptchaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +25,6 @@
class RecaptchaService
{
use MathTrait;
use TranslatorTrait;

public const ERROR_PREFIX = 'recaptcha.';

Expand Down Expand Up @@ -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 <code>verify()</code>.
*/
Expand Down Expand Up @@ -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');
}

/**
Expand Down
57 changes: 0 additions & 57 deletions src/Twig/EnumExtension.php

This file was deleted.

35 changes: 35 additions & 0 deletions src/Twig/Node/CaseNode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Calculation package.
*
* (c) bibi.nu <bibi@bibi.nu>
*
* 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,
]);
}
}
2 changes: 0 additions & 2 deletions src/Twig/Node/SwitchNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit dbec91f

Please sign in to comment.