diff --git a/src/Liip/RMT/Action/CommandAction.php b/src/Liip/RMT/Action/CommandAction.php index b2ea5b0e..536c04fd 100644 --- a/src/Liip/RMT/Action/CommandAction.php +++ b/src/Liip/RMT/Action/CommandAction.php @@ -40,7 +40,7 @@ public function execute() // Prepare a callback for live output $callback = null; - if ($this->options['live_output'] == true) { + if ($this->options['live_output']) { $callback = function ($type, $buffer) { $decorator = array('',''); if ($type == Process::ERR) { diff --git a/src/Liip/RMT/Action/FilesUpdateAction.php b/src/Liip/RMT/Action/FilesUpdateAction.php index 4e6367c2..aad199ea 100644 --- a/src/Liip/RMT/Action/FilesUpdateAction.php +++ b/src/Liip/RMT/Action/FilesUpdateAction.php @@ -29,7 +29,7 @@ public function execute() foreach ($this->options as $option) { $file = $option[0]; - $pattern = isset($option[1]) ? $option[1] : null; + $pattern = $option[1] ?? null; if (! file_exists($file)) { $versionClass = new ReflectionClass($file); diff --git a/src/Liip/RMT/Action/VcsPublishAction.php b/src/Liip/RMT/Action/VcsPublishAction.php index 2eded84f..56c44699 100644 --- a/src/Liip/RMT/Action/VcsPublishAction.php +++ b/src/Liip/RMT/Action/VcsPublishAction.php @@ -86,7 +86,7 @@ public function getInformationRequests() * * @return string|null */ - protected function getRemote() + protected function getRemote(): ?string { if ($this->options['ask-remote-name']) { return Context::get('information-collector')->getValueFor('remote'); @@ -95,6 +95,6 @@ protected function getRemote() return $this->options['remote-name']; } - return; + return null; } } diff --git a/src/Liip/RMT/Changelog/ChangelogManager.php b/src/Liip/RMT/Changelog/ChangelogManager.php index 28453619..487486fe 100644 --- a/src/Liip/RMT/Changelog/ChangelogManager.php +++ b/src/Liip/RMT/Changelog/ChangelogManager.php @@ -18,6 +18,7 @@ class ChangelogManager { protected $filePath; protected $formatter; + protected $format; public function __construct($filePath, $format) { diff --git a/src/Liip/RMT/Command/CurrentCommand.php b/src/Liip/RMT/Command/CurrentCommand.php index d3e2f257..81c5c043 100644 --- a/src/Liip/RMT/Command/CurrentCommand.php +++ b/src/Liip/RMT/Command/CurrentCommand.php @@ -37,7 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('vcs-tag')) { $vcsTag = Context::get('version-persister')->getCurrentVersionTag(); } - if ($input->getOption('raw') == true) { + if ($input->getOption('raw')) { $output->writeln($input->getOption('vcs-tag') ? $vcsTag : $version); } else { $msg = "Current release is: $version"; diff --git a/src/Liip/RMT/Config/Handler.php b/src/Liip/RMT/Config/Handler.php index 5b08b0e5..4eb3f49f 100644 --- a/src/Liip/RMT/Config/Handler.php +++ b/src/Liip/RMT/Config/Handler.php @@ -200,27 +200,26 @@ protected function findInternalClass($name, $sectionName) } // Guess the namespace - $namespacesByType = array( + $namespacesByType = [ 'vcs' => 'Liip\RMT\VCS', 'prerequisites' => 'Liip\RMT\Prerequisite', 'pre-release-actions' => 'Liip\RMT\Action', 'post-release-actions' => 'Liip\RMT\Action', 'version-generator' => 'Liip\RMT\Version\Generator', 'version-persister' => 'Liip\RMT\Version\Persister', - ); + ]; $nameSpace = $namespacesByType[$classType]; // Guess the class name // Convert from xxx-yyy-zzz to XxxYyyZzz and append suffix - $suffixByType = array( + $suffixByType = [ 'vcs' => '', 'prerequisites' => '', 'pre-release-actions' => 'Action', 'post-release-actions' => 'Action', 'version-generator' => 'Generator', 'version-persister' => 'Persister', - ); - $nameSpace = $namespacesByType[$classType]; + ]; $className = str_replace(' ', '', ucwords(str_replace('-', ' ', $name))).$suffixByType[$classType]; return $nameSpace.'\\'.$className; diff --git a/src/Liip/RMT/Prerequisite/TestsCheck.php b/src/Liip/RMT/Prerequisite/TestsCheck.php index 6276b159..25381f96 100644 --- a/src/Liip/RMT/Prerequisite/TestsCheck.php +++ b/src/Liip/RMT/Prerequisite/TestsCheck.php @@ -40,7 +40,7 @@ public function execute() } // Run the tests and live output with the standard output class - $timeout = isset($this->options['timeout']) ? $this->options['timeout'] : null; + $timeout = $this->options['timeout'] ?? null; $process = $this->executeCommandInProcess($this->options['command'], $timeout); // Break up if the result is not good diff --git a/src/Liip/RMT/Version/Generator/SemanticGenerator.php b/src/Liip/RMT/Version/Generator/SemanticGenerator.php index 55373e57..f7a22f91 100644 --- a/src/Liip/RMT/Version/Generator/SemanticGenerator.php +++ b/src/Liip/RMT/Version/Generator/SemanticGenerator.php @@ -37,17 +37,11 @@ public function __construct($options = array()) */ public function generateNextVersion($currentVersion) { - $type = isset($this->options['type']) ? - $this->options['type'] : - Context::get('information-collector')->getValueFor('type') - ; + $type = $this->options['type'] ?? Context::get('information-collector')->getValueFor('type'); $label = 'none'; - if (isset($this->options['allow-label']) && $this->options['allow-label'] == true) { - $label = isset($this->options['label']) ? - $this->options['label'] : - Context::get('information-collector')->getValueFor('label') - ; + if (isset($this->options['allow-label']) && $this->options['allow-label']) { + $label = $this->options['label'] ?? Context::get('information-collector')->getValueFor('label'); } // Type validation diff --git a/src/Liip/RMT/Version/Persister/TagValidator.php b/src/Liip/RMT/Version/Persister/TagValidator.php index e11a60c3..2dd44ab1 100644 --- a/src/Liip/RMT/Version/Persister/TagValidator.php +++ b/src/Liip/RMT/Version/Persister/TagValidator.php @@ -13,7 +13,10 @@ class TagValidator { - public function __construct($regex, $tagPrefix = '') + protected $regex; + protected $tagPrefix; + + public function __construct(string $regex, string $tagPrefix = '') { $this->regex = $regex; $this->tagPrefix = $tagPrefix;