From 64d99558a82d2bd500b08986e2e563b87aa3a948 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jan 2019 16:36:23 +0100 Subject: [PATCH] OPENEUROPA-1535: Update coding style based on new code-review version. --- src/Commands/AbstractDrupalCommands.php | 8 ++--- src/Commands/ChangelogCommands.php | 12 ++++---- src/Commands/ReleaseCommands.php | 12 ++++---- src/Contract/RepositoryAwareInterface.php | 16 +++++----- src/TaskRunner.php | 12 ++++---- .../CollectionFactory/CollectionFactory.php | 8 ++--- tests/Commands/ReleaseCommandsTest.php | 30 +++++++++---------- tests/CommandsTest.php | 20 ++++++------- tests/Tasks/CollectionFactoryTest.php | 10 +++---- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/Commands/AbstractDrupalCommands.php b/src/Commands/AbstractDrupalCommands.php index 6c49aa6d..28305570 100644 --- a/src/Commands/AbstractDrupalCommands.php +++ b/src/Commands/AbstractDrupalCommands.php @@ -30,8 +30,8 @@ abstract class AbstractDrupalCommands extends AbstractCommands implements Filesy public function getDrupal() { return $this->getConfig()->get('drupal.core') === 7 ? - new Drupal7Commands() : - new Drupal8Commands(); + new Drupal7Commands() : + new Drupal8Commands(); } /** @@ -284,8 +284,8 @@ public function sitePreInstall() * @return \Robo\Collection\CollectionBuilder */ public function drushSetup(array $options = [ - 'root' => InputOption::VALUE_REQUIRED, - 'config-dir' => InputOption::VALUE_REQUIRED, + 'root' => InputOption::VALUE_REQUIRED, + 'config-dir' => InputOption::VALUE_REQUIRED, ]) { $config = $this->getConfig(); diff --git a/src/Commands/ChangelogCommands.php b/src/Commands/ChangelogCommands.php index e67b493a..1b4abe95 100644 --- a/src/Commands/ChangelogCommands.php +++ b/src/Commands/ChangelogCommands.php @@ -41,8 +41,8 @@ public function getConfigurationFile() * @return \Robo\Task\Docker\Run */ public function generateChangelog(array $options = [ - 'token' => InputOption::VALUE_REQUIRED, - 'tag' => InputOption::VALUE_OPTIONAL, + 'token' => InputOption::VALUE_REQUIRED, + 'tag' => InputOption::VALUE_OPTIONAL, ]) { $projectName = $this->getComposer()->getName(); @@ -52,10 +52,10 @@ public function generateChangelog(array $options = [ } $task = $this->taskDockerRun('muccg/github-changelog-generator') - ->option('rm') - ->rawArg('-v $(pwd):$(pwd)') - ->rawArg('-w $(pwd)') - ->exec($exec); + ->option('rm') + ->rawArg('-v $(pwd):$(pwd)') + ->rawArg('-w $(pwd)') + ->exec($exec); return $task; } diff --git a/src/Commands/ReleaseCommands.php b/src/Commands/ReleaseCommands.php index d96687c2..48d1a24b 100644 --- a/src/Commands/ReleaseCommands.php +++ b/src/Commands/ReleaseCommands.php @@ -86,8 +86,8 @@ public function setRuntimeConfig(ConsoleCommandEvent $event) * @aliases release:ca,rca */ public function createRelease(array $options = [ - 'tag' => InputOption::VALUE_OPTIONAL, - 'keep' => false, + 'tag' => InputOption::VALUE_OPTIONAL, + 'keep' => false, ]) { $name = $this->composer->getProject(); @@ -96,12 +96,12 @@ public function createRelease(array $options = [ $tasks = [ // Make sure we do not have a release directory yet. - $this->taskFilesystemStack()->remove([$archive, $name]), + $this->taskFilesystemStack()->remove([$archive, $name]), // Get non-modified code using git archive. - $this->taskGitStack()->exec(["archive", "HEAD", "-o $name.zip"]), - $this->taskExtract("$name.zip")->to("$name"), - $this->taskFilesystemStack()->remove("$name.zip"), + $this->taskGitStack()->exec(["archive", "HEAD", "-o $name.zip"]), + $this->taskExtract("$name.zip")->to("$name"), + $this->taskFilesystemStack()->remove("$name.zip"), ]; // Append release tasks defined in runner.yml.dist. diff --git a/src/Contract/RepositoryAwareInterface.php b/src/Contract/RepositoryAwareInterface.php index 0a7dc49d..07349be5 100644 --- a/src/Contract/RepositoryAwareInterface.php +++ b/src/Contract/RepositoryAwareInterface.php @@ -12,15 +12,15 @@ interface RepositoryAwareInterface { - /** - * @return Repository - */ + /** + * @return Repository + */ public function getRepository(); - /** - * @param \Gitonomy\Git\Repository $repository - * - * @return $this - */ + /** + * @param \Gitonomy\Git\Repository $repository + * + * @return $this + */ public function setRepository(Repository $repository); } diff --git a/src/TaskRunner.php b/src/TaskRunner.php index 3da337a6..bc3d334f 100644 --- a/src/TaskRunner.php +++ b/src/TaskRunner.php @@ -170,13 +170,13 @@ private function createContainer(InputInterface $input, OutputInterface $output, // Add service inflectors. $container->inflector(ComposerAwareInterface::class) - ->invokeMethod('setComposer', ['task_runner.composer']); + ->invokeMethod('setComposer', ['task_runner.composer']); $container->inflector(TimeAwareInterface::class) - ->invokeMethod('setTime', ['task_runner.time']); + ->invokeMethod('setTime', ['task_runner.time']); $container->inflector(FilesystemAwareInterface::class) - ->invokeMethod('setFilesystem', ['filesystem']); + ->invokeMethod('setFilesystem', ['filesystem']); $container->inflector(RepositoryAwareInterface::class) - ->invokeMethod('setRepository', ['repository']); + ->invokeMethod('setRepository', ['repository']); return $container; } @@ -190,8 +190,8 @@ private function createApplication() { $application = new Application(self::APPLICATION_NAME, 'UNKNOWN'); $application - ->getDefinition() - ->addOption(new InputOption('--working-dir', null, InputOption::VALUE_REQUIRED, 'Working directory, defaults to current working directory.', $this->workingDir)); + ->getDefinition() + ->addOption(new InputOption('--working-dir', null, InputOption::VALUE_REQUIRED, 'Working directory, defaults to current working directory.', $this->workingDir)); return $application; } diff --git a/src/Tasks/CollectionFactory/CollectionFactory.php b/src/Tasks/CollectionFactory/CollectionFactory.php index db3cd9fe..ff430f20 100644 --- a/src/Tasks/CollectionFactory/CollectionFactory.php +++ b/src/Tasks/CollectionFactory/CollectionFactory.php @@ -165,9 +165,9 @@ protected function taskFactory($task) // Map dynamic task type to actual task callback. $map = [ - 'append' => "taskAppendConfiguration", - 'prepend' => "taskPrependConfiguration", - 'write' => "taskWriteConfiguration", + 'append' => "taskAppendConfiguration", + 'prepend' => "taskPrependConfiguration", + 'write' => "taskWriteConfiguration", ]; if (!isset($map[$task['type']])) { @@ -177,7 +177,7 @@ protected function taskFactory($task) // Add selected process task and return collection. $tasks[] = $this->{$method}($task['destination'], $this->getConfig()) - ->setConfigKey($task['config']); + ->setConfigKey($task['config']); return $this->collectionBuilder()->addTaskList($tasks); diff --git a/tests/Commands/ReleaseCommandsTest.php b/tests/Commands/ReleaseCommandsTest.php index ba932ba0..f84f28dd 100644 --- a/tests/Commands/ReleaseCommandsTest.php +++ b/tests/Commands/ReleaseCommandsTest.php @@ -121,23 +121,23 @@ protected function getRepositoryMock(array $repository) } $mock = $this->getMockBuilder(Repository::class) - ->disableOriginalConstructor() - ->setMethods([ - 'getHead', - 'getReferences', - 'resolveTags', - 'getBranches', - ]) - ->getMock(); + ->disableOriginalConstructor() + ->setMethods([ + 'getHead', + 'getReferences', + 'resolveTags', + 'getBranches', + ]) + ->getMock(); $head = $this->getMockBuilder(Commit::class) - ->disableOriginalConstructor() - ->setMethods([ - 'getCommit', - 'getRevision', - 'getHash', - ]) - ->getMock(); + ->disableOriginalConstructor() + ->setMethods([ + 'getCommit', + 'getRevision', + 'getHash', + ]) + ->getMock(); $head->expects($this->any())->method('getCommit')->willReturnSelf(); $head->expects($this->any())->method('getHash')->willReturn($repository['hash']); $head->expects($this->any())->method('getRevision')->willReturn($repository['revision']); diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index 1ebe1fd8..1a0a32c0 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -126,10 +126,10 @@ public function testCustomCommands() $runner->run(); $expected = [ - "custom:command-four", - "custom:command-one", - "custom:command-three", - "custom:command-two", + "custom:command-four", + "custom:command-one", + "custom:command-three", + "custom:command-two", ]; $text = $output->fetch(); @@ -195,8 +195,8 @@ function $fct() {} EOF; $config_override_filename = isset($config['drupal']['site']['settings_override_file']) ? - $config['drupal']['site']['settings_override_file'] : - 'settings.override.php'; + $config['drupal']['site']['settings_override_file'] : + 'settings.override.php'; // Add the dummy PHP code to the config override file. file_put_contents( @@ -246,8 +246,8 @@ function $fct() {} EOF; $config_override_filename = isset($config['drupal']['site']['settings_override_file']) ? - $config['drupal']['site']['settings_override_file'] : - 'settings.override.php'; + $config['drupal']['site']['settings_override_file'] : + 'settings.override.php'; // Add the dummy PHP code to the config override file. file_put_contents( @@ -301,8 +301,8 @@ function $fct() {} EOF; $config_override_filename = isset($config['drupal']['site']['settings_override_file']) ? - $config['drupal']['site']['settings_override_file'] : - 'settings.override.php'; + $config['drupal']['site']['settings_override_file'] : + 'settings.override.php'; // Add the dummy PHP code to the config override file. file_put_contents( diff --git a/tests/Tasks/CollectionFactoryTest.php b/tests/Tasks/CollectionFactoryTest.php index 290e374e..1ede1272 100644 --- a/tests/Tasks/CollectionFactoryTest.php +++ b/tests/Tasks/CollectionFactoryTest.php @@ -53,11 +53,11 @@ public function testProcessPhpTask($type, $override, $destinationExists, $source $tasks = []; $tasks[] = [ - 'task' => 'process-php', - 'config' => 'drupal.drush', - 'type' => $type, - 'source' => $sourceFile, - 'destination' => $destinationFile, + 'task' => 'process-php', + 'config' => 'drupal.drush', + 'type' => $type, + 'source' => $sourceFile, + 'destination' => $destinationFile, ]; // Make sure we test default override option by not setting it if null.