From e9db7587dd4298dc05ec747210143b7b922e5988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Rozs=C3=ADval?= Date: Wed, 18 Dec 2019 11:49:36 +0100 Subject: [PATCH] Make createComponent methods protected --- composer.json | 8 +++++++- .../Generators/templates/component.txt | 8 ++++---- .../expected/Services/Text/TextComponent.php | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 1836188..9bdc641 100644 --- a/composer.json +++ b/composer.json @@ -27,8 +27,14 @@ "Wavevision\\": "tests/" } }, + "config": { + "platform": { + "php": "7.4" + }, + "sort-packages": true + }, "require": { - "php": ">=7.2", + "php": ">=7.4", "doctrine/annotations": "^1.8", "nette/finder": "^2.5", "wavevision/utils": "^1.1" diff --git a/src/DIServiceAnnotation/Generators/templates/component.txt b/src/DIServiceAnnotation/Generators/templates/component.txt index 60b1dcc..82926c1 100644 --- a/src/DIServiceAnnotation/Generators/templates/component.txt +++ b/src/DIServiceAnnotation/Generators/templates/component.txt @@ -12,14 +12,14 @@ trait %2$s $this->%5$s = $%4$s; } - public function createComponent%7$s(): %8$s + public function get%7$sComponent(): %8$s { - return $this->%5$s->create(); + return $this['%9$s']; } - public function get%7$sComponent(): %8$s + protected function createComponent%7$s(): %8$s { - return $this['%9$s']; + return $this->%5$s->create(); } } diff --git a/tests/DIServiceAnnotationTests/expected/Services/Text/TextComponent.php b/tests/DIServiceAnnotationTests/expected/Services/Text/TextComponent.php index e1fce61..bfe3930 100644 --- a/tests/DIServiceAnnotationTests/expected/Services/Text/TextComponent.php +++ b/tests/DIServiceAnnotationTests/expected/Services/Text/TextComponent.php @@ -12,14 +12,14 @@ public function injectTextControlFactory(ControlFactory $controlFactory): void $this->textControlFactory = $controlFactory; } - public function createComponentText(): Control + public function getTextComponent(): Control { - return $this->textControlFactory->create(); + return $this['text']; } - public function getTextComponent(): Control + protected function createComponentText(): Control { - return $this['text']; + return $this->textControlFactory->create(); } }