decouple setConfig() method

This commit is contained in:
TomasVotruba 2018-01-17 21:42:49 +01:00
parent 4fb5179ace
commit bf61bed251

View File

@ -70,8 +70,7 @@ final class TemplateAnnotationRector extends AbstractRector
BetterNodeFinder $betterNodeFinder, BetterNodeFinder $betterNodeFinder,
TemplateGuesser $templateGuesser TemplateGuesser $templateGuesser
) { ) {
$this->ensureConfigHasVersion($config); $this->setConfig($config);
$this->version = $config['version'];
$this->docBlockAnalyzer = $docBlockAnalyzer; $this->docBlockAnalyzer = $docBlockAnalyzer;
$this->methodCallNodeFactory = $methodCallNodeFactory; $this->methodCallNodeFactory = $methodCallNodeFactory;
$this->nodeFactory = $nodeFactory; $this->nodeFactory = $nodeFactory;
@ -172,6 +171,15 @@ final class TemplateAnnotationRector extends AbstractRector
return $arguments; return $arguments;
} }
/**
* @param mixed[] $config
*/
private function setConfig(array $config): void
{
$this->ensureConfigHasVersion($config);
$this->version = $config['version'];
}
/** /**
* @param mixed[] $config * @param mixed[] $config
*/ */