diff --git a/modules/ui_styles_block/src/HookHandler/FormBlockFormAlter.php b/modules/ui_styles_block/src/HookHandler/FormBlockFormAlter.php index 4c5996b334768518402c6d72f523a19e3240283e..b2e240de477e525c38c7309356b5097f0dd679c3 100644 --- a/modules/ui_styles_block/src/HookHandler/FormBlockFormAlter.php +++ b/modules/ui_styles_block/src/HookHandler/FormBlockFormAlter.php @@ -24,15 +24,14 @@ class FormBlockFormAlter { * The form state. */ public function blockFormAlter(array &$form, FormStateInterface $formState): void { - /** @var \Drupal\block\BlockForm $form_object */ $form_object = $formState->getFormObject(); - /** @var \Drupal\block\BlockInterface $block */ - $block = $form_object->getEntity(); - if (!($form_object instanceof EntityFormInterface)) { return; } + /** @var \Drupal\block\BlockInterface $block */ + $block = $form_object->getEntity(); + $theme = $block->getTheme(); if ($theme == NULL) { return; diff --git a/modules/ui_styles_block/src/HookHandler/PreprocessBlock.php b/modules/ui_styles_block/src/HookHandler/PreprocessBlock.php index 3a80ca78082e05cd91f6d8658d3aa77c9e8c59b5..08351d52a7f0febb41c1ad0d2eafa52c87675d64 100644 --- a/modules/ui_styles_block/src/HookHandler/PreprocessBlock.php +++ b/modules/ui_styles_block/src/HookHandler/PreprocessBlock.php @@ -16,35 +16,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class PreprocessBlock implements ContainerInjectionInterface { - /** - * The entity type manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected EntityTypeManagerInterface $entityTypeManager; - - /** - * The styles plugin manager. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected StylePluginManagerInterface $stylesManager; - - /** - * Constructor. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager - * The entity type manager. - * @param \Drupal\ui_styles\StylePluginManagerInterface $stylesManager - * The styles plugin manager. - */ public function __construct( - EntityTypeManagerInterface $entityTypeManager, - StylePluginManagerInterface $stylesManager, - ) { - $this->entityTypeManager = $entityTypeManager; - $this->stylesManager = $stylesManager; - } + protected EntityTypeManagerInterface $entityTypeManager, + protected StylePluginManagerInterface $stylesManager, + ) {} /** * {@inheritdoc} diff --git a/modules/ui_styles_ckeditor5/src/Plugin/CKEditor5Plugin/UiStylesBase.php b/modules/ui_styles_ckeditor5/src/Plugin/CKEditor5Plugin/UiStylesBase.php index ecfd675f24e6f33d253fb8c84597861530ec7c9a..f9af91b2520ede5de5e5340d2f5ff5f249a30819 100644 --- a/modules/ui_styles_ckeditor5/src/Plugin/CKEditor5Plugin/UiStylesBase.php +++ b/modules/ui_styles_ckeditor5/src/Plugin/CKEditor5Plugin/UiStylesBase.php @@ -39,13 +39,6 @@ abstract class UiStylesBase extends CKEditor5PluginDefault implements CKEditor5P 'enabled_styles' => [], ]; - /** - * The styles plugin manager. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected StylePluginManagerInterface $stylesManager; - /** * The CKE5 config key. * @@ -53,30 +46,14 @@ abstract class UiStylesBase extends CKEditor5PluginDefault implements CKEditor5P */ protected string $ckeditor5ConfigKey; - /** - * Constructor. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition $plugin_definition - * The plugin implementation definition. - * @param \Drupal\ui_styles\StylePluginManagerInterface $stylesManager - * The styles plugin manager. - * @param \Drupal\Component\Transliteration\TransliterationInterface $transliteration - * The transliteration service. - */ public function __construct( array $configuration, string $plugin_id, CKEditor5PluginDefinition $plugin_definition, - StylePluginManagerInterface $stylesManager, - TransliterationInterface $transliteration, + protected StylePluginManagerInterface $stylesManager, + protected TransliterationInterface $transliteration, ) { parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->stylesManager = $stylesManager; - $this->transliteration = $transliteration; } /** diff --git a/modules/ui_styles_entity_status/src/HookHandler/EntityView.php b/modules/ui_styles_entity_status/src/HookHandler/EntityView.php index bdd1e1b5565b99dd270a4435accdc6f173b85250..9bdd81baeb592da4f739282bbec1ce770e34ac72 100644 --- a/modules/ui_styles_entity_status/src/HookHandler/EntityView.php +++ b/modules/ui_styles_entity_status/src/HookHandler/EntityView.php @@ -22,24 +22,9 @@ class EntityView implements ContainerInjectionInterface { use SectionStorageTrait; - /** - * The styles plugin manager. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected StylePluginManagerInterface $stylesManager; - - /** - * Constructor. - * - * @param \Drupal\ui_styles\StylePluginManagerInterface $stylesManager - * The styles plugin manager. - */ public function __construct( - StylePluginManagerInterface $stylesManager, - ) { - $this->stylesManager = $stylesManager; - } + protected StylePluginManagerInterface $stylesManager, + ) {} /** * {@inheritdoc} diff --git a/modules/ui_styles_layout_builder/src/EventSubscriber/BlockComponentRenderArraySubscriber.php b/modules/ui_styles_layout_builder/src/EventSubscriber/BlockComponentRenderArraySubscriber.php index bc9eca5cdfb163b73111224ba5f71bdbf0649468..aaaa4f9fed6b8b2034e3f634af658ab1093f81d2 100644 --- a/modules/ui_styles_layout_builder/src/EventSubscriber/BlockComponentRenderArraySubscriber.php +++ b/modules/ui_styles_layout_builder/src/EventSubscriber/BlockComponentRenderArraySubscriber.php @@ -15,22 +15,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class BlockComponentRenderArraySubscriber implements EventSubscriberInterface { - /** - * The style manager. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected $styleManager; - - /** - * Constructor. - * - * @param \Drupal\ui_styles\StylePluginManagerInterface $style_manager - * The style manager. - */ - public function __construct(StylePluginManagerInterface $style_manager) { - $this->styleManager = $style_manager; - } + public function __construct( + protected StylePluginManagerInterface $styleManager, + ) {} /** * {@inheritdoc} diff --git a/modules/ui_styles_layout_builder/src/HookHandler/EntityViewAlter.php b/modules/ui_styles_layout_builder/src/HookHandler/EntityViewAlter.php index 5a71273897201077fa78e8aed5f1ab1205a0b8b3..4d58b9efedd48f3ebd780df1d87b64ff72ed4de5 100644 --- a/modules/ui_styles_layout_builder/src/HookHandler/EntityViewAlter.php +++ b/modules/ui_styles_layout_builder/src/HookHandler/EntityViewAlter.php @@ -22,24 +22,9 @@ class EntityViewAlter implements ContainerInjectionInterface { use SectionStorageTrait; - /** - * The styles plugin manager. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected StylePluginManagerInterface $stylesManager; - - /** - * Constructor. - * - * @param \Drupal\ui_styles\StylePluginManagerInterface $stylesManager - * The styles plugin manager. - */ public function __construct( - StylePluginManagerInterface $stylesManager, - ) { - $this->stylesManager = $stylesManager; - } + protected StylePluginManagerInterface $stylesManager, + ) {} /** * {@inheritdoc} diff --git a/modules/ui_styles_library/src/Controller/StylesLibraryController.php b/modules/ui_styles_library/src/Controller/StylesLibraryController.php index a9ddd5d2e2db68454039ef629d67fad1e8bb2ae9..454b2f768ae2a6c97966f2a573da4d133f04422e 100644 --- a/modules/ui_styles_library/src/Controller/StylesLibraryController.php +++ b/modules/ui_styles_library/src/Controller/StylesLibraryController.php @@ -13,24 +13,14 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class StylesLibraryController extends ControllerBase { - /** - * Styles manager service. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected $stylesManager; - - /** - * {@inheritdoc} - */ - final public function __construct(StylePluginManagerInterface $styles_manager) { - $this->stylesManager = $styles_manager; - } + public function __construct( + protected StylePluginManagerInterface $stylesManager, + ) {} /** * {@inheritdoc} */ - public static function create(ContainerInterface $container): self { + public static function create(ContainerInterface $container): static { return new static($container->get('plugin.manager.ui_styles')); } diff --git a/modules/ui_styles_page/src/Plugin/Derivative/RegionStyles.php b/modules/ui_styles_page/src/Plugin/Derivative/RegionStyles.php index 2707aeb546826d0aea1c3fefd0b315296f141b0d..22cb5630df9db28c06e954fa0ac2a81867f6257b 100644 --- a/modules/ui_styles_page/src/Plugin/Derivative/RegionStyles.php +++ b/modules/ui_styles_page/src/Plugin/Derivative/RegionStyles.php @@ -15,35 +15,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class RegionStyles extends DeriverBase implements ContainerDeriverInterface { - /** - * The theme handler. - * - * @var \Drupal\Core\Extension\ThemeHandlerInterface - */ - protected ThemeHandlerInterface $themeHandler; - - /** - * The plugin manager. - * - * @var \Drupal\ui_styles\StylePluginManagerInterface - */ - protected StylePluginManagerInterface $stylesManager; - - /** - * Constructor. - * - * @param \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler - * The theme handler. - * @param \Drupal\ui_styles\StylePluginManagerInterface $stylesManager - * The styles plugin manager. - */ public function __construct( - ThemeHandlerInterface $themeHandler, - StylePluginManagerInterface $stylesManager, - ) { - $this->themeHandler = $themeHandler; - $this->stylesManager = $stylesManager; - } + protected ThemeHandlerInterface $themeHandler, + protected StylePluginManagerInterface $stylesManager, + ) {} /** * {@inheritdoc} diff --git a/modules/ui_styles_views/src/Plugin/views/display_extender/Styles.php b/modules/ui_styles_views/src/Plugin/views/display_extender/Styles.php index 63f4a3a45f21ee1ebc6a14928526e2c920efa35b..24cc8e98e290268c57011acc4b5694bb89c4ca3f 100644 --- a/modules/ui_styles_views/src/Plugin/views/display_extender/Styles.php +++ b/modules/ui_styles_views/src/Plugin/views/display_extender/Styles.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Drupal\ui_styles_views\Plugin\views\display_extender; use Drupal\Core\Form\FormStateInterface; +use Drupal\ui_styles\StylePluginManagerInterface; use Drupal\views\Plugin\views\display_extender\DisplayExtenderPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -27,7 +28,7 @@ class Styles extends DisplayExtenderPluginBase { * * @var \Drupal\ui_styles\StylePluginManagerInterface */ - protected $stylesManager; + protected StylePluginManagerInterface $stylesManager; /** * {@inheritdoc} diff --git a/tests/modules/ui_styles_test/src/MachineNameTraitTestClass.php b/tests/modules/ui_styles_test/src/MachineNameTraitTestClass.php index 39be1fc714725da9d3d90d2c5b1f2ccc910c9198..54892a389d558991eaa01e1bd1508eb4a3abb8ab 100644 --- a/tests/modules/ui_styles_test/src/MachineNameTraitTestClass.php +++ b/tests/modules/ui_styles_test/src/MachineNameTraitTestClass.php @@ -14,17 +14,9 @@ class MachineNameTraitTestClass { use MachineNameTrait; - /** - * Constructor. - * - * @param \Drupal\Component\Transliteration\TransliterationInterface $transliteration - * The transliteration service. - */ public function __construct( - TransliterationInterface $transliteration, - ) { - $this->transliteration = $transliteration; - } + protected TransliterationInterface $transliteration, + ) {} /** * Wrapper around protected method.