From 8b3e5986564b4aa0463ced1df7a92d68e56bd00a Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 19 Jul 2024 16:45:40 +0200 Subject: [PATCH] [Rector] Applied all Symfony 5.x rectors to the production codebase Applied rules: * AddReturnTypeDeclarationBasedOnParentClassMethodRector * AddReturnTypeDeclarationRector --- src/bundle/DependencyInjection/Configuration.php | 2 +- .../DependencyInjection/IbexaFieldTypeRichTextExtension.php | 5 +++-- src/bundle/IbexaFieldTypeRichTextBundle.php | 3 ++- src/lib/FieldType/RichText/Value.php | 2 +- src/lib/Form/Type/RichTextFieldType.php | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/bundle/DependencyInjection/Configuration.php b/src/bundle/DependencyInjection/Configuration.php index ecb8e677..57033865 100644 --- a/src/bundle/DependencyInjection/Configuration.php +++ b/src/bundle/DependencyInjection/Configuration.php @@ -23,7 +23,7 @@ class Configuration extends SiteAccessConfiguration * * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder(IbexaFieldTypeRichTextExtension::EXTENSION_NAME); diff --git a/src/bundle/DependencyInjection/IbexaFieldTypeRichTextExtension.php b/src/bundle/DependencyInjection/IbexaFieldTypeRichTextExtension.php index da5043b6..c6e38f67 100644 --- a/src/bundle/DependencyInjection/IbexaFieldTypeRichTextExtension.php +++ b/src/bundle/DependencyInjection/IbexaFieldTypeRichTextExtension.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Container\Encore\ConfigurationDumper as IbexaEncoreConfigurationDumper; use Ibexa\Contracts\FieldTypeRichText\Configuration\Provider; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Resource\FileResource; @@ -39,7 +40,7 @@ class IbexaFieldTypeRichTextExtension extends Extension implements PrependExtens ], ]; - public function getAlias() + public function getAlias(): string { return self::EXTENSION_NAME; } @@ -193,7 +194,7 @@ private function prependJMSTranslation(ContainerBuilder $container): void ]); } - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { return new Configuration(); } diff --git a/src/bundle/IbexaFieldTypeRichTextBundle.php b/src/bundle/IbexaFieldTypeRichTextBundle.php index 821d2625..794aa399 100644 --- a/src/bundle/IbexaFieldTypeRichTextBundle.php +++ b/src/bundle/IbexaFieldTypeRichTextBundle.php @@ -13,6 +13,7 @@ use Ibexa\Bundle\FieldTypeRichText\DependencyInjection\Configuration\Parser\FieldType\RichText; use Ibexa\Bundle\FieldTypeRichText\DependencyInjection\IbexaFieldTypeRichTextExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; /** @@ -47,7 +48,7 @@ protected function getCoreExtension(ContainerBuilder $container): IbexaCoreExten return $container->getExtension('ibexa'); } - public function getContainerExtension() + public function getContainerExtension(): ?ExtensionInterface { if (!isset($this->extension)) { $this->extension = new IbexaFieldTypeRichTextExtension(); diff --git a/src/lib/FieldType/RichText/Value.php b/src/lib/FieldType/RichText/Value.php index 82acfb64..c01f165e 100644 --- a/src/lib/FieldType/RichText/Value.php +++ b/src/lib/FieldType/RichText/Value.php @@ -46,7 +46,7 @@ public function __construct($xml = null) /** * @see \Ibexa\Core\FieldType\Value */ - public function __toString() + public function __toString(): string { return isset($this->xml) ? (string)$this->xml->saveXML() : self::EMPTY_VALUE; } diff --git a/src/lib/Form/Type/RichTextFieldType.php b/src/lib/Form/Type/RichTextFieldType.php index 2bec1fa0..01c9afc6 100644 --- a/src/lib/Form/Type/RichTextFieldType.php +++ b/src/lib/Form/Type/RichTextFieldType.php @@ -37,12 +37,12 @@ public function getName() return $this->getBlockPrefix(); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ezplatform_fieldtype_ezrichtext'; } - public function getParent() + public function getParent(): ?string { return TextareaType::class; }