Skip to content

Commit

Permalink
Make createComponent methods protected
Browse files Browse the repository at this point in the history
  • Loading branch information
rozsival committed Dec 18, 2019
1 parent f5e973c commit e9db758
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion composer.json
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/DIServiceAnnotation/Generators/templates/component.txt
Expand Up @@ -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();
}

}
Expand Up @@ -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();
}

}

0 comments on commit e9db758

Please sign in to comment.