diff --git a/service-front/app/public/index.php b/service-front/app/public/index.php index f5ec42a10d..3cd9931d66 100644 --- a/service-front/app/public/index.php +++ b/service-front/app/public/index.php @@ -2,6 +2,9 @@ declare(strict_types=1); +use Mezzio\Application; +use Mezzio\MiddlewareFactory; + // Delegate static file requests back to the PHP built-in webserver if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) { return false; @@ -18,8 +21,8 @@ $container = require 'config/container.php'; /** @var \Mezzio\Application $app */ - $app = $container->get(\Mezzio\Application::class); - $factory = $container->get(\Mezzio\MiddlewareFactory::class); + $app = $container->get(Application::class); + $factory = $container->get(MiddlewareFactory::class); // Execute programmatic/declarative middleware pipeline and routing // configuration statements diff --git a/service-front/app/src/Actor/src/Form/CancelCode.php b/service-front/app/src/Actor/src/Form/CancelCode.php index c8d2c5308a..6e14dd54b8 100644 --- a/service-front/app/src/Actor/src/Form/CancelCode.php +++ b/service-front/app/src/Actor/src/Form/CancelCode.php @@ -10,7 +10,7 @@ class CancelCode extends AbstractForm implements InputFilterProviderInterface { - const FORM_NAME = 'cancel_code'; + public const FORM_NAME = 'cancel_code'; public function __construct(CsrfGuardInterface $csrfGuard) { diff --git a/service-front/app/src/Actor/src/Form/ChangeEmail.php b/service-front/app/src/Actor/src/Form/ChangeEmail.php index 9ae2bef598..6899b9814c 100644 --- a/service-front/app/src/Actor/src/Form/ChangeEmail.php +++ b/service-front/app/src/Actor/src/Form/ChangeEmail.php @@ -23,11 +23,12 @@ class ChangeEmail extends AbstractForm implements InputFilterProviderInterface /** * Error messages * - * @var array + * @var string[] */ protected array $messageTemplates = [ self::INVALID_PASSWORD => 'The password you entered is incorrect', - self::NEW_EMAIL_NOT_DIFFERENT => 'The new email address you entered is the same as your current email address. They must be different.', + self::NEW_EMAIL_NOT_DIFFERENT => 'The new email address you entered is the same as ' + . 'your current email address. They must be different.', ]; public function __construct(CsrfGuardInterface $guard) @@ -74,7 +75,8 @@ public function getInputFilterSpecification() 'break_chain_on_failure' => true, 'options' => [ 'messages' => [ - EmailAddressValidator::INVALID => 'Enter an email address in the correct format, like name@example.com', + EmailAddressValidator::INVALID => 'Enter an email address in the correct format, ' + . 'like name@example.com', ], ], ], diff --git a/service-front/app/src/Actor/src/Form/CreateAccount.php b/service-front/app/src/Actor/src/Form/CreateAccount.php index 92fb3d7a17..22848db208 100644 --- a/service-front/app/src/Actor/src/Form/CreateAccount.php +++ b/service-front/app/src/Actor/src/Form/CreateAccount.php @@ -17,14 +17,14 @@ class CreateAccount extends AbstractForm implements InputFilterProviderInterface { - const FORM_NAME = 'create_account'; + public const FORM_NAME = 'create_account'; public const NEW_EMAIL_CONFLICT = 'NewEmailConflict'; /** * Error messages * - * @var array + * @var string[] */ protected array $messageTemplates = [ self::NEW_EMAIL_CONFLICT => 'Sorry, there was a problem with that email address. Please try a different one', @@ -71,7 +71,8 @@ public function getInputFilterSpecification(): array 'break_chain_on_failure' => true, 'options' => [ 'messages' => [ - NotEmpty::IS_EMPTY => 'Enter an email address in the correct format, like name@example.com', + NotEmpty::IS_EMPTY => 'Enter an email address in the correct format, ' . + 'like name@example.com', ], ], ], diff --git a/service-front/app/src/Actor/src/Form/CreateShareCode.php b/service-front/app/src/Actor/src/Form/CreateShareCode.php index 71dc08c3ba..a0d634ec4d 100644 --- a/service-front/app/src/Actor/src/Form/CreateShareCode.php +++ b/service-front/app/src/Actor/src/Form/CreateShareCode.php @@ -12,7 +12,7 @@ class CreateShareCode extends AbstractForm implements InputFilterProviderInterface { - const FORM_NAME = 'lpa_sharecode_create'; + public const FORM_NAME = 'lpa_sharecode_create'; public function __construct(CsrfGuardInterface $csrfGuard) { diff --git a/service-front/app/src/Actor/src/Form/Login.php b/service-front/app/src/Actor/src/Form/Login.php index 39264caf13..99bc4dbc92 100644 --- a/service-front/app/src/Actor/src/Form/Login.php +++ b/service-front/app/src/Actor/src/Form/Login.php @@ -21,12 +21,12 @@ class Login extends AbstractForm implements InputFilterProviderInterface /** * Error messages * - * @var array + * @var string[] */ protected array $messageTemplates = [ self::NOT_SAME => 'Security validation failed. Please try again.', self::NOT_FOUND => 'Check your details and try again. We could not find a ' . - 'Use a lasting power of attorney account with that email address and password.' + 'Use a lasting power of attorney account with that email address and password.', ]; public function __construct(CsrfGuardInterface $csrfGuard) diff --git a/service-front/app/src/Actor/src/Form/LpaConfirm.php b/service-front/app/src/Actor/src/Form/LpaConfirm.php index d56556e65b..52858aa492 100644 --- a/service-front/app/src/Actor/src/Form/LpaConfirm.php +++ b/service-front/app/src/Actor/src/Form/LpaConfirm.php @@ -9,7 +9,7 @@ class LpaConfirm extends AbstractForm { - const FORM_NAME = 'lpa_add'; + public const FORM_NAME = 'lpa_add'; public function __construct(CsrfGuardInterface $csrfGuard) { diff --git a/service-front/app/src/Actor/src/Form/PasswordChange.php b/service-front/app/src/Actor/src/Form/PasswordChange.php index 71dbd2280f..6dbdcff35a 100644 --- a/service-front/app/src/Actor/src/Form/PasswordChange.php +++ b/service-front/app/src/Actor/src/Form/PasswordChange.php @@ -24,7 +24,7 @@ class PasswordChange extends AbstractForm implements InputFilterProviderInterfac /** * Error messages * - * @var array + * @var string[] */ protected array $messageTemplates = [ self::INVALID_PASSWORD => 'Current password is incorrect', diff --git a/service-front/app/src/Actor/src/Form/PasswordReset.php b/service-front/app/src/Actor/src/Form/PasswordReset.php index 3a5f1c12f6..39d03c7f31 100644 --- a/service-front/app/src/Actor/src/Form/PasswordReset.php +++ b/service-front/app/src/Actor/src/Form/PasswordReset.php @@ -12,7 +12,7 @@ class PasswordReset extends AbstractForm implements InputFilterProviderInterface { - const FORM_NAME = 'password-reset'; + public const FORM_NAME = 'password-reset'; public function __construct(CsrfGuardInterface $guard) { diff --git a/service-front/app/src/Actor/src/Form/RequestActivationKey/ActorRole.php b/service-front/app/src/Actor/src/Form/RequestActivationKey/ActorRole.php index 922778a33d..b75707b29d 100644 --- a/service-front/app/src/Actor/src/Form/RequestActivationKey/ActorRole.php +++ b/service-front/app/src/Actor/src/Form/RequestActivationKey/ActorRole.php @@ -23,8 +23,8 @@ public function __construct(CsrfGuardInterface $csrfGuard) 'type' => 'Radio', 'options' => [ 'value_options' => [ - 'Donor' => 'Donor', - 'Attorney' => 'Attorney', + 'Donor' => 'Donor', + 'Attorney' => 'Attorney', 'ReplacementAttorney' => 'ReplacementAttorney', ], ], diff --git a/service-front/app/src/Actor/src/Form/Triage.php b/service-front/app/src/Actor/src/Form/Triage.php index 4a9e33bdf9..b1e986a79d 100644 --- a/service-front/app/src/Actor/src/Form/Triage.php +++ b/service-front/app/src/Actor/src/Form/Triage.php @@ -11,7 +11,7 @@ class Triage extends AbstractForm implements InputFilterProviderInterface { - const FORM_NAME = 'triage'; + public const FORM_NAME = 'triage'; public function __construct(CsrfGuardInterface $csrfGuard) { diff --git a/service-front/app/src/Actor/src/Handler/AuthenticateOneLoginHandler.php b/service-front/app/src/Actor/src/Handler/AuthenticateOneLoginHandler.php index f4ae73cd5e..7a5cac5c11 100644 --- a/service-front/app/src/Actor/src/Handler/AuthenticateOneLoginHandler.php +++ b/service-front/app/src/Actor/src/Handler/AuthenticateOneLoginHandler.php @@ -23,6 +23,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Log\LoggerInterface; +use Locale; /** * @codeCoverageIgnore @@ -51,7 +52,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface if ($request->getMethod() === 'POST') { $signInLink = $this->serverUrlHelper->generate($this->urlHelper->generate('auth-redirect')); - $uiLocale = \Locale::getPrimaryLanguage($request->getAttribute('locale')); + $uiLocale = Locale::getPrimaryLanguage($request->getAttribute('locale')); if ($uiLocale === 'cy') { $signInLink = str_replace('/cy', '', $signInLink); diff --git a/service-front/app/src/Actor/src/Handler/CheckAccessCodesHandler.php b/service-front/app/src/Actor/src/Handler/CheckAccessCodesHandler.php index c8a7842193..bff8abb214 100644 --- a/service-front/app/src/Actor/src/Handler/CheckAccessCodesHandler.php +++ b/service-front/app/src/Actor/src/Handler/CheckAccessCodesHandler.php @@ -150,7 +150,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface $shareCodes[$key]['CreatedBy'] = $trustCorporation->getCompanyName(); } } - + $this->logger->debug( 'Created by resolved to {actor_name}', [ diff --git a/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckDetailsAndConsentHandler.php b/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckDetailsAndConsentHandler.php index 330c55952e..662b155a6b 100644 --- a/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckDetailsAndConsentHandler.php +++ b/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckDetailsAndConsentHandler.php @@ -225,7 +225,7 @@ public function handlePost(ServerRequestInterface $request): ResponseInterface 'Request for activation key for LPA {uID} with address abroad', [ 'event_code' => EventCodes::USER_ABROAD_ADDRESS_REQUEST_SUCCESS, - 'uID' => $state->referenceNumber + 'uID' => $state->referenceNumber, ] ); } diff --git a/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckYourAnswersHandler.php b/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckYourAnswersHandler.php index 3b60398fa5..2ad5224b9c 100644 --- a/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckYourAnswersHandler.php +++ b/service-front/app/src/Actor/src/Handler/RequestActivationKey/CheckYourAnswersHandler.php @@ -137,9 +137,11 @@ public function handlePost(ServerRequestInterface $request): ResponseInterface $state->postcode ); - if ($state->liveInUK === 'No' + if ( + $state->liveInUK === 'No' && $result->getResponse() !== AccessForAllResult::LPA_ALREADY_ADDED - && $result->getResponse() !== AccessForAllResult::STATUS_NOT_VALID) { + && $result->getResponse() !== AccessForAllResult::STATUS_NOT_VALID + ) { return $this->redirectToRoute('lpa.add.actor-address'); } @@ -211,7 +213,7 @@ public function handlePost(ServerRequestInterface $request): ResponseInterface ); case AccessForAllResult::DOES_NOT_MATCH: - return $this->redirectToRoute('lpa.add.actor-address'); + return $this->redirectToRoute('lpa.add.actor-address'); case AccessForAllResult::FOUND: $form = new CreateNewActivationKey($this->getCsrfGuard($request)); diff --git a/service-front/app/src/Common/src/ConfigProvider.php b/service-front/app/src/Common/src/ConfigProvider.php index 2ed58b3350..7eded9fbda 100644 --- a/service-front/app/src/Common/src/ConfigProvider.php +++ b/service-front/app/src/Common/src/ConfigProvider.php @@ -83,8 +83,7 @@ public function getDependencies(): array // allows value setting on the container at runtime. Service\Container\ModifiableContainerInterface::class => Service\Container\PhpDiModifiableContainer::class, - - Service\Lpa\LpaFactory::class => Service\Lpa\Factory\Sirius::class, + Service\Lpa\LpaFactory::class => Service\Lpa\Factory\Sirius::class, Service\Lpa\InstAndPrefImagesFactory::class => Service\Lpa\Factory\InstAndPrefImages::class, // Language extraction diff --git a/service-front/app/src/Common/src/Exception/AbstractApiException.php b/service-front/app/src/Common/src/Exception/AbstractApiException.php index 2b6962bf3b..ddf3200233 100644 --- a/service-front/app/src/Common/src/Exception/AbstractApiException.php +++ b/service-front/app/src/Common/src/Exception/AbstractApiException.php @@ -13,7 +13,7 @@ abstract class AbstractApiException extends RuntimeException { /** - * @var array + * @var string[] */ private array $additionalData = []; diff --git a/service-front/app/src/Common/src/Exception/ApiException.php b/service-front/app/src/Common/src/Exception/ApiException.php index 077190a062..e618be60a3 100644 --- a/service-front/app/src/Common/src/Exception/ApiException.php +++ b/service-front/app/src/Common/src/Exception/ApiException.php @@ -23,7 +23,7 @@ class ApiException extends AbstractApiException protected $code; /** - * @var array|null + * @var array|null */ protected ?array $additionalData = null; @@ -87,7 +87,7 @@ public static function create( } } - if ($statusCode != null) { + if ($statusCode !== null) { $code = $statusCode; } diff --git a/service-front/app/src/Common/src/Exception/InvalidRequestException.php b/service-front/app/src/Common/src/Exception/InvalidRequestException.php index 103770a6fd..72ca9b4c58 100644 --- a/service-front/app/src/Common/src/Exception/InvalidRequestException.php +++ b/service-front/app/src/Common/src/Exception/InvalidRequestException.php @@ -9,8 +9,11 @@ class InvalidRequestException extends Exception { - public function __construct(string $message, int $code = StatusCodeInterface::STATUS_BAD_REQUEST, ?Exception $previous = null) - { + public function __construct( + string $message, + int $code = StatusCodeInterface::STATUS_BAD_REQUEST, + ?Exception $previous = null, + ) { parent::__construct($message, $code, $previous); } } diff --git a/service-front/app/src/Common/src/Exception/RateLimitExceededException.php b/service-front/app/src/Common/src/Exception/RateLimitExceededException.php index e40fcf1729..a68b5e3a12 100644 --- a/service-front/app/src/Common/src/Exception/RateLimitExceededException.php +++ b/service-front/app/src/Common/src/Exception/RateLimitExceededException.php @@ -9,8 +9,11 @@ class RateLimitExceededException extends Exception { - public function __construct(string $message, int $code = StatusCodeInterface::STATUS_TOO_MANY_REQUESTS, ?Exception $previous = null) - { + public function __construct( + string $message, + int $code = StatusCodeInterface::STATUS_TOO_MANY_REQUESTS, + ?Exception $previous = null, + ) { parent::__construct($message, $code, $previous); } } diff --git a/service-front/app/src/Common/src/Form/AbstractForm.php b/service-front/app/src/Common/src/Form/AbstractForm.php index 969cc619fe..811dd39a64 100644 --- a/service-front/app/src/Common/src/Form/AbstractForm.php +++ b/service-front/app/src/Common/src/Form/AbstractForm.php @@ -15,11 +15,13 @@ abstract class AbstractForm extends Form /** * Error messages templates + * + * @var string[] */ protected array $messageTemplates = []; /** - * @var array This, and its associated functions below allow form level error messages not attached to + * @var string[] This, and its associated functions below allow form level error messages not attached to * any individual form elements. Something that Zend form does not provide OOTB. */ protected array $errorMessages = []; @@ -50,11 +52,11 @@ public function __construct(string $formName, CsrfGuardInterface $csrfGuard) public function addErrorMessage(string $messageKey, string $elementName = ''): void { if (! isset($this->messageTemplates[$messageKey])) { - throw new InvalidArgumentException("No message template exists for key '$messageKey'"); + throw new InvalidArgumentException('No message template exists for key ' . $messageKey); } if ($elementName !== '' && ! $this->has($elementName)) { - throw new InvalidArgumentException("No form element named '$elementName' found"); + throw new InvalidArgumentException('No form element named ' . $elementName . ' found'); } if ($elementName === '') { diff --git a/service-front/app/src/Common/src/Service/Lpa/PopulateLpaMetadata.php b/service-front/app/src/Common/src/Service/Lpa/PopulateLpaMetadata.php index 37d110dc07..4386445fbc 100644 --- a/service-front/app/src/Common/src/Service/Lpa/PopulateLpaMetadata.php +++ b/service-front/app/src/Common/src/Service/Lpa/PopulateLpaMetadata.php @@ -40,7 +40,7 @@ public function __invoke(ArrayObject $lpas, string $userToken): ArrayObject ); $lpas->$lpaKey->activeCodeCount = $shareCodes->activeCodeCount; - $lpas->$lpaKey->shareCodes = $shareCodes; + $lpas->$lpaKey->shareCodes = $shareCodes; $lpas->$lpaKey->actorActive = $lpaData['actor']['type'] === 'donor' || $lpaData['actor']['details']->getSystemStatus(); } diff --git a/service-front/app/src/Common/src/Service/Security/RateLimit/KeyedRateLimitService.php b/service-front/app/src/Common/src/Service/Security/RateLimit/KeyedRateLimitService.php index 3f550f2ca9..a845fc2706 100644 --- a/service-front/app/src/Common/src/Service/Security/RateLimit/KeyedRateLimitService.php +++ b/service-front/app/src/Common/src/Service/Security/RateLimit/KeyedRateLimitService.php @@ -32,7 +32,7 @@ public function isLimited(string $identity, string $key = ''): bool } // walk the time window and drop expired records - $expiredTime = time() - $this->interval; + $expiredTime = time() - $this->interval; $accessRecords = array_filter($accessRecords, function (int $item) use ($expiredTime) { return $item >= $expiredTime; }); diff --git a/service-front/app/src/Common/src/Service/Security/RateLimitService.php b/service-front/app/src/Common/src/Service/Security/RateLimitService.php index f2d5e7bcd4..2bad7c5002 100644 --- a/service-front/app/src/Common/src/Service/Security/RateLimitService.php +++ b/service-front/app/src/Common/src/Service/Security/RateLimitService.php @@ -9,8 +9,12 @@ abstract class RateLimitService implements RateLimiterInterface { - public function __construct(protected StorageInterface $cacheService, protected int $interval, protected int $requestsPerInterval, protected LoggerInterface $logger) - { + public function __construct( + protected StorageInterface $cacheService, + protected int $interval, + protected int $requestsPerInterval, + protected LoggerInterface $logger, + ) { } abstract public function isLimited(string $identity): bool; diff --git a/service-front/app/src/Common/src/Service/Security/RateLimitServiceFactory.php b/service-front/app/src/Common/src/Service/Security/RateLimitServiceFactory.php index 3555e2743d..6d7c0f4847 100644 --- a/service-front/app/src/Common/src/Service/Security/RateLimitServiceFactory.php +++ b/service-front/app/src/Common/src/Service/Security/RateLimitServiceFactory.php @@ -20,7 +20,6 @@ public function __construct(private ContainerInterface $container) * Returns a configured rate limit service loaded using the name given * * @param string $limitName - * * @return RateLimitService * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface diff --git a/service-front/app/src/Common/src/Service/Session/KeyManager/KmsManager.php b/service-front/app/src/Common/src/Service/Session/KeyManager/KmsManager.php index bd7d520398..fcb50884bf 100644 --- a/service-front/app/src/Common/src/Service/Session/KeyManager/KmsManager.php +++ b/service-front/app/src/Common/src/Service/Session/KeyManager/KmsManager.php @@ -16,18 +16,18 @@ class KmsManager implements KeyManagerInterface /** * Time to cache encryption data key. */ - const ENCRYPTION_KEY_TTL = 60 * 60 * 1; + public const ENCRYPTION_KEY_TTL = 60 * 60 * 1; /** * Time to cache decryption data keys. * These are held longer to allow for rotation crossover. */ - const DECRYPTION_KEY_TTL = 60 * 60 * 2; + public const DECRYPTION_KEY_TTL = 60 * 60 * 2; /** * Current Key name within the cache. */ - const CURRENT_ENCRYPTION_KEY = 'current_session_encryption_key'; + public const CURRENT_ENCRYPTION_KEY = 'current_session_encryption_key'; public function __construct(private KmsClient $kmsClient, private KeyCache $cache, private string $kmsAlias) { diff --git a/service-front/app/src/Common/src/Validator/CsrfGuardValidator.php b/service-front/app/src/Common/src/Validator/CsrfGuardValidator.php index 9acfe7c826..9a3e67d08a 100644 --- a/service-front/app/src/Common/src/Validator/CsrfGuardValidator.php +++ b/service-front/app/src/Common/src/Validator/CsrfGuardValidator.php @@ -25,6 +25,7 @@ class CsrfGuardValidator extends LaminasCsrf /** * Set to null in order to force the user to manually set it + * * @var ?string * @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint */ diff --git a/service-front/app/src/Common/src/Validator/DobValidator.php b/service-front/app/src/Common/src/Validator/DobValidator.php index 87cc8d45b2..8ccf5b68ea 100644 --- a/service-front/app/src/Common/src/Validator/DobValidator.php +++ b/service-front/app/src/Common/src/Validator/DobValidator.php @@ -23,8 +23,9 @@ class DobValidator extends DateValidator self::MONTH_INCOMPLETE => 'Date of birth must include a month', self::YEAR_INCOMPLETE => 'Date of birth must include a year', self::AGE_NEGATIVE => 'Date of birth must be in the past', - self::AGE_TOO_YOUNG => 'Check your date of birth is correct - you cannot be an attorney or donor if you’re under 18', - ]; + self::AGE_TOO_YOUNG => 'Check your date of birth is correct - you cannot be an attorney or donor' + . ' if you’re under 18', + ]; /** * @param mixed $value diff --git a/service-front/app/src/Common/src/View/Twig/GovUKLaminasFormExtension.php b/service-front/app/src/Common/src/View/Twig/GovUKLaminasFormExtension.php index 4ad8a2a4c4..bd249cb5f5 100644 --- a/service-front/app/src/Common/src/View/Twig/GovUKLaminasFormExtension.php +++ b/service-front/app/src/Common/src/View/Twig/GovUKLaminasFormExtension.php @@ -24,7 +24,7 @@ class GovUKLaminasFormExtension extends AbstractExtension /** * Map the element types to blocks in the Twig partial template * - * @var array + * @var string[] */ private array $blockMappings = [ Element\Checkbox::class => 'form_input_checkbox', @@ -45,10 +45,26 @@ class GovUKLaminasFormExtension extends AbstractExtension public function getFunctions(): array { return [ - new TwigFunction('govuk_form_open', [$this, 'formOpen'], ['needs_environment' => true, 'is_safe' => ['html']]), - new TwigFunction('govuk_form_close', [$this, 'formClose'], ['needs_environment' => true, 'is_safe' => ['html']]), - new TwigFunction('govuk_form_element', [$this, 'formElement'], ['needs_environment' => true, 'is_safe' => ['html']]), - new TwigFunction('govuk_form_fieldset', [$this, 'formFieldset'], ['needs_environment' => true, 'is_safe' => ['html']]), + new TwigFunction( + 'govuk_form_open', + [$this, 'formOpen'], + ['needs_environment' => true, 'is_safe' => ['html']] + ), + new TwigFunction( + 'govuk_form_close', + [$this, 'formClose'], + ['needs_environment' => true, 'is_safe' => ['html']] + ), + new TwigFunction( + 'govuk_form_element', + [$this, 'formElement'], + ['needs_environment' => true, 'is_safe' => ['html']] + ), + new TwigFunction( + 'govuk_form_fieldset', + [$this, 'formFieldset'], + ['needs_environment' => true, 'is_safe' => ['html']] + ), ]; } diff --git a/service-front/app/src/Common/src/View/Twig/TranslationSwitchExtension.php b/service-front/app/src/Common/src/View/Twig/TranslationSwitchExtension.php index 72bd5bc255..2d12c347a1 100644 --- a/service-front/app/src/Common/src/View/Twig/TranslationSwitchExtension.php +++ b/service-front/app/src/Common/src/View/Twig/TranslationSwitchExtension.php @@ -30,6 +30,6 @@ public function getFunctions(): array public function getRouteName(): ?string { $routeName = $this->urlHelper->getRouteResult()?->getMatchedRouteName(); - return (is_string($routeName)) ? $routeName : null; + return is_string($routeName) ? $routeName : null; } } diff --git a/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php b/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php index 58039f11d2..7ead2a8bf3 100644 --- a/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php +++ b/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php @@ -15,6 +15,8 @@ use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use Psr\Log\LoggerInterface; +use DateTimeInterface; +use DateInterval; /** * @codeCoverageIgnore @@ -28,7 +30,8 @@ public function __construct( private PdfService $pdfService, private FeatureEnabled $featureEnabled, private LoggerInterface $logger, - ) {} + ) { + } /** * @param ServerRequestInterface $request @@ -53,8 +56,8 @@ public function handle(ServerRequestInterface $request): ResponseInterface // TODO UML-2930 This date logic needs removing 30 days after 4th July (or whenever we go live, whichever // is later) // necessary for development. Do not uncomment for live environments. - $lpa->expires = (new DateTimeImmutable('+60 days'))->format(\DateTimeInterface::ATOM); - $codeCreated = (new DateTimeImmutable($lpa->expires))->sub(new \DateInterval('P30D')); + $lpa->expires = (new DateTimeImmutable('+60 days'))->format(DateTimeInterface::ATOM); + $codeCreated = (new DateTimeImmutable($lpa->expires))->sub(new DateInterval('P30D')); if ($codeCreated > new DateTimeImmutable('2023-07-04T23:59:59+01:00')) { $images = $lpa->iap; // TODO UML-2930 this is the only bit that should be kept