From 48d9d51b11cdf306528b69eeddd34e41e0736a69 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Fri, 6 Dec 2024 08:56:36 +0000 Subject: [PATCH] Merge tag v2.4.0 into develop --- composer.json | 20 ++++----- config/services.yaml | 2 +- src/Api/Breadcrumbs/Breadcrumbs.php | 4 +- .../NodesSourcesSearchController.php | 17 ++------ src/Api/Extension/ArchiveExtension.php | 6 +-- .../AttributeValueRealmExtension.php | 6 +-- src/Api/Extension/NodesTagsQueryExtension.php | 4 +- src/Api/Model/NodesSourcesHead.php | 42 ++++++------------- src/Api/Model/NodesSourcesHeadFactory.php | 10 ++--- src/Api/OpenApi/JwtDecorator.php | 4 +- src/Api/OpenApi/PreviewDecorator.php | 4 +- src/Api/OpenApi/WebResponseDecorator.php | 4 +- .../TreeWalker/NodeSourceWalkerContext.php | 18 ++++---- .../NodeSourceWalkerContextFactory.php | 18 ++++---- src/Cache/CloudflareProxyCache.php | 16 +++---- src/Cache/ReverseProxyCache.php | 10 ++--- src/Cache/ReverseProxyCacheLocator.php | 6 +-- src/Console/AppMigrateCommand.php | 8 ++++ src/Controller/HealthCheckController.php | 10 ++--- src/Controller/RedirectionController.php | 6 +-- src/CustomForm/CustomFormAnswerSerializer.php | 4 +- src/CustomForm/CustomFormHelperFactory.php | 10 ++--- .../Message/CustomFormAnswerNotifyMessage.php | 10 ++--- .../DocumentMessageDispatchSubscriber.php | 4 +- .../MediaFinder/DailymotionEmbedFinder.php | 3 -- .../MediaFinder/SoundcloudEmbedFinder.php | 3 -- src/Document/MediaFinder/VimeoEmbedFinder.php | 3 -- .../MediaFinder/YoutubeEmbedFinder.php | 3 -- src/EntityHandler/HandlerFactory.php | 4 +- src/Event/FilterFolderEvent.php | 5 +-- src/Event/FilterNodeEvent.php | 5 +-- src/Event/FilterNodePathEvent.php | 12 +++--- src/Event/FilterNodesSourcesEvent.php | 5 +-- src/Event/FilterSettingEvent.php | 5 +-- src/Event/FilterTagEvent.php | 5 +-- src/Event/FilterTranslationEvent.php | 5 +-- src/Event/FilterUrlAliasEvent.php | 5 +-- src/Event/FilterUserEvent.php | 5 +-- .../AssetsCacheEventSubscriber.php | 6 +-- .../AutomaticWebhookSubscriber.php | 8 ++-- .../CachedNodeOffspringEventSubscriber.php | 4 +- .../DocumentTimestampSubscriber.php | 2 +- src/EventSubscriber/LocaleSubscriber.php | 8 ++-- src/EventSubscriber/LoggableSubscriber.php | 6 +-- .../NodeDuplicationSubscriber.php | 6 +-- src/EventSubscriber/NodeNameSubscriber.php | 8 ++-- .../NodeRedirectionSubscriber.php | 8 ++-- .../NodeSourcePathSubscriber.php | 4 +- .../NodesSourcesAddHeadersSubscriber.php | 6 +-- .../NodesSourcesLinkHeaderEventSubscriber.php | 6 +-- .../NodesSourcesUniversalSubscriber.php | 9 +--- .../NodesSourcesUrlsCacheEventSubscriber.php | 4 +- .../RealmNodeInheritanceSubscriber.php | 4 +- .../RedirectionCacheSubscriber.php | 7 +--- src/EventSubscriber/RoleSubscriber.php | 9 +--- src/EventSubscriber/SignatureSubscriber.php | 8 ++-- .../TagTimestampSubscriber.php | 2 +- src/EventSubscriber/TranslationSubscriber.php | 4 +- src/EventSubscriber/UserLocaleSubscriber.php | 6 +-- src/Filesystem/RoadizFileDirectories.php | 4 +- src/Importer/ChainImporter.php | 7 +--- src/Importer/GroupsImporter.php | 7 +--- src/Importer/NodeTypesImporter.php | 4 +- src/Importer/RolesImporter.php | 7 +--- src/Importer/SettingsImporter.php | 9 +--- src/Importer/TagsImporter.php | 7 +--- src/Mailer/ContactFormManagerFactory.php | 22 +++++----- src/Mailer/EmailManagerFactory.php | 14 +++---- src/Model/NodeTreeDto.php | 1 - src/Model/NodeTypeTreeDto.php | 16 +++---- src/Model/NodesSourcesTreeDto.php | 8 ++-- src/Model/TagTreeDto.php | 14 +++---- src/Node/NodeDuplicator.php | 8 ++-- src/Node/NodeMover.php | 28 ++++--------- src/Node/NodeNameChecker.php | 12 +++--- src/Node/NodeNamePolicyFactory.php | 6 +-- src/Node/UniqueNodeGenerator.php | 8 ++-- src/NodeType/ApiResourceGenerator.php | 10 ++--- src/NodeType/DefaultValuesResolver.php | 6 +-- src/NodeType/NodeTypeResolver.php | 4 +- .../EventSubscriber/PreviewBarSubscriber.php | 4 +- src/Preview/RequestPreviewRevolver.php | 6 +-- src/Preview/User/PreviewUser.php | 13 +++--- src/Preview/User/PreviewUserProvider.php | 6 +-- src/Realm/RealmResolver.php | 8 ++-- src/Routing/NodesSourcesUrlGenerator.php | 10 ++--- ...timizedNodesSourcesGraphPathAggregator.php | 6 +-- src/Routing/RouteHandler.php | 5 +-- src/SearchEngine/AbstractSearchHandler.php | 14 ++----- src/SearchEngine/AbstractSolarium.php | 10 ++--- src/SearchEngine/ClientRegistry.php | 4 +- .../GlobalNodeSourceSearchHandler.php | 7 +--- src/SearchEngine/NodeSourceSearchHandler.php | 12 +++--- src/SearchEngine/SolariumDocument.php | 6 +-- .../SolariumDocumentTranslation.php | 10 +---- src/SearchEngine/SolariumFactory.php | 18 +++----- src/SearchEngine/SolariumNodeSource.php | 9 +--- ...BackofficeAuthenticationSuccessHandler.php | 6 +-- .../Authorization/AccessDeniedHandler.php | 10 ++--- .../Chroot/NodeChrootChainResolver.php | 4 +- src/Security/User/UserProvider.php | 4 +- src/Security/User/UserViewer.php | 14 +++---- src/Serializer/CircularReferenceHandler.php | 4 +- .../TranslationAwareContextBuilder.php | 8 ++-- src/Tag/TagFactory.php | 9 ++-- src/Traits/LoginResetTrait.php | 5 +-- .../GenericJsonPostMessageInterface.php | 2 - src/Webhook/Message/WebhookMessage.php | 5 +-- src/Webhook/ThrottledWebhookDispatcher.php | 8 ++-- .../Event/NodeStatusGuardListener.php | 4 +- 110 files changed, 359 insertions(+), 510 deletions(-) diff --git a/composer.json b/composer.json index 40383896..9df8748e 100644 --- a/composer.json +++ b/composer.json @@ -43,15 +43,15 @@ "rezozero/intervention-request-bundle": "~3.0.1", "rezozero/liform-bundle": "^0.20.1", "rezozero/tree-walker": "^1.5.0", - "roadiz/doc-generator": "2.4.x-dev", - "roadiz/documents": "2.4.x-dev", - "roadiz/dts-generator": "2.4.x-dev", - "roadiz/entity-generator": "2.4.x-dev", - "roadiz/jwt": "2.4.x-dev", - "roadiz/markdown": "2.4.x-dev", - "roadiz/models": "2.4.x-dev", + "roadiz/doc-generator": "2.4.*", + "roadiz/documents": "2.4.*", + "roadiz/dts-generator": "2.4.*", + "roadiz/entity-generator": "2.4.*", + "roadiz/jwt": "2.4.*", + "roadiz/markdown": "2.4.*", + "roadiz/models": "2.4.*", "roadiz/nodetype-contracts": "~1.1.2", - "roadiz/random": "2.4.x-dev", + "roadiz/random": "2.4.*", "rollerworks/password-common-list": "^0.3.0", "rollerworks/password-strength-bundle": "^3.0", "scienta/doctrine-json-functions": "^4.2", @@ -136,8 +136,8 @@ }, "extra": { "branch-alias": { - "dev-main": "2.3.x-dev", - "dev-develop": "2.4.x-dev" + "dev-main": "2.4.x-dev", + "dev-develop": "2.5.x-dev" } } } diff --git a/config/services.yaml b/config/services.yaml index dbdd31d2..a9831817 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,7 +1,7 @@ --- parameters: roadiz_core.cms_version: '2.4.0' - roadiz_core.cms_version_prefix: 'develop' + roadiz_core.cms_version_prefix: 'main' env(APP_NAMESPACE): "roadiz" env(APP_VERSION): "0.1.0" env(APP_USE_ACCEPT_LANGUAGE_HEADER): 'false' diff --git a/src/Api/Breadcrumbs/Breadcrumbs.php b/src/Api/Breadcrumbs/Breadcrumbs.php index 1c23e4e0..c5bf0df2 100644 --- a/src/Api/Breadcrumbs/Breadcrumbs.php +++ b/src/Api/Breadcrumbs/Breadcrumbs.php @@ -7,7 +7,7 @@ use RZ\Roadiz\Core\AbstractEntities\PersistableInterface; use Symfony\Component\Serializer\Annotation as Serializer; -final class Breadcrumbs implements BreadcrumbsInterface +final readonly class Breadcrumbs implements BreadcrumbsInterface { /** * @param PersistableInterface[] $items @@ -15,7 +15,7 @@ final class Breadcrumbs implements BreadcrumbsInterface public function __construct( #[Serializer\Groups(['breadcrumbs', 'web_response'])] #[Serializer\MaxDepth(1)] - private readonly array $items, + private array $items, ) { } diff --git a/src/Api/Controller/NodesSourcesSearchController.php b/src/Api/Controller/NodesSourcesSearchController.php index e9d4ebab..0fbfd1ed 100644 --- a/src/Api/Controller/NodesSourcesSearchController.php +++ b/src/Api/Controller/NodesSourcesSearchController.php @@ -19,21 +19,12 @@ class NodesSourcesSearchController extends AbstractController { use TranslationAwareControllerTrait; - private ManagerRegistry $managerRegistry; - private PreviewResolverInterface $previewResolver; - private ?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler; - private int $highlightingFragmentSize; - public function __construct( - ManagerRegistry $managerRegistry, - PreviewResolverInterface $previewResolver, - ?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler, - int $highlightingFragmentSize = 200, + private readonly ManagerRegistry $managerRegistry, + private readonly PreviewResolverInterface $previewResolver, + private readonly ?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler, + private readonly int $highlightingFragmentSize = 200, ) { - $this->nodeSourceSearchHandler = $nodeSourceSearchHandler; - $this->highlightingFragmentSize = $highlightingFragmentSize; - $this->managerRegistry = $managerRegistry; - $this->previewResolver = $previewResolver; } protected function getManagerRegistry(): ManagerRegistry diff --git a/src/Api/Extension/ArchiveExtension.php b/src/Api/Extension/ArchiveExtension.php index 7cf3dccd..222fa0ca 100644 --- a/src/Api/Extension/ArchiveExtension.php +++ b/src/Api/Extension/ArchiveExtension.php @@ -41,11 +41,11 @@ * ], * ``` */ -final class ArchiveExtension implements QueryResultCollectionExtensionInterface +final readonly class ArchiveExtension implements QueryResultCollectionExtensionInterface { public function __construct( - private readonly RequestStack $requestStack, - private readonly string $defaultPublicationFieldName = 'publishedAt', + private RequestStack $requestStack, + private string $defaultPublicationFieldName = 'publishedAt', ) { } diff --git a/src/Api/Extension/AttributeValueRealmExtension.php b/src/Api/Extension/AttributeValueRealmExtension.php index 4838fcfc..0128fd87 100644 --- a/src/Api/Extension/AttributeValueRealmExtension.php +++ b/src/Api/Extension/AttributeValueRealmExtension.php @@ -14,11 +14,11 @@ use RZ\Roadiz\CoreBundle\Realm\RealmResolverInterface; use Symfony\Bundle\SecurityBundle\Security; -final class AttributeValueRealmExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface +final readonly class AttributeValueRealmExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface { public function __construct( - private readonly Security $security, - private readonly RealmResolverInterface $realmResolver, + private Security $security, + private RealmResolverInterface $realmResolver, ) { } diff --git a/src/Api/Extension/NodesTagsQueryExtension.php b/src/Api/Extension/NodesTagsQueryExtension.php index cc423464..c61c1f1b 100644 --- a/src/Api/Extension/NodesTagsQueryExtension.php +++ b/src/Api/Extension/NodesTagsQueryExtension.php @@ -14,10 +14,10 @@ use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; -final class NodesTagsQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface +final readonly class NodesTagsQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, + private PreviewResolverInterface $previewResolver, ) { } diff --git a/src/Api/Model/NodesSourcesHead.php b/src/Api/Model/NodesSourcesHead.php index 56fcfda1..f509483c 100644 --- a/src/Api/Model/NodesSourcesHead.php +++ b/src/Api/Model/NodesSourcesHead.php @@ -17,41 +17,23 @@ class NodesSourcesHead implements NodesSourcesHeadInterface { - #[Serializer\Ignore] - protected HandlerFactoryInterface $handlerFactory; - #[Serializer\Ignore] protected ?array $seo = null; - #[Serializer\Ignore] - protected ?NodesSources $nodesSource; - - #[Serializer\Ignore] - protected Settings $settingsBag; - - #[Serializer\Ignore] - protected UrlGeneratorInterface $urlGenerator; - - #[Serializer\Ignore] - protected NodeSourceApi $nodeSourceApi; - - #[Serializer\Ignore] - protected TranslationInterface $defaultTranslation; - public function __construct( - ?NodesSources $nodesSource, - Settings $settingsBag, - UrlGeneratorInterface $urlGenerator, - NodeSourceApi $nodeSourceApi, - HandlerFactoryInterface $handlerFactory, - TranslationInterface $defaultTranslation, + #[Serializer\Ignore] + protected readonly ?NodesSources $nodesSource, + #[Serializer\Ignore] + protected readonly Settings $settingsBag, + #[Serializer\Ignore] + protected readonly UrlGeneratorInterface $urlGenerator, + #[Serializer\Ignore] + protected readonly NodeSourceApi $nodeSourceApi, + #[Serializer\Ignore] + protected readonly HandlerFactoryInterface $handlerFactory, + #[Serializer\Ignore] + protected readonly TranslationInterface $defaultTranslation, ) { - $this->nodesSource = $nodesSource; - $this->settingsBag = $settingsBag; - $this->urlGenerator = $urlGenerator; - $this->nodeSourceApi = $nodeSourceApi; - $this->defaultTranslation = $defaultTranslation; - $this->handlerFactory = $handlerFactory; } #[Serializer\Groups(['web_response', 'nodes_sources_single', 'walker'])] diff --git a/src/Api/Model/NodesSourcesHeadFactory.php b/src/Api/Model/NodesSourcesHeadFactory.php index f2d6e210..e0639693 100644 --- a/src/Api/Model/NodesSourcesHeadFactory.php +++ b/src/Api/Model/NodesSourcesHeadFactory.php @@ -11,13 +11,13 @@ use RZ\Roadiz\CoreBundle\EntityApi\NodeSourceApi; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -final class NodesSourcesHeadFactory implements NodesSourcesHeadFactoryInterface +final readonly class NodesSourcesHeadFactory implements NodesSourcesHeadFactoryInterface { public function __construct( - private readonly Settings $settingsBag, - private readonly UrlGeneratorInterface $urlGenerator, - private readonly NodeSourceApi $nodeSourceApi, - private readonly HandlerFactoryInterface $handlerFactory, + private Settings $settingsBag, + private UrlGeneratorInterface $urlGenerator, + private NodeSourceApi $nodeSourceApi, + private HandlerFactoryInterface $handlerFactory, ) { } diff --git a/src/Api/OpenApi/JwtDecorator.php b/src/Api/OpenApi/JwtDecorator.php index 65cb1f12..5b9b0e45 100644 --- a/src/Api/OpenApi/JwtDecorator.php +++ b/src/Api/OpenApi/JwtDecorator.php @@ -8,10 +8,10 @@ use ApiPlatform\OpenApi\Model; use ApiPlatform\OpenApi\OpenApi; -final class JwtDecorator implements OpenApiFactoryInterface +final readonly class JwtDecorator implements OpenApiFactoryInterface { public function __construct( - private readonly OpenApiFactoryInterface $decorated, + private OpenApiFactoryInterface $decorated, ) { } diff --git a/src/Api/OpenApi/PreviewDecorator.php b/src/Api/OpenApi/PreviewDecorator.php index e575d75a..98103641 100644 --- a/src/Api/OpenApi/PreviewDecorator.php +++ b/src/Api/OpenApi/PreviewDecorator.php @@ -9,10 +9,10 @@ use ApiPlatform\OpenApi\Model\PathItem; use ApiPlatform\OpenApi\OpenApi; -final class PreviewDecorator implements OpenApiFactoryInterface +final readonly class PreviewDecorator implements OpenApiFactoryInterface { public function __construct( - private readonly OpenApiFactoryInterface $decorated, + private OpenApiFactoryInterface $decorated, ) { } diff --git a/src/Api/OpenApi/WebResponseDecorator.php b/src/Api/OpenApi/WebResponseDecorator.php index 0c09dc08..46b9ec9d 100644 --- a/src/Api/OpenApi/WebResponseDecorator.php +++ b/src/Api/OpenApi/WebResponseDecorator.php @@ -8,10 +8,10 @@ use ApiPlatform\OpenApi\Model; use ApiPlatform\OpenApi\OpenApi; -final class WebResponseDecorator implements OpenApiFactoryInterface +final readonly class WebResponseDecorator implements OpenApiFactoryInterface { public function __construct( - private readonly OpenApiFactoryInterface $decorated, + private OpenApiFactoryInterface $decorated, ) { } diff --git a/src/Api/TreeWalker/NodeSourceWalkerContext.php b/src/Api/TreeWalker/NodeSourceWalkerContext.php index ba0d5f85..d5bd25ac 100644 --- a/src/Api/TreeWalker/NodeSourceWalkerContext.php +++ b/src/Api/TreeWalker/NodeSourceWalkerContext.php @@ -18,17 +18,17 @@ use Symfony\Component\Stopwatch\Stopwatch; #[Exclude] -class NodeSourceWalkerContext implements WalkerContextInterface +readonly class NodeSourceWalkerContext implements WalkerContextInterface { public function __construct( - private readonly Stopwatch $stopwatch, - private readonly NodeTypes $nodeTypesBag, - private readonly NodeSourceApi $nodeSourceApi, - private readonly RequestStack $requestStack, - private readonly ManagerRegistry $managerRegistry, - private readonly CacheItemPoolInterface $cacheAdapter, - private readonly NodeTypeResolver $nodeTypeResolver, - private readonly PreviewResolverInterface $previewResolver, + private Stopwatch $stopwatch, + private NodeTypes $nodeTypesBag, + private NodeSourceApi $nodeSourceApi, + private RequestStack $requestStack, + private ManagerRegistry $managerRegistry, + private CacheItemPoolInterface $cacheAdapter, + private NodeTypeResolver $nodeTypeResolver, + private PreviewResolverInterface $previewResolver, ) { } diff --git a/src/Api/TreeWalker/NodeSourceWalkerContextFactory.php b/src/Api/TreeWalker/NodeSourceWalkerContextFactory.php index 3b79a0e7..35253742 100644 --- a/src/Api/TreeWalker/NodeSourceWalkerContextFactory.php +++ b/src/Api/TreeWalker/NodeSourceWalkerContextFactory.php @@ -14,17 +14,17 @@ use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Stopwatch\Stopwatch; -final class NodeSourceWalkerContextFactory implements WalkerContextFactoryInterface +final readonly class NodeSourceWalkerContextFactory implements WalkerContextFactoryInterface { public function __construct( - private readonly Stopwatch $stopwatch, - private readonly NodeTypes $nodeTypesBag, - private readonly NodeSourceApi $nodeSourceApi, - private readonly RequestStack $requestStack, - private readonly ManagerRegistry $managerRegistry, - private readonly CacheItemPoolInterface $cacheAdapter, - private readonly NodeTypeResolver $nodeTypeResolver, - private readonly PreviewResolverInterface $previewResolver, + private Stopwatch $stopwatch, + private NodeTypes $nodeTypesBag, + private NodeSourceApi $nodeSourceApi, + private RequestStack $requestStack, + private ManagerRegistry $managerRegistry, + private CacheItemPoolInterface $cacheAdapter, + private NodeTypeResolver $nodeTypeResolver, + private PreviewResolverInterface $previewResolver, ) { } diff --git a/src/Cache/CloudflareProxyCache.php b/src/Cache/CloudflareProxyCache.php index 33cec455..ef602313 100644 --- a/src/Cache/CloudflareProxyCache.php +++ b/src/Cache/CloudflareProxyCache.php @@ -4,16 +4,16 @@ namespace RZ\Roadiz\CoreBundle\Cache; -final class CloudflareProxyCache +final readonly class CloudflareProxyCache { public function __construct( - private readonly string $name, - private readonly string $zone, - private readonly string $version, - private readonly string $bearer, - private readonly string $email, - private readonly string $key, - private readonly int $timeout, + private string $name, + private string $zone, + private string $version, + private string $bearer, + private string $email, + private string $key, + private int $timeout, ) { } diff --git a/src/Cache/ReverseProxyCache.php b/src/Cache/ReverseProxyCache.php index 07c0b882..c7683f6d 100644 --- a/src/Cache/ReverseProxyCache.php +++ b/src/Cache/ReverseProxyCache.php @@ -4,13 +4,13 @@ namespace RZ\Roadiz\CoreBundle\Cache; -final class ReverseProxyCache +final readonly class ReverseProxyCache { public function __construct( - private readonly string $name, - private readonly string $host, - private readonly string $domainName, - private readonly int $timeout, + private string $name, + private string $host, + private string $domainName, + private int $timeout, ) { } diff --git a/src/Cache/ReverseProxyCacheLocator.php b/src/Cache/ReverseProxyCacheLocator.php index 62f6fcb4..1fd879d3 100644 --- a/src/Cache/ReverseProxyCacheLocator.php +++ b/src/Cache/ReverseProxyCacheLocator.php @@ -4,14 +4,14 @@ namespace RZ\Roadiz\CoreBundle\Cache; -final class ReverseProxyCacheLocator +final readonly class ReverseProxyCacheLocator { /** * @param ReverseProxyCache[] $frontends */ public function __construct( - private readonly array $frontends, - private readonly ?CloudflareProxyCache $cloudflareProxyCache = null, + private array $frontends, + private ?CloudflareProxyCache $cloudflareProxyCache = null, ) { } diff --git a/src/Console/AppMigrateCommand.php b/src/Console/AppMigrateCommand.php index 08b25b29..6340f3ef 100644 --- a/src/Console/AppMigrateCommand.php +++ b/src/Console/AppMigrateCommand.php @@ -82,6 +82,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->isQuiet() ) ? $io->success('generate:nsentities') : $io->error('generate:nsentities'); + 0 === $this->runCommand( + 'generate:api-resources', + '', + null, + $input->isInteractive(), + $output->isQuiet() + ) ? $io->success('generate:api-resources') : $io->error('generate:api-resources'); + $this->schemaUpdater->updateNodeTypesSchema(); $this->schemaUpdater->updateSchema(); $io->success('doctrine-migrations'); diff --git a/src/Controller/HealthCheckController.php b/src/Controller/HealthCheckController.php index 422a1fe3..1129a866 100644 --- a/src/Controller/HealthCheckController.php +++ b/src/Controller/HealthCheckController.php @@ -9,13 +9,13 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -final class HealthCheckController +final readonly class HealthCheckController { public function __construct( - private readonly ?string $healthCheckToken, - private readonly ?string $appVersion, - private readonly ?string $cmsVersion, - private readonly ?string $cmsVersionPrefix, + private ?string $healthCheckToken, + private ?string $appVersion, + private ?string $cmsVersion, + private ?string $cmsVersionPrefix, ) { } diff --git a/src/Controller/RedirectionController.php b/src/Controller/RedirectionController.php index caf3ed14..7d2d2cc3 100644 --- a/src/Controller/RedirectionController.php +++ b/src/Controller/RedirectionController.php @@ -12,9 +12,9 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -final class RedirectionController +final readonly class RedirectionController { - public function __construct(private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private UrlGeneratorInterface $urlGenerator) { } @@ -62,7 +62,7 @@ public function redirectToRouteAction( Request $request, string $route, bool $permanent = false, - $ignoreAttributes = false, + bool|array $ignoreAttributes = false, ): RedirectResponse { if ('' == $route) { throw new HttpException($permanent ? 410 : 404); diff --git a/src/CustomForm/CustomFormAnswerSerializer.php b/src/CustomForm/CustomFormAnswerSerializer.php index 5753bc58..6456ab6d 100644 --- a/src/CustomForm/CustomFormAnswerSerializer.php +++ b/src/CustomForm/CustomFormAnswerSerializer.php @@ -9,9 +9,9 @@ use RZ\Roadiz\CoreBundle\Entity\Document; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -final class CustomFormAnswerSerializer +final readonly class CustomFormAnswerSerializer { - public function __construct(private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private UrlGeneratorInterface $urlGenerator) { } diff --git a/src/CustomForm/CustomFormHelperFactory.php b/src/CustomForm/CustomFormHelperFactory.php index 6d031703..6a947f7f 100644 --- a/src/CustomForm/CustomFormHelperFactory.php +++ b/src/CustomForm/CustomFormHelperFactory.php @@ -10,13 +10,13 @@ use Symfony\Component\Form\FormFactoryInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -final class CustomFormHelperFactory +final readonly class CustomFormHelperFactory { public function __construct( - private readonly PrivateDocumentFactory $privateDocumentFactory, - private readonly ObjectManager $em, - private readonly FormFactoryInterface $formFactory, - private readonly EventDispatcherInterface $eventDispatcher, + private PrivateDocumentFactory $privateDocumentFactory, + private ObjectManager $em, + private FormFactoryInterface $formFactory, + private EventDispatcherInterface $eventDispatcher, ) { } diff --git a/src/CustomForm/Message/CustomFormAnswerNotifyMessage.php b/src/CustomForm/Message/CustomFormAnswerNotifyMessage.php index fd65e172..9caec19f 100644 --- a/src/CustomForm/Message/CustomFormAnswerNotifyMessage.php +++ b/src/CustomForm/Message/CustomFormAnswerNotifyMessage.php @@ -6,13 +6,13 @@ use RZ\Roadiz\CoreBundle\Message\AsyncMessage; -final class CustomFormAnswerNotifyMessage implements AsyncMessage +final readonly class CustomFormAnswerNotifyMessage implements AsyncMessage { public function __construct( - private readonly int $customFormAnswerId, - private readonly string $title, - private readonly string $senderAddress, - private readonly string $locale, + private int $customFormAnswerId, + private string $title, + private string $senderAddress, + private string $locale, ) { } diff --git a/src/Document/EventSubscriber/DocumentMessageDispatchSubscriber.php b/src/Document/EventSubscriber/DocumentMessageDispatchSubscriber.php index bfb8bd6b..217e0eb4 100644 --- a/src/Document/EventSubscriber/DocumentMessageDispatchSubscriber.php +++ b/src/Document/EventSubscriber/DocumentMessageDispatchSubscriber.php @@ -20,9 +20,9 @@ use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\MessageBusInterface; -final class DocumentMessageDispatchSubscriber implements EventSubscriberInterface +final readonly class DocumentMessageDispatchSubscriber implements EventSubscriberInterface { - public function __construct(private readonly MessageBusInterface $bus) + public function __construct(private MessageBusInterface $bus) { } diff --git a/src/Document/MediaFinder/DailymotionEmbedFinder.php b/src/Document/MediaFinder/DailymotionEmbedFinder.php index 71385a08..c322ded7 100644 --- a/src/Document/MediaFinder/DailymotionEmbedFinder.php +++ b/src/Document/MediaFinder/DailymotionEmbedFinder.php @@ -6,9 +6,6 @@ use RZ\Roadiz\Documents\MediaFinders\AbstractDailymotionEmbedFinder; -/** - * Dailymotion tools class. - */ class DailymotionEmbedFinder extends AbstractDailymotionEmbedFinder { use EmbedFinderTrait; diff --git a/src/Document/MediaFinder/SoundcloudEmbedFinder.php b/src/Document/MediaFinder/SoundcloudEmbedFinder.php index 30daf162..ef7b3330 100644 --- a/src/Document/MediaFinder/SoundcloudEmbedFinder.php +++ b/src/Document/MediaFinder/SoundcloudEmbedFinder.php @@ -6,9 +6,6 @@ use RZ\Roadiz\Documents\MediaFinders\AbstractSoundcloudEmbedFinder; -/** - * Soundcloud tools class. - */ class SoundcloudEmbedFinder extends AbstractSoundcloudEmbedFinder { use EmbedFinderTrait; diff --git a/src/Document/MediaFinder/VimeoEmbedFinder.php b/src/Document/MediaFinder/VimeoEmbedFinder.php index 39aed012..6f63f14c 100644 --- a/src/Document/MediaFinder/VimeoEmbedFinder.php +++ b/src/Document/MediaFinder/VimeoEmbedFinder.php @@ -6,9 +6,6 @@ use RZ\Roadiz\Documents\MediaFinders\AbstractVimeoEmbedFinder; -/** - * Vimeo tools class. - */ class VimeoEmbedFinder extends AbstractVimeoEmbedFinder { use EmbedFinderTrait; diff --git a/src/Document/MediaFinder/YoutubeEmbedFinder.php b/src/Document/MediaFinder/YoutubeEmbedFinder.php index 70b48278..702d3cd7 100644 --- a/src/Document/MediaFinder/YoutubeEmbedFinder.php +++ b/src/Document/MediaFinder/YoutubeEmbedFinder.php @@ -6,9 +6,6 @@ use RZ\Roadiz\Documents\MediaFinders\AbstractYoutubeEmbedFinder; -/** - * Youtube tools class. - */ class YoutubeEmbedFinder extends AbstractYoutubeEmbedFinder { use EmbedFinderTrait; diff --git a/src/EntityHandler/HandlerFactory.php b/src/EntityHandler/HandlerFactory.php index ef81c55f..df97de0d 100644 --- a/src/EntityHandler/HandlerFactory.php +++ b/src/EntityHandler/HandlerFactory.php @@ -20,9 +20,9 @@ use RZ\Roadiz\CoreBundle\Entity\Tag; use RZ\Roadiz\CoreBundle\Entity\Translation; -final class HandlerFactory implements HandlerFactoryInterface +final readonly class HandlerFactory implements HandlerFactoryInterface { - public function __construct(private readonly ContainerInterface $container) + public function __construct(private ContainerInterface $container) { } diff --git a/src/Event/FilterFolderEvent.php b/src/Event/FilterFolderEvent.php index 8efa7857..db042169 100644 --- a/src/Event/FilterFolderEvent.php +++ b/src/Event/FilterFolderEvent.php @@ -9,11 +9,8 @@ abstract class FilterFolderEvent extends Event { - protected Folder $folder; - - public function __construct(Folder $folder) + public function __construct(protected readonly Folder $folder) { - $this->folder = $folder; } public function getFolder(): Folder diff --git a/src/Event/FilterNodeEvent.php b/src/Event/FilterNodeEvent.php index 4ecf9c76..c13ceaca 100644 --- a/src/Event/FilterNodeEvent.php +++ b/src/Event/FilterNodeEvent.php @@ -9,11 +9,8 @@ abstract class FilterNodeEvent extends Event { - protected Node $node; - - public function __construct(Node $node) + public function __construct(protected readonly Node $node) { - $this->node = $node; } public function getNode(): Node diff --git a/src/Event/FilterNodePathEvent.php b/src/Event/FilterNodePathEvent.php index 810fe6bb..4e2b3e39 100644 --- a/src/Event/FilterNodePathEvent.php +++ b/src/Event/FilterNodePathEvent.php @@ -8,14 +8,12 @@ abstract class FilterNodePathEvent extends FilterNodeEvent { - protected array $paths; - protected ?\DateTime $updatedAt; - - public function __construct(Node $node, array $paths = [], ?\DateTime $updatedAt = null) - { + public function __construct( + Node $node, + protected readonly array $paths = [], + protected readonly ?\DateTime $updatedAt = null, + ) { parent::__construct($node); - $this->paths = $paths; - $this->updatedAt = $updatedAt; } public function getPaths(): array diff --git a/src/Event/FilterNodesSourcesEvent.php b/src/Event/FilterNodesSourcesEvent.php index b5c38a0f..b816134e 100644 --- a/src/Event/FilterNodesSourcesEvent.php +++ b/src/Event/FilterNodesSourcesEvent.php @@ -9,11 +9,8 @@ abstract class FilterNodesSourcesEvent extends Event { - protected NodesSources $nodeSource; - - public function __construct(NodesSources $nodeSource) + public function __construct(protected readonly NodesSources $nodeSource) { - $this->nodeSource = $nodeSource; } public function getNodeSource(): NodesSources diff --git a/src/Event/FilterSettingEvent.php b/src/Event/FilterSettingEvent.php index edbd0d1c..d0b2be0a 100644 --- a/src/Event/FilterSettingEvent.php +++ b/src/Event/FilterSettingEvent.php @@ -9,11 +9,8 @@ abstract class FilterSettingEvent extends Event { - protected Setting $setting; - - public function __construct(Setting $setting) + public function __construct(protected readonly Setting $setting) { - $this->setting = $setting; } public function getSetting(): Setting diff --git a/src/Event/FilterTagEvent.php b/src/Event/FilterTagEvent.php index e2b40aa2..7a3ab303 100644 --- a/src/Event/FilterTagEvent.php +++ b/src/Event/FilterTagEvent.php @@ -9,11 +9,8 @@ abstract class FilterTagEvent extends Event { - protected Tag $tag; - - public function __construct(Tag $tag) + public function __construct(protected readonly Tag $tag) { - $this->tag = $tag; } public function getTag(): Tag diff --git a/src/Event/FilterTranslationEvent.php b/src/Event/FilterTranslationEvent.php index d4abc71f..a8c1a391 100644 --- a/src/Event/FilterTranslationEvent.php +++ b/src/Event/FilterTranslationEvent.php @@ -9,11 +9,8 @@ abstract class FilterTranslationEvent extends Event { - protected Translation $translation; - - public function __construct(Translation $translation) + public function __construct(protected readonly Translation $translation) { - $this->translation = $translation; } public function getTranslation(): Translation diff --git a/src/Event/FilterUrlAliasEvent.php b/src/Event/FilterUrlAliasEvent.php index d86ec15a..7d01d476 100644 --- a/src/Event/FilterUrlAliasEvent.php +++ b/src/Event/FilterUrlAliasEvent.php @@ -9,11 +9,8 @@ abstract class FilterUrlAliasEvent extends Event { - protected UrlAlias $urlAlias; - - public function __construct(UrlAlias $urlAlias) + public function __construct(protected readonly UrlAlias $urlAlias) { - $this->urlAlias = $urlAlias; } public function getUrlAlias(): UrlAlias diff --git a/src/Event/FilterUserEvent.php b/src/Event/FilterUserEvent.php index 9bd5d756..d1e3adea 100644 --- a/src/Event/FilterUserEvent.php +++ b/src/Event/FilterUserEvent.php @@ -9,11 +9,8 @@ abstract class FilterUserEvent extends Event { - private User $user; - - public function __construct(User $user) + public function __construct(protected readonly User $user) { - $this->user = $user; } public function getUser(): User diff --git a/src/EventSubscriber/AssetsCacheEventSubscriber.php b/src/EventSubscriber/AssetsCacheEventSubscriber.php index 892f60a1..6faec771 100644 --- a/src/EventSubscriber/AssetsCacheEventSubscriber.php +++ b/src/EventSubscriber/AssetsCacheEventSubscriber.php @@ -9,11 +9,11 @@ use RZ\Roadiz\Documents\Events\CachePurgeAssetsRequestEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -final class AssetsCacheEventSubscriber implements EventSubscriberInterface +final readonly class AssetsCacheEventSubscriber implements EventSubscriberInterface { public function __construct( - private readonly AssetsFileClearer $assetsClearer, - private readonly LoggerInterface $logger, + private AssetsFileClearer $assetsClearer, + private LoggerInterface $logger, ) { } diff --git a/src/EventSubscriber/AutomaticWebhookSubscriber.php b/src/EventSubscriber/AutomaticWebhookSubscriber.php index 98836861..970ad388 100644 --- a/src/EventSubscriber/AutomaticWebhookSubscriber.php +++ b/src/EventSubscriber/AutomaticWebhookSubscriber.php @@ -23,12 +23,12 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Workflow\Event\Event; -final class AutomaticWebhookSubscriber implements EventSubscriberInterface +final readonly class AutomaticWebhookSubscriber implements EventSubscriberInterface { public function __construct( - private readonly WebhookDispatcher $webhookDispatcher, - private readonly ManagerRegistry $managerRegistry, - private readonly HandlerFactoryInterface $handlerFactory, + private WebhookDispatcher $webhookDispatcher, + private ManagerRegistry $managerRegistry, + private HandlerFactoryInterface $handlerFactory, ) { } diff --git a/src/EventSubscriber/CachedNodeOffspringEventSubscriber.php b/src/EventSubscriber/CachedNodeOffspringEventSubscriber.php index b06e2058..35fba6ec 100644 --- a/src/EventSubscriber/CachedNodeOffspringEventSubscriber.php +++ b/src/EventSubscriber/CachedNodeOffspringEventSubscriber.php @@ -11,9 +11,9 @@ use RZ\Roadiz\CoreBundle\Node\CachedNodeOffspringResolverInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class CachedNodeOffspringEventSubscriber implements EventSubscriberInterface +final readonly class CachedNodeOffspringEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly CachedNodeOffspringResolverInterface $cachedNodeOffspringResolver) + public function __construct(private CachedNodeOffspringResolverInterface $cachedNodeOffspringResolver) { } diff --git a/src/EventSubscriber/DocumentTimestampSubscriber.php b/src/EventSubscriber/DocumentTimestampSubscriber.php index 7e9b6792..67c90790 100644 --- a/src/EventSubscriber/DocumentTimestampSubscriber.php +++ b/src/EventSubscriber/DocumentTimestampSubscriber.php @@ -8,7 +8,7 @@ use RZ\Roadiz\CoreBundle\Event\Document\DocumentTranslationUpdatedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class DocumentTimestampSubscriber implements EventSubscriberInterface +final readonly class DocumentTimestampSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents(): array { diff --git a/src/EventSubscriber/LocaleSubscriber.php b/src/EventSubscriber/LocaleSubscriber.php index e6804ba7..f5013173 100644 --- a/src/EventSubscriber/LocaleSubscriber.php +++ b/src/EventSubscriber/LocaleSubscriber.php @@ -14,12 +14,12 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Routing\RequestContextAwareInterface; -final class LocaleSubscriber implements EventSubscriberInterface +final readonly class LocaleSubscriber implements EventSubscriberInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, - private readonly ManagerRegistry $managerRegistry, - private readonly RequestContextAwareInterface $router, + private PreviewResolverInterface $previewResolver, + private ManagerRegistry $managerRegistry, + private RequestContextAwareInterface $router, ) { } diff --git a/src/EventSubscriber/LoggableSubscriber.php b/src/EventSubscriber/LoggableSubscriber.php index e035a1ef..11abf4b6 100644 --- a/src/EventSubscriber/LoggableSubscriber.php +++ b/src/EventSubscriber/LoggableSubscriber.php @@ -11,11 +11,11 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; -final class LoggableSubscriber implements EventSubscriberInterface +final readonly class LoggableSubscriber implements EventSubscriberInterface { public function __construct( - private readonly LoggableListener $loggableListener, - private readonly Security $security, + private LoggableListener $loggableListener, + private Security $security, ) { } diff --git a/src/EventSubscriber/NodeDuplicationSubscriber.php b/src/EventSubscriber/NodeDuplicationSubscriber.php index dac5f138..a14e61ae 100644 --- a/src/EventSubscriber/NodeDuplicationSubscriber.php +++ b/src/EventSubscriber/NodeDuplicationSubscriber.php @@ -10,11 +10,11 @@ use RZ\Roadiz\CoreBundle\Event\Node\NodeDuplicatedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -final class NodeDuplicationSubscriber implements EventSubscriberInterface +final readonly class NodeDuplicationSubscriber implements EventSubscriberInterface { public function __construct( - private readonly ManagerRegistry $managerRegistry, - private readonly HandlerFactoryInterface $handlerFactory, + private ManagerRegistry $managerRegistry, + private HandlerFactoryInterface $handlerFactory, ) { } diff --git a/src/EventSubscriber/NodeNameSubscriber.php b/src/EventSubscriber/NodeNameSubscriber.php index f565974f..e01304cf 100644 --- a/src/EventSubscriber/NodeNameSubscriber.php +++ b/src/EventSubscriber/NodeNameSubscriber.php @@ -17,12 +17,12 @@ /** * Updates node name against default node-source title is applicable. */ -final class NodeNameSubscriber implements EventSubscriberInterface +final readonly class NodeNameSubscriber implements EventSubscriberInterface { public function __construct( - private readonly LoggerInterface $logger, - private readonly NodeNamePolicyInterface $nodeNamePolicy, - private readonly NodeMover $nodeMover, + private LoggerInterface $logger, + private NodeNamePolicyInterface $nodeNamePolicy, + private NodeMover $nodeMover, ) { } diff --git a/src/EventSubscriber/NodeRedirectionSubscriber.php b/src/EventSubscriber/NodeRedirectionSubscriber.php index 68740229..01d16706 100644 --- a/src/EventSubscriber/NodeRedirectionSubscriber.php +++ b/src/EventSubscriber/NodeRedirectionSubscriber.php @@ -14,12 +14,12 @@ /** * Subscribe to Node, NodesSources and UrlAlias event to clear ns url cache. */ -readonly class NodeRedirectionSubscriber implements EventSubscriberInterface +final readonly class NodeRedirectionSubscriber implements EventSubscriberInterface { public function __construct( - protected NodeMover $nodeMover, - protected string $kernelEnvironment, - protected PreviewResolverInterface $previewResolver, + private NodeMover $nodeMover, + private string $kernelEnvironment, + private PreviewResolverInterface $previewResolver, ) { } diff --git a/src/EventSubscriber/NodeSourcePathSubscriber.php b/src/EventSubscriber/NodeSourcePathSubscriber.php index 20211574..92033716 100644 --- a/src/EventSubscriber/NodeSourcePathSubscriber.php +++ b/src/EventSubscriber/NodeSourcePathSubscriber.php @@ -9,10 +9,10 @@ use RZ\Roadiz\CoreBundle\Routing\NodesSourcesUrlGenerator; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -final class NodeSourcePathSubscriber implements EventSubscriberInterface +final readonly class NodeSourcePathSubscriber implements EventSubscriberInterface { public function __construct( - private readonly NodesSourcesPathAggregator $pathAggregator, + private NodesSourcesPathAggregator $pathAggregator, ) { } diff --git a/src/EventSubscriber/NodesSourcesAddHeadersSubscriber.php b/src/EventSubscriber/NodesSourcesAddHeadersSubscriber.php index b1fd6797..d93eef3d 100644 --- a/src/EventSubscriber/NodesSourcesAddHeadersSubscriber.php +++ b/src/EventSubscriber/NodesSourcesAddHeadersSubscriber.php @@ -13,11 +13,11 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -final class NodesSourcesAddHeadersSubscriber implements EventSubscriberInterface +final readonly class NodesSourcesAddHeadersSubscriber implements EventSubscriberInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, - private readonly Security $security, + private PreviewResolverInterface $previewResolver, + private Security $security, ) { } diff --git a/src/EventSubscriber/NodesSourcesLinkHeaderEventSubscriber.php b/src/EventSubscriber/NodesSourcesLinkHeaderEventSubscriber.php index a2d37d7e..e4846f61 100644 --- a/src/EventSubscriber/NodesSourcesLinkHeaderEventSubscriber.php +++ b/src/EventSubscriber/NodesSourcesLinkHeaderEventSubscriber.php @@ -15,11 +15,11 @@ use Symfony\Component\WebLink\GenericLinkProvider; use Symfony\Component\WebLink\Link; -final class NodesSourcesLinkHeaderEventSubscriber implements EventSubscriberInterface +final readonly class NodesSourcesLinkHeaderEventSubscriber implements EventSubscriberInterface { public function __construct( - private readonly ManagerRegistry $managerRegistry, - private readonly UrlGeneratorInterface $urlGenerator, + private ManagerRegistry $managerRegistry, + private UrlGeneratorInterface $urlGenerator, ) { } diff --git a/src/EventSubscriber/NodesSourcesUniversalSubscriber.php b/src/EventSubscriber/NodesSourcesUniversalSubscriber.php index 1e0b4318..aa27e90d 100644 --- a/src/EventSubscriber/NodesSourcesUniversalSubscriber.php +++ b/src/EventSubscriber/NodesSourcesUniversalSubscriber.php @@ -11,15 +11,10 @@ use RZ\Roadiz\CoreBundle\Node\UniversalDataDuplicator; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class NodesSourcesUniversalSubscriber implements EventSubscriberInterface +final readonly class NodesSourcesUniversalSubscriber implements EventSubscriberInterface { - private ManagerRegistry $managerRegistry; - private UniversalDataDuplicator $universalDataDuplicator; - - public function __construct(ManagerRegistry $managerRegistry, UniversalDataDuplicator $universalDataDuplicator) + public function __construct(private ManagerRegistry $managerRegistry, private UniversalDataDuplicator $universalDataDuplicator) { - $this->universalDataDuplicator = $universalDataDuplicator; - $this->managerRegistry = $managerRegistry; } public static function getSubscribedEvents(): array diff --git a/src/EventSubscriber/NodesSourcesUrlsCacheEventSubscriber.php b/src/EventSubscriber/NodesSourcesUrlsCacheEventSubscriber.php index b51f7b08..621702aa 100644 --- a/src/EventSubscriber/NodesSourcesUrlsCacheEventSubscriber.php +++ b/src/EventSubscriber/NodesSourcesUrlsCacheEventSubscriber.php @@ -18,9 +18,9 @@ use RZ\Roadiz\CoreBundle\Event\UrlAlias\UrlAliasUpdatedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -final class NodesSourcesUrlsCacheEventSubscriber implements EventSubscriberInterface +final readonly class NodesSourcesUrlsCacheEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly NodesSourcesUrlsCacheClearer $cacheClearer) + public function __construct(private NodesSourcesUrlsCacheClearer $cacheClearer) { } diff --git a/src/EventSubscriber/RealmNodeInheritanceSubscriber.php b/src/EventSubscriber/RealmNodeInheritanceSubscriber.php index de2670ce..127a3a92 100644 --- a/src/EventSubscriber/RealmNodeInheritanceSubscriber.php +++ b/src/EventSubscriber/RealmNodeInheritanceSubscriber.php @@ -17,9 +17,9 @@ use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\MessageBusInterface; -final class RealmNodeInheritanceSubscriber implements EventSubscriberInterface +final readonly class RealmNodeInheritanceSubscriber implements EventSubscriberInterface { - public function __construct(private readonly MessageBusInterface $bus) + public function __construct(private MessageBusInterface $bus) { } diff --git a/src/EventSubscriber/RedirectionCacheSubscriber.php b/src/EventSubscriber/RedirectionCacheSubscriber.php index baf657ad..3495b2fe 100644 --- a/src/EventSubscriber/RedirectionCacheSubscriber.php +++ b/src/EventSubscriber/RedirectionCacheSubscriber.php @@ -12,13 +12,10 @@ use RZ\Roadiz\CoreBundle\Routing\RedirectionPathResolver; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class RedirectionCacheSubscriber implements EventSubscriberInterface +final readonly class RedirectionCacheSubscriber implements EventSubscriberInterface { - private CacheItemPoolInterface $cacheAdapter; - - public function __construct(CacheItemPoolInterface $cacheAdapter) + public function __construct(private CacheItemPoolInterface $cacheAdapter) { - $this->cacheAdapter = $cacheAdapter; } public static function getSubscribedEvents(): array diff --git a/src/EventSubscriber/RoleSubscriber.php b/src/EventSubscriber/RoleSubscriber.php index b1a60e04..0b82a0aa 100644 --- a/src/EventSubscriber/RoleSubscriber.php +++ b/src/EventSubscriber/RoleSubscriber.php @@ -15,15 +15,10 @@ use RZ\Roadiz\CoreBundle\Event\Role\RoleEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class RoleSubscriber implements EventSubscriberInterface +final readonly class RoleSubscriber implements EventSubscriberInterface { - protected ?LazyParameterBag $roles; - private ManagerRegistry $managerRegistry; - - public function __construct(ManagerRegistry $managerRegistry, ?LazyParameterBag $roles) + public function __construct(private ManagerRegistry $managerRegistry, private ?LazyParameterBag $roles) { - $this->roles = $roles; - $this->managerRegistry = $managerRegistry; } public static function getSubscribedEvents(): array diff --git a/src/EventSubscriber/SignatureSubscriber.php b/src/EventSubscriber/SignatureSubscriber.php index e884f083..2860eb28 100644 --- a/src/EventSubscriber/SignatureSubscriber.php +++ b/src/EventSubscriber/SignatureSubscriber.php @@ -8,12 +8,12 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -final class SignatureSubscriber implements EventSubscriberInterface +final readonly class SignatureSubscriber implements EventSubscriberInterface { public function __construct( - private readonly string $cmsVersion, - private readonly bool $hideRoadizVersion, - private readonly bool $debug = false, + private string $cmsVersion, + private bool $hideRoadizVersion, + private bool $debug = false, ) { } diff --git a/src/EventSubscriber/TagTimestampSubscriber.php b/src/EventSubscriber/TagTimestampSubscriber.php index ca7aaa1b..71f0c496 100644 --- a/src/EventSubscriber/TagTimestampSubscriber.php +++ b/src/EventSubscriber/TagTimestampSubscriber.php @@ -7,7 +7,7 @@ use RZ\Roadiz\CoreBundle\Event\Tag\TagUpdatedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class TagTimestampSubscriber implements EventSubscriberInterface +final readonly class TagTimestampSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents(): array { diff --git a/src/EventSubscriber/TranslationSubscriber.php b/src/EventSubscriber/TranslationSubscriber.php index e929f02d..8b10fc2f 100644 --- a/src/EventSubscriber/TranslationSubscriber.php +++ b/src/EventSubscriber/TranslationSubscriber.php @@ -18,9 +18,9 @@ /** * Subscribe to Translation event to clear result cache. */ -final class TranslationSubscriber implements EventSubscriberInterface +final readonly class TranslationSubscriber implements EventSubscriberInterface { - public function __construct(private readonly ManagerRegistry $managerRegistry) + public function __construct(private ManagerRegistry $managerRegistry) { } diff --git a/src/EventSubscriber/UserLocaleSubscriber.php b/src/EventSubscriber/UserLocaleSubscriber.php index 5fdf19ee..33775d51 100644 --- a/src/EventSubscriber/UserLocaleSubscriber.php +++ b/src/EventSubscriber/UserLocaleSubscriber.php @@ -13,11 +13,11 @@ use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\SecurityEvents; -final class UserLocaleSubscriber implements EventSubscriberInterface +final readonly class UserLocaleSubscriber implements EventSubscriberInterface { public function __construct( - private readonly RequestStack $requestStack, - private readonly TokenStorageInterface $tokenStorage, + private RequestStack $requestStack, + private TokenStorageInterface $tokenStorage, ) { } diff --git a/src/Filesystem/RoadizFileDirectories.php b/src/Filesystem/RoadizFileDirectories.php index 1e8ee689..829ae6e6 100644 --- a/src/Filesystem/RoadizFileDirectories.php +++ b/src/Filesystem/RoadizFileDirectories.php @@ -6,9 +6,9 @@ use RZ\Roadiz\Documents\Models\FileAwareInterface; -final class RoadizFileDirectories implements FileAwareInterface +final readonly class RoadizFileDirectories implements FileAwareInterface { - public function __construct(private readonly string $projectDir) + public function __construct(private string $projectDir) { } diff --git a/src/Importer/ChainImporter.php b/src/Importer/ChainImporter.php index 0b5bfa44..fea7689e 100644 --- a/src/Importer/ChainImporter.php +++ b/src/Importer/ChainImporter.php @@ -4,16 +4,13 @@ namespace RZ\Roadiz\CoreBundle\Importer; -class ChainImporter implements EntityImporterInterface +final class ChainImporter implements EntityImporterInterface { - private array $importers = []; - /** * @param array $importers */ - public function __construct(array $importers = []) + public function __construct(private array $importers = []) { - $this->importers = $importers; } public function addImporter(EntityImporterInterface $entityImporter): self diff --git a/src/Importer/GroupsImporter.php b/src/Importer/GroupsImporter.php index 19a3b211..48f12d3d 100644 --- a/src/Importer/GroupsImporter.php +++ b/src/Importer/GroupsImporter.php @@ -9,13 +9,10 @@ use RZ\Roadiz\CoreBundle\Entity\Group; use RZ\Roadiz\CoreBundle\Serializer\ObjectConstructor\TypedObjectConstructorInterface; -class GroupsImporter implements EntityImporterInterface +final readonly class GroupsImporter implements EntityImporterInterface { - protected SerializerInterface $serializer; - - public function __construct(SerializerInterface $serializer) + public function __construct(private SerializerInterface $serializer) { - $this->serializer = $serializer; } public function supports(string $entityClass): bool diff --git a/src/Importer/NodeTypesImporter.php b/src/Importer/NodeTypesImporter.php index aa720244..eaf8f751 100644 --- a/src/Importer/NodeTypesImporter.php +++ b/src/Importer/NodeTypesImporter.php @@ -9,10 +9,10 @@ use RZ\Roadiz\CoreBundle\Entity\NodeType; use RZ\Roadiz\CoreBundle\Serializer\ObjectConstructor\TypedObjectConstructorInterface; -class NodeTypesImporter implements EntityImporterInterface +final readonly class NodeTypesImporter implements EntityImporterInterface { public function __construct( - protected SerializerInterface $serializer, + private SerializerInterface $serializer, ) { } diff --git a/src/Importer/RolesImporter.php b/src/Importer/RolesImporter.php index e46bd970..d9ccec00 100644 --- a/src/Importer/RolesImporter.php +++ b/src/Importer/RolesImporter.php @@ -9,13 +9,10 @@ use RZ\Roadiz\CoreBundle\Entity\Role; use RZ\Roadiz\CoreBundle\Serializer\ObjectConstructor\TypedObjectConstructorInterface; -class RolesImporter implements EntityImporterInterface +final readonly class RolesImporter implements EntityImporterInterface { - protected SerializerInterface $serializer; - - public function __construct(SerializerInterface $serializer) + public function __construct(private SerializerInterface $serializer) { - $this->serializer = $serializer; } public function supports(string $entityClass): bool diff --git a/src/Importer/SettingsImporter.php b/src/Importer/SettingsImporter.php index 211acb3f..dc5050bb 100644 --- a/src/Importer/SettingsImporter.php +++ b/src/Importer/SettingsImporter.php @@ -12,15 +12,10 @@ use RZ\Roadiz\CoreBundle\Entity\Setting; use RZ\Roadiz\CoreBundle\Serializer\ObjectConstructor\TypedObjectConstructorInterface; -class SettingsImporter implements EntityImporterInterface +final readonly class SettingsImporter implements EntityImporterInterface { - private ManagerRegistry $managerRegistry; - private SerializerInterface $serializer; - - public function __construct(ManagerRegistry $managerRegistry, SerializerInterface $serializer) + public function __construct(private ManagerRegistry $managerRegistry, private SerializerInterface $serializer) { - $this->managerRegistry = $managerRegistry; - $this->serializer = $serializer; } public function supports(string $entityClass): bool diff --git a/src/Importer/TagsImporter.php b/src/Importer/TagsImporter.php index 3d163924..1c97c1a3 100644 --- a/src/Importer/TagsImporter.php +++ b/src/Importer/TagsImporter.php @@ -10,13 +10,10 @@ use RZ\Roadiz\CoreBundle\Serializer\ObjectConstructor\TagObjectConstructor; use RZ\Roadiz\CoreBundle\Serializer\ObjectConstructor\TypedObjectConstructorInterface; -class TagsImporter implements EntityImporterInterface +final readonly class TagsImporter implements EntityImporterInterface { - protected SerializerInterface $serializer; - - public function __construct(SerializerInterface $serializer) + public function __construct(private SerializerInterface $serializer) { - $this->serializer = $serializer; } public function supports(string $entityClass): bool diff --git a/src/Mailer/ContactFormManagerFactory.php b/src/Mailer/ContactFormManagerFactory.php index 9f62a3d7..6d277a7d 100644 --- a/src/Mailer/ContactFormManagerFactory.php +++ b/src/Mailer/ContactFormManagerFactory.php @@ -13,19 +13,19 @@ use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; -final class ContactFormManagerFactory +final readonly class ContactFormManagerFactory { public function __construct( - private readonly RequestStack $requestStack, - private readonly TranslatorInterface $translator, - private readonly Environment $templating, - private readonly MailerInterface $mailer, - private readonly Settings $settingsBag, - private readonly DocumentUrlGeneratorInterface $documentUrlGenerator, - private readonly FormFactoryInterface $formFactory, - private readonly FormErrorSerializerInterface $formErrorSerializer, - private readonly ?string $recaptchaPrivateKey, - private readonly ?string $recaptchaPublicKey, + private RequestStack $requestStack, + private TranslatorInterface $translator, + private Environment $templating, + private MailerInterface $mailer, + private Settings $settingsBag, + private DocumentUrlGeneratorInterface $documentUrlGenerator, + private FormFactoryInterface $formFactory, + private FormErrorSerializerInterface $formErrorSerializer, + private ?string $recaptchaPrivateKey, + private ?string $recaptchaPublicKey, ) { } diff --git a/src/Mailer/EmailManagerFactory.php b/src/Mailer/EmailManagerFactory.php index 1a91ecba..da4fd5d8 100644 --- a/src/Mailer/EmailManagerFactory.php +++ b/src/Mailer/EmailManagerFactory.php @@ -11,15 +11,15 @@ use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; -final class EmailManagerFactory +final readonly class EmailManagerFactory { public function __construct( - private readonly RequestStack $requestStack, - private readonly TranslatorInterface $translator, - private readonly Environment $templating, - private readonly MailerInterface $mailer, - private readonly Settings $settingsBag, - private readonly DocumentUrlGeneratorInterface $documentUrlGenerator, + private RequestStack $requestStack, + private TranslatorInterface $translator, + private Environment $templating, + private MailerInterface $mailer, + private Settings $settingsBag, + private DocumentUrlGeneratorInterface $documentUrlGenerator, ) { } diff --git a/src/Model/NodeTreeDto.php b/src/Model/NodeTreeDto.php index b6c5ead3..82a2e38e 100644 --- a/src/Model/NodeTreeDto.php +++ b/src/Model/NodeTreeDto.php @@ -6,7 +6,6 @@ use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface; use RZ\Roadiz\Core\AbstractEntities\NodeInterface; -use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Enum\NodeStatus; /** diff --git a/src/Model/NodeTypeTreeDto.php b/src/Model/NodeTypeTreeDto.php index cbd5e95d..824dbebb 100644 --- a/src/Model/NodeTypeTreeDto.php +++ b/src/Model/NodeTypeTreeDto.php @@ -8,16 +8,16 @@ use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface; use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface; -final class NodeTypeTreeDto implements NodeTypeInterface +final readonly class NodeTypeTreeDto implements NodeTypeInterface { public function __construct( - private readonly string $name, - private readonly bool $publishable, - private readonly bool $reachable, - private readonly string $displayName, - private readonly string $color, - private readonly bool $hidingNodes, - private readonly bool $hidingNonReachableNodes, + private string $name, + private bool $publishable, + private bool $reachable, + private string $displayName, + private string $color, + private bool $hidingNodes, + private bool $hidingNonReachableNodes, ) { } diff --git a/src/Model/NodesSourcesTreeDto.php b/src/Model/NodesSourcesTreeDto.php index 3be14754..0601cc6b 100644 --- a/src/Model/NodesSourcesTreeDto.php +++ b/src/Model/NodesSourcesTreeDto.php @@ -6,12 +6,12 @@ use RZ\Roadiz\Core\AbstractEntities\PersistableInterface; -final class NodesSourcesTreeDto implements PersistableInterface +final readonly class NodesSourcesTreeDto implements PersistableInterface { public function __construct( - private readonly ?int $id, - private readonly ?string $title, - private readonly ?\DateTime $publishedAt, + private ?int $id, + private ?string $title, + private ?\DateTime $publishedAt, ) { } diff --git a/src/Model/TagTreeDto.php b/src/Model/TagTreeDto.php index 3f097d67..0a0f70db 100644 --- a/src/Model/TagTreeDto.php +++ b/src/Model/TagTreeDto.php @@ -9,15 +9,15 @@ /** * Doctrine Data transfer object to represent a Tag in a tree. */ -final class TagTreeDto implements PersistableInterface +final readonly class TagTreeDto implements PersistableInterface { public function __construct( - private readonly int $id, - private readonly string $tagName, - private readonly ?string $name, - private readonly string $color, - private readonly bool $visible, - private readonly ?int $parentId, + private int $id, + private string $tagName, + private ?string $name, + private string $color, + private bool $visible, + private ?int $parentId, ) { } diff --git a/src/Node/NodeDuplicator.php b/src/Node/NodeDuplicator.php index 450f141b..55fd9ddb 100644 --- a/src/Node/NodeDuplicator.php +++ b/src/Node/NodeDuplicator.php @@ -17,12 +17,12 @@ * Handles node duplication. */ #[Exclude] -final class NodeDuplicator +final readonly class NodeDuplicator { public function __construct( - private readonly Node $originalNode, - private readonly ObjectManager $objectManager, - private readonly NodeNamePolicyInterface $nodeNamePolicy, + private Node $originalNode, + private ObjectManager $objectManager, + private NodeNamePolicyInterface $nodeNamePolicy, ) { } diff --git a/src/Node/NodeMover.php b/src/Node/NodeMover.php index c302ae6f..9dbda8cd 100644 --- a/src/Node/NodeMover.php +++ b/src/Node/NodeMover.php @@ -8,7 +8,6 @@ use Doctrine\Persistence\ObjectManager; use Psr\Cache\CacheItemPoolInterface; use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; use RZ\Roadiz\Core\Handlers\HandlerFactoryInterface; use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodesSources; @@ -25,29 +24,16 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -class NodeMover +final readonly class NodeMover { - protected ManagerRegistry $managerRegistry; - protected UrlGeneratorInterface $urlGenerator; - protected HandlerFactoryInterface $handlerFactory; - protected EventDispatcherInterface $dispatcher; - protected CacheItemPoolInterface $cacheAdapter; - protected LoggerInterface $logger; - public function __construct( - ManagerRegistry $managerRegistry, - UrlGeneratorInterface $urlGenerator, - HandlerFactoryInterface $handlerFactory, - EventDispatcherInterface $dispatcher, - CacheItemPoolInterface $cacheAdapter, - ?LoggerInterface $logger = null, + private ManagerRegistry $managerRegistry, + private UrlGeneratorInterface $urlGenerator, + private HandlerFactoryInterface $handlerFactory, + private EventDispatcherInterface $dispatcher, + private CacheItemPoolInterface $cacheAdapter, + private LoggerInterface $logger, ) { - $this->urlGenerator = $urlGenerator; - $this->logger = $logger ?? new NullLogger(); - $this->dispatcher = $dispatcher; - $this->handlerFactory = $handlerFactory; - $this->managerRegistry = $managerRegistry; - $this->cacheAdapter = $cacheAdapter; } private function getManager(): ObjectManager diff --git a/src/Node/NodeNameChecker.php b/src/Node/NodeNameChecker.php index 06b05297..2a535799 100644 --- a/src/Node/NodeNameChecker.php +++ b/src/Node/NodeNameChecker.php @@ -12,16 +12,14 @@ use RZ\Roadiz\CoreBundle\Repository\UrlAliasRepository; use RZ\Roadiz\Utils\StringHandler; -class NodeNameChecker implements NodeNamePolicyInterface +final readonly class NodeNameChecker implements NodeNamePolicyInterface { public const MAX_LENGTH = 250; - protected bool $useTypedSuffix; - private ManagerRegistry $managerRegistry; - public function __construct(ManagerRegistry $managerRegistry, bool $useTypedSuffix = false) - { - $this->useTypedSuffix = $useTypedSuffix; - $this->managerRegistry = $managerRegistry; + public function __construct( + private ManagerRegistry $managerRegistry, + private bool $useTypedSuffix = false, + ) { } public function getCanonicalNodeName(NodesSources $nodeSource): string diff --git a/src/Node/NodeNamePolicyFactory.php b/src/Node/NodeNamePolicyFactory.php index 684bf003..96d13903 100644 --- a/src/Node/NodeNamePolicyFactory.php +++ b/src/Node/NodeNamePolicyFactory.php @@ -6,11 +6,11 @@ use Doctrine\Persistence\ManagerRegistry; -final class NodeNamePolicyFactory +final readonly class NodeNamePolicyFactory { public function __construct( - private readonly ManagerRegistry $registry, - private readonly bool $useTypedNodeNames, + private ManagerRegistry $registry, + private bool $useTypedNodeNames, ) { } diff --git a/src/Node/UniqueNodeGenerator.php b/src/Node/UniqueNodeGenerator.php index bffd2578..486ce3be 100644 --- a/src/Node/UniqueNodeGenerator.php +++ b/src/Node/UniqueNodeGenerator.php @@ -19,12 +19,12 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -class UniqueNodeGenerator +final readonly class UniqueNodeGenerator { public function __construct( - protected ManagerRegistry $managerRegistry, - protected NodeNamePolicyInterface $nodeNamePolicy, - protected Security $security, + private ManagerRegistry $managerRegistry, + private NodeNamePolicyInterface $nodeNamePolicy, + private Security $security, ) { } diff --git a/src/NodeType/ApiResourceGenerator.php b/src/NodeType/ApiResourceGenerator.php index 6d4d845c..8a24d0ba 100644 --- a/src/NodeType/ApiResourceGenerator.php +++ b/src/NodeType/ApiResourceGenerator.php @@ -15,16 +15,16 @@ use Symfony\Component\String\UnicodeString; use Symfony\Component\Yaml\Yaml; -final class ApiResourceGenerator +final readonly class ApiResourceGenerator { /** * @param class-string $webResponseClass */ public function __construct( - private readonly ApiResourceOperationNameGenerator $apiResourceOperationNameGenerator, - private readonly string $apiResourcesDir, - private readonly LoggerInterface $logger, - private readonly string $webResponseClass, + private ApiResourceOperationNameGenerator $apiResourceOperationNameGenerator, + private string $apiResourcesDir, + private LoggerInterface $logger, + private string $webResponseClass, ) { } diff --git a/src/NodeType/DefaultValuesResolver.php b/src/NodeType/DefaultValuesResolver.php index acb9faf6..ee933302 100644 --- a/src/NodeType/DefaultValuesResolver.php +++ b/src/NodeType/DefaultValuesResolver.php @@ -10,11 +10,11 @@ use RZ\Roadiz\CoreBundle\Entity\NodeTypeField; use RZ\Roadiz\EntityGenerator\Field\DefaultValuesResolverInterface; -final class DefaultValuesResolver implements DefaultValuesResolverInterface +final readonly class DefaultValuesResolver implements DefaultValuesResolverInterface { public function __construct( - private readonly ManagerRegistry $managerRegistry, - private readonly string $inheritanceType, + private ManagerRegistry $managerRegistry, + private string $inheritanceType, ) { } diff --git a/src/NodeType/NodeTypeResolver.php b/src/NodeType/NodeTypeResolver.php index 78e85527..702a1093 100644 --- a/src/NodeType/NodeTypeResolver.php +++ b/src/NodeType/NodeTypeResolver.php @@ -9,9 +9,9 @@ use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface; use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface; -final class NodeTypeResolver +final readonly class NodeTypeResolver { - public function __construct(private readonly CacheItemPoolInterface $cacheAdapter) + public function __construct(private CacheItemPoolInterface $cacheAdapter) { } diff --git a/src/Preview/EventSubscriber/PreviewBarSubscriber.php b/src/Preview/EventSubscriber/PreviewBarSubscriber.php index 42d894eb..725c1a01 100644 --- a/src/Preview/EventSubscriber/PreviewBarSubscriber.php +++ b/src/Preview/EventSubscriber/PreviewBarSubscriber.php @@ -10,9 +10,9 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -final class PreviewBarSubscriber implements EventSubscriberInterface +final readonly class PreviewBarSubscriber implements EventSubscriberInterface { - public function __construct(private readonly PreviewResolverInterface $previewResolver) + public function __construct(private PreviewResolverInterface $previewResolver) { } diff --git a/src/Preview/RequestPreviewRevolver.php b/src/Preview/RequestPreviewRevolver.php index 1cd5fbf3..9d952dd7 100644 --- a/src/Preview/RequestPreviewRevolver.php +++ b/src/Preview/RequestPreviewRevolver.php @@ -9,11 +9,11 @@ /** * BC Preview resolver to check Request-time then Kernel boot-time preview param. */ -final class RequestPreviewRevolver implements PreviewResolverInterface +final readonly class RequestPreviewRevolver implements PreviewResolverInterface { public function __construct( - private readonly RequestStack $requestStack, - private readonly string $requiredRole, + private RequestStack $requestStack, + private string $requiredRole, ) { } diff --git a/src/Preview/User/PreviewUser.php b/src/Preview/User/PreviewUser.php index a7fd7c01..2f513dd3 100644 --- a/src/Preview/User/PreviewUser.php +++ b/src/Preview/User/PreviewUser.php @@ -6,15 +6,12 @@ use Symfony\Component\Security\Core\User\UserInterface; -class PreviewUser implements UserInterface +final readonly class PreviewUser implements UserInterface { - protected string $username; - protected array $roles = []; - - public function __construct(string $username, array $roles) - { - $this->username = $username; - $this->roles = $roles; + public function __construct( + private string $username, + private array $roles = [], + ) { } public function getRoles(): array diff --git a/src/Preview/User/PreviewUserProvider.php b/src/Preview/User/PreviewUserProvider.php index dbd3cc7d..b5776b35 100644 --- a/src/Preview/User/PreviewUserProvider.php +++ b/src/Preview/User/PreviewUserProvider.php @@ -9,11 +9,11 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\User\UserInterface; -final class PreviewUserProvider implements PreviewUserProviderInterface +final readonly class PreviewUserProvider implements PreviewUserProviderInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, - private readonly Security $security, + private PreviewResolverInterface $previewResolver, + private Security $security, ) { } diff --git a/src/Realm/RealmResolver.php b/src/Realm/RealmResolver.php index b4a578cf..feca0c1f 100644 --- a/src/Realm/RealmResolver.php +++ b/src/Realm/RealmResolver.php @@ -14,12 +14,12 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; use Symfony\Component\String\Slugger\AsciiSlugger; -final class RealmResolver implements RealmResolverInterface +final readonly class RealmResolver implements RealmResolverInterface { public function __construct( - private readonly ManagerRegistry $managerRegistry, - private readonly Security $security, - private readonly CacheItemPoolInterface $cache, + private ManagerRegistry $managerRegistry, + private Security $security, + private CacheItemPoolInterface $cache, ) { } diff --git a/src/Routing/NodesSourcesUrlGenerator.php b/src/Routing/NodesSourcesUrlGenerator.php index 65b1cc30..5441fbd4 100644 --- a/src/Routing/NodesSourcesUrlGenerator.php +++ b/src/Routing/NodesSourcesUrlGenerator.php @@ -10,13 +10,13 @@ /** * Do not extend this class, use NodesSourcesPathGeneratingEvent::class event. */ -final class NodesSourcesUrlGenerator +final readonly class NodesSourcesUrlGenerator { public function __construct( - private readonly NodesSourcesPathAggregator $pathAggregator, - private readonly ?NodesSources $nodeSource = null, - private readonly bool $forceLocale = false, - private readonly bool $forceLocaleWithUrlAlias = false, + private NodesSourcesPathAggregator $pathAggregator, + private ?NodesSources $nodeSource = null, + private bool $forceLocale = false, + private bool $forceLocaleWithUrlAlias = false, ) { } diff --git a/src/Routing/OptimizedNodesSourcesGraphPathAggregator.php b/src/Routing/OptimizedNodesSourcesGraphPathAggregator.php index 42ace114..058afb40 100644 --- a/src/Routing/OptimizedNodesSourcesGraphPathAggregator.php +++ b/src/Routing/OptimizedNodesSourcesGraphPathAggregator.php @@ -11,11 +11,11 @@ use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodesSources; -final class OptimizedNodesSourcesGraphPathAggregator implements NodesSourcesPathAggregator +final readonly class OptimizedNodesSourcesGraphPathAggregator implements NodesSourcesPathAggregator { public function __construct( - private readonly ManagerRegistry $managerRegistry, - private readonly CacheItemPoolInterface $cacheAdapter, + private ManagerRegistry $managerRegistry, + private CacheItemPoolInterface $cacheAdapter, ) { } diff --git a/src/Routing/RouteHandler.php b/src/Routing/RouteHandler.php index 373e9674..d5d515be 100644 --- a/src/Routing/RouteHandler.php +++ b/src/Routing/RouteHandler.php @@ -7,10 +7,7 @@ use RZ\Roadiz\Utils\StringHandler; use Symfony\Component\String\UnicodeString; -/** - * Route handling methods. - */ -class RouteHandler +final class RouteHandler { public static function getBaseRoute(string $path): string { diff --git a/src/SearchEngine/AbstractSearchHandler.php b/src/SearchEngine/AbstractSearchHandler.php index bd8cf3b1..660ab06a 100644 --- a/src/SearchEngine/AbstractSearchHandler.php +++ b/src/SearchEngine/AbstractSearchHandler.php @@ -15,22 +15,16 @@ abstract class AbstractSearchHandler implements SearchHandlerInterface { - protected ClientRegistry $clientRegistry; - protected ObjectManager $em; protected LoggerInterface $logger; - protected EventDispatcherInterface $eventDispatcher; protected int $highlightingFragmentSize = 150; public function __construct( - ClientRegistry $clientRegistry, - ObjectManager $em, - LoggerInterface $searchEngineLogger, - EventDispatcherInterface $eventDispatcher, + protected readonly ClientRegistry $clientRegistry, + protected readonly ObjectManager $em, + readonly LoggerInterface $searchEngineLogger, + protected readonly EventDispatcherInterface $eventDispatcher, ) { - $this->clientRegistry = $clientRegistry; - $this->em = $em; $this->logger = $searchEngineLogger; - $this->eventDispatcher = $eventDispatcher; } public function getSolr(): Client diff --git a/src/SearchEngine/AbstractSolarium.php b/src/SearchEngine/AbstractSolarium.php index 39afa738..7ef06842 100644 --- a/src/SearchEngine/AbstractSolarium.php +++ b/src/SearchEngine/AbstractSolarium.php @@ -52,20 +52,16 @@ abstract class AbstractSolarium 'tr', ]; - protected ClientRegistry $clientRegistry; protected bool $indexed = false; protected ?DocumentInterface $document = null; protected LoggerInterface $logger; - protected MarkdownInterface $markdown; public function __construct( - ClientRegistry $clientRegistry, - LoggerInterface $searchEngineLogger, - MarkdownInterface $markdown, + protected readonly ClientRegistry $clientRegistry, + readonly LoggerInterface $searchEngineLogger, + protected readonly MarkdownInterface $markdown, ) { $this->logger = $searchEngineLogger; - $this->markdown = $markdown; - $this->clientRegistry = $clientRegistry; } public function getSolr(): Client diff --git a/src/SearchEngine/ClientRegistry.php b/src/SearchEngine/ClientRegistry.php index 28b20ec4..5d87d45f 100644 --- a/src/SearchEngine/ClientRegistry.php +++ b/src/SearchEngine/ClientRegistry.php @@ -7,9 +7,9 @@ use Solarium\Core\Client\Client; use Symfony\Component\DependencyInjection\ContainerInterface; -final class ClientRegistry +final readonly class ClientRegistry { - public function __construct(private readonly ContainerInterface $container) + public function __construct(private ContainerInterface $container) { } diff --git a/src/SearchEngine/GlobalNodeSourceSearchHandler.php b/src/SearchEngine/GlobalNodeSourceSearchHandler.php index f6892e60..081669d0 100644 --- a/src/SearchEngine/GlobalNodeSourceSearchHandler.php +++ b/src/SearchEngine/GlobalNodeSourceSearchHandler.php @@ -10,13 +10,10 @@ use RZ\Roadiz\CoreBundle\Entity\NodesSources; use RZ\Roadiz\CoreBundle\Entity\Translation; -class GlobalNodeSourceSearchHandler +readonly class GlobalNodeSourceSearchHandler { - private ObjectManager $em; - - public function __construct(ObjectManager $em) + public function __construct(private ObjectManager $em) { - $this->em = $em; } /** diff --git a/src/SearchEngine/NodeSourceSearchHandler.php b/src/SearchEngine/NodeSourceSearchHandler.php index e3486156..49cbf129 100644 --- a/src/SearchEngine/NodeSourceSearchHandler.php +++ b/src/SearchEngine/NodeSourceSearchHandler.php @@ -188,12 +188,14 @@ protected function argFqProcess(array &$args): array $status = $args['status'] ?? $args['node.status'] ?? null; if (isset($status)) { $tmp = 'node_status_i:'; - if (!is_array($status)) { + if ($status instanceof NodeStatus) { + $tmp .= (string) $status->value; + } elseif (is_numeric($status)) { $tmp .= (string) $status; - } elseif ('<=' == $status[0]) { - $tmp .= '[* TO '.(string) $status[1].']'; - } elseif ('>=' == $status[0]) { - $tmp .= '['.(string) $status[1].' TO *]'; + } elseif (is_array($status) && '<=' == $status[0] && $status[1] instanceof NodeStatus) { + $tmp .= '[* TO '.(string) $status[1]->value.']'; + } elseif (is_array($status) && '>=' == $status[0]->value && $status[1] instanceof NodeStatus) { + $tmp .= '['.(string) $status[1]->value.' TO *]'; } unset($args['status']); unset($args['node.status']); diff --git a/src/SearchEngine/SolariumDocument.php b/src/SearchEngine/SolariumDocument.php index f44c5ea1..f0fa0f84 100644 --- a/src/SearchEngine/SolariumDocument.php +++ b/src/SearchEngine/SolariumDocument.php @@ -12,14 +12,14 @@ use Solarium\QueryType\Update\Query\Query; /** - * Wrap a Solarium and a Document’ translations together to ease indexing. + * Wrap a Solarium and a document translations together to ease indexing. */ class SolariumDocument extends AbstractSolarium { protected array $documentTranslationItems; public function __construct( - Document $rzDocument, + readonly Document $rzDocument, SolariumFactoryInterface $solariumFactory, ClientRegistry $clientRegistry, LoggerInterface $searchEngineLogger, @@ -44,7 +44,7 @@ public function getDocument(): ?DocumentInterface /** * @return array<\Solarium\QueryType\Update\Query\Document|DocumentInterface> Each document translation Solr document */ - public function getDocuments() + public function getDocuments(): array { $documents = []; /** @var SolariumDocumentTranslation $documentTranslationItem */ diff --git a/src/SearchEngine/SolariumDocumentTranslation.php b/src/SearchEngine/SolariumDocumentTranslation.php index 50f800a9..47dbdd4e 100644 --- a/src/SearchEngine/SolariumDocumentTranslation.php +++ b/src/SearchEngine/SolariumDocumentTranslation.php @@ -20,20 +20,14 @@ class SolariumDocumentTranslation extends AbstractSolarium public const DOCUMENT_TYPE = 'DocumentTranslation'; public const IDENTIFIER_KEY = 'document_translation_id_i'; - protected DocumentTranslation $documentTranslation; - protected EventDispatcherInterface $dispatcher; - public function __construct( - DocumentTranslation $documentTranslation, + protected readonly DocumentTranslation $documentTranslation, ClientRegistry $clientRegistry, - EventDispatcherInterface $dispatcher, + protected readonly EventDispatcherInterface $dispatcher, LoggerInterface $searchEngineLogger, MarkdownInterface $markdown, ) { parent::__construct($clientRegistry, $searchEngineLogger, $markdown); - - $this->documentTranslation = $documentTranslation; - $this->dispatcher = $dispatcher; } public function getDocumentId(): int|string diff --git a/src/SearchEngine/SolariumFactory.php b/src/SearchEngine/SolariumFactory.php index 05f7966a..99f4fa0f 100644 --- a/src/SearchEngine/SolariumFactory.php +++ b/src/SearchEngine/SolariumFactory.php @@ -14,24 +14,16 @@ class SolariumFactory implements SolariumFactoryInterface { - protected ClientRegistry $clientRegistry; protected LoggerInterface $logger; - protected MarkdownInterface $markdown; - protected EventDispatcherInterface $dispatcher; - protected HandlerFactoryInterface $handlerFactory; public function __construct( - ClientRegistry $clientRegistry, - LoggerInterface $searchEngineLogger, - MarkdownInterface $markdown, - EventDispatcherInterface $dispatcher, - HandlerFactoryInterface $handlerFactory, + protected readonly ClientRegistry $clientRegistry, + readonly LoggerInterface $searchEngineLogger, + protected readonly MarkdownInterface $markdown, + protected readonly EventDispatcherInterface $dispatcher, + protected readonly HandlerFactoryInterface $handlerFactory, ) { - $this->clientRegistry = $clientRegistry; $this->logger = $searchEngineLogger; - $this->markdown = $markdown; - $this->dispatcher = $dispatcher; - $this->handlerFactory = $handlerFactory; } public function createWithDocument(Document $document): SolariumDocument diff --git a/src/SearchEngine/SolariumNodeSource.php b/src/SearchEngine/SolariumNodeSource.php index 289e1aec..dd3742b0 100644 --- a/src/SearchEngine/SolariumNodeSource.php +++ b/src/SearchEngine/SolariumNodeSource.php @@ -20,19 +20,14 @@ class SolariumNodeSource extends AbstractSolarium public const DOCUMENT_TYPE = 'NodesSources'; public const IDENTIFIER_KEY = 'node_source_id_i'; - protected NodesSources $nodeSource; - protected EventDispatcherInterface $dispatcher; - public function __construct( - NodesSources $nodeSource, + protected readonly NodesSources $nodeSource, ClientRegistry $clientRegistry, - EventDispatcherInterface $dispatcher, + protected readonly EventDispatcherInterface $dispatcher, LoggerInterface $searchEngineLogger, MarkdownInterface $markdown, ) { parent::__construct($clientRegistry, $searchEngineLogger, $markdown); - $this->nodeSource = $nodeSource; - $this->dispatcher = $dispatcher; } public function getDocumentId(): int|string diff --git a/src/Security/Authentication/BackofficeAuthenticationSuccessHandler.php b/src/Security/Authentication/BackofficeAuthenticationSuccessHandler.php index 61402417..b43c7153 100644 --- a/src/Security/Authentication/BackofficeAuthenticationSuccessHandler.php +++ b/src/Security/Authentication/BackofficeAuthenticationSuccessHandler.php @@ -13,11 +13,11 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; -final class BackofficeAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface +final readonly class BackofficeAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface { public function __construct( - private readonly UrlGeneratorInterface $urlGenerator, - private readonly ManagerRegistry $managerRegistry, + private UrlGeneratorInterface $urlGenerator, + private ManagerRegistry $managerRegistry, ) { } diff --git a/src/Security/Authorization/AccessDeniedHandler.php b/src/Security/Authorization/AccessDeniedHandler.php index 6172dc1f..2899141b 100644 --- a/src/Security/Authorization/AccessDeniedHandler.php +++ b/src/Security/Authorization/AccessDeniedHandler.php @@ -17,13 +17,13 @@ * This is used by the ExceptionListener to translate an AccessDeniedException * to a Response object. */ -final class AccessDeniedHandler implements AccessDeniedHandlerInterface +final readonly class AccessDeniedHandler implements AccessDeniedHandlerInterface { public function __construct( - private readonly UrlGeneratorInterface $urlGenerator, - private readonly ?LoggerInterface $logger, - private readonly string $redirectRoute = '', - private readonly array $redirectParameters = [], + private UrlGeneratorInterface $urlGenerator, + private ?LoggerInterface $logger, + private string $redirectRoute = '', + private array $redirectParameters = [], ) { } diff --git a/src/Security/Authorization/Chroot/NodeChrootChainResolver.php b/src/Security/Authorization/Chroot/NodeChrootChainResolver.php index 2d3f79bf..6c21dcc8 100644 --- a/src/Security/Authorization/Chroot/NodeChrootChainResolver.php +++ b/src/Security/Authorization/Chroot/NodeChrootChainResolver.php @@ -12,9 +12,9 @@ * Loops over NodeChrootResolver implementations to find the right one supporting * a given UserInterface or string User representation (from a Token for example). */ -final class NodeChrootChainResolver implements NodeChrootResolver +final readonly class NodeChrootChainResolver implements NodeChrootResolver { - public function __construct(private readonly array $resolvers) + public function __construct(private array $resolvers) { foreach ($this->resolvers as $resolver) { if (!($resolver instanceof NodeChrootResolver)) { diff --git a/src/Security/User/UserProvider.php b/src/Security/User/UserProvider.php index f7e254d7..a4071e86 100644 --- a/src/Security/User/UserProvider.php +++ b/src/Security/User/UserProvider.php @@ -11,9 +11,9 @@ use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; -final class UserProvider implements UserProviderInterface +final readonly class UserProvider implements UserProviderInterface { - public function __construct(private readonly ManagerRegistry $managerRegistry) + public function __construct(private ManagerRegistry $managerRegistry) { } diff --git a/src/Security/User/UserViewer.php b/src/Security/User/UserViewer.php index d2a52e2c..03582759 100644 --- a/src/Security/User/UserViewer.php +++ b/src/Security/User/UserViewer.php @@ -16,15 +16,15 @@ use Symfony\Component\Security\Http\LoginLink\LoginLinkDetails; use Symfony\Contracts\Translation\TranslatorInterface; -final class UserViewer +final readonly class UserViewer { public function __construct( - private readonly Settings $settingsBag, - private readonly UrlGeneratorInterface $urlGenerator, - private readonly TranslatorInterface $translator, - private readonly EmailManagerFactory $emailManagerFactory, - private readonly LoggerInterface $logger, - private readonly LoginLinkSenderInterface $loginLinkSender, + private Settings $settingsBag, + private UrlGeneratorInterface $urlGenerator, + private TranslatorInterface $translator, + private EmailManagerFactory $emailManagerFactory, + private LoggerInterface $logger, + private LoginLinkSenderInterface $loginLinkSender, ) { } diff --git a/src/Serializer/CircularReferenceHandler.php b/src/Serializer/CircularReferenceHandler.php index 62dff123..2948673c 100644 --- a/src/Serializer/CircularReferenceHandler.php +++ b/src/Serializer/CircularReferenceHandler.php @@ -7,9 +7,9 @@ use ApiPlatform\Metadata\IriConverterInterface; use ApiPlatform\Metadata\UrlGeneratorInterface; -final class CircularReferenceHandler +final readonly class CircularReferenceHandler { - public function __construct(private readonly IriConverterInterface $iriConverter) + public function __construct(private IriConverterInterface $iriConverter) { } diff --git a/src/Serializer/TranslationAwareContextBuilder.php b/src/Serializer/TranslationAwareContextBuilder.php index 6f63866e..69b0e628 100644 --- a/src/Serializer/TranslationAwareContextBuilder.php +++ b/src/Serializer/TranslationAwareContextBuilder.php @@ -11,12 +11,12 @@ use RZ\Roadiz\CoreBundle\Repository\TranslationRepository; use Symfony\Component\HttpFoundation\Request; -final class TranslationAwareContextBuilder implements SerializerContextBuilderInterface +final readonly class TranslationAwareContextBuilder implements SerializerContextBuilderInterface { public function __construct( - private readonly SerializerContextBuilderInterface $decorated, - private readonly ManagerRegistry $managerRegistry, - private readonly PreviewResolverInterface $previewResolver, + private SerializerContextBuilderInterface $decorated, + private ManagerRegistry $managerRegistry, + private PreviewResolverInterface $previewResolver, ) { } diff --git a/src/Tag/TagFactory.php b/src/Tag/TagFactory.php index b89738e5..6d31b414 100644 --- a/src/Tag/TagFactory.php +++ b/src/Tag/TagFactory.php @@ -11,16 +11,13 @@ use RZ\Roadiz\CoreBundle\Repository\TagRepository; use RZ\Roadiz\Utils\StringHandler; -final class TagFactory +final readonly class TagFactory { - public function __construct(private readonly ManagerRegistry $managerRegistry) + public function __construct(private ManagerRegistry $managerRegistry) { } - /** - * @param int|float $latestPosition - */ - public function create(string $name, ?TranslationInterface $translation = null, ?Tag $parent = null, $latestPosition = 0): Tag + public function create(string $name, ?TranslationInterface $translation = null, ?Tag $parent = null, int|float $latestPosition = 0): Tag { $name = strip_tags(trim($name)); $tagName = StringHandler::slugify($name); diff --git a/src/Traits/LoginResetTrait.php b/src/Traits/LoginResetTrait.php index 83520e60..d8e2c684 100644 --- a/src/Traits/LoginResetTrait.php +++ b/src/Traits/LoginResetTrait.php @@ -15,10 +15,7 @@ public function getUserByToken(ObjectManager $entityManager, string $token): ?Us return $entityManager->getRepository(User::class)->findOneByConfirmationToken($token); } - /** - * @return bool - */ - public function updateUserPassword(FormInterface $form, User $user, ObjectManager $entityManager) + public function updateUserPassword(FormInterface $form, User $user, ObjectManager $entityManager): bool { $user->setConfirmationToken(null); $user->setPasswordRequestedAt(null); diff --git a/src/Webhook/Message/GenericJsonPostMessageInterface.php b/src/Webhook/Message/GenericJsonPostMessageInterface.php index f6e8fca3..cd4d3007 100644 --- a/src/Webhook/Message/GenericJsonPostMessageInterface.php +++ b/src/Webhook/Message/GenericJsonPostMessageInterface.php @@ -31,8 +31,6 @@ public function getOptions(): array /** * @param Webhook $webhook - * - * @return static */ public static function fromWebhook(WebhookInterface $webhook): self { diff --git a/src/Webhook/Message/WebhookMessage.php b/src/Webhook/Message/WebhookMessage.php index 37821439..e6f97e06 100644 --- a/src/Webhook/Message/WebhookMessage.php +++ b/src/Webhook/Message/WebhookMessage.php @@ -8,8 +8,5 @@ interface WebhookMessage { - /** - * @return static - */ - public static function fromWebhook(WebhookInterface $webhook); + public static function fromWebhook(WebhookInterface $webhook): self; } diff --git a/src/Webhook/ThrottledWebhookDispatcher.php b/src/Webhook/ThrottledWebhookDispatcher.php index 563243b6..56c22e90 100644 --- a/src/Webhook/ThrottledWebhookDispatcher.php +++ b/src/Webhook/ThrottledWebhookDispatcher.php @@ -10,12 +10,12 @@ use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\RateLimiter\RateLimiterFactory; -final class ThrottledWebhookDispatcher implements WebhookDispatcher +final readonly class ThrottledWebhookDispatcher implements WebhookDispatcher { public function __construct( - private readonly WebhookMessageFactoryInterface $messageFactory, - private readonly MessageBusInterface $messageBus, - private readonly RateLimiterFactory $throttledWebhooksLimiter, + private WebhookMessageFactoryInterface $messageFactory, + private MessageBusInterface $messageBus, + private RateLimiterFactory $throttledWebhooksLimiter, ) { } diff --git a/src/Workflow/Event/NodeStatusGuardListener.php b/src/Workflow/Event/NodeStatusGuardListener.php index 8f80d78b..925f1106 100644 --- a/src/Workflow/Event/NodeStatusGuardListener.php +++ b/src/Workflow/Event/NodeStatusGuardListener.php @@ -11,9 +11,9 @@ use Symfony\Component\Workflow\Event\GuardEvent; use Symfony\Component\Workflow\TransitionBlocker; -final class NodeStatusGuardListener implements EventSubscriberInterface +final readonly class NodeStatusGuardListener implements EventSubscriberInterface { - public function __construct(private readonly Security $security) + public function __construct(private Security $security) { }