Skip to content

Commit 36b9b04

Browse files
Changed order of constructor arguments for command since run configuration is probably the one that will be set the least
Signed-off-by: Bastian Schwarz <bastian@codename-php.de>
1 parent b2faa16 commit 36b9b04

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ final class Command implements iCommand {
2727

2828
/**
2929
* @param string $binary The binary to be executed, e.g. ls or composer
30-
* @param iRunConfiguration $runConfiguration The run configuration to use when running the command
3130
* @param array<string> $arguments Arguments to use when running the command, e.g. '-l', 'install', '--composer', '--name=value'
3231
* @param array<string,string> $envVars Env vars to set when running the command. They will be prepended to the binary with the key as name
3332
* @param bool $sudo Flag to run the command with sudo
33+
* @param iRunConfiguration $runConfiguration The run configuration to use when running the command
3434
*/
3535
public function __construct(
3636
public string $binary,
37-
public iRunConfiguration $runConfiguration = new SimpleContainer(),
3837
public array $arguments = [],
3938
public array $envVars = [],
4039
public bool $sudo = false,
40+
public iRunConfiguration $runConfiguration = new SimpleContainer(),
4141
) {}
4242

4343
public function getRunConfiguration() : iRunConfiguration {

test/CommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public function test__construct() : void {
3737
$arguments = ['test', '--test'];
3838
$envVars = ['some' => 'env'];
3939

40-
$this->sut = new Command($binary, $runConfiguration, $arguments, $envVars, true);
40+
$this->sut = new Command($binary, $arguments, $envVars, true, $runConfiguration);
4141

4242
self::assertSame($binary, $this->sut->binary);
43-
self::assertSame($runConfiguration, $this->sut->runConfiguration);
4443
self::assertSame($arguments, $this->sut->arguments);
4544
self::assertSame($envVars, $this->sut->envVars);
4645
self::assertTrue($this->sut->sudo);
46+
self::assertSame($runConfiguration, $this->sut->runConfiguration);
4747
}
4848

4949
public function test__toString() : void {

0 commit comments

Comments
 (0)