Skip to content

Commit

Permalink
[cs] apply
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 4, 2020
1 parent a77f44a commit bc14ddb
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ecs.yaml
Expand Up @@ -17,5 +17,5 @@ jobs:
php-version: 7.3
coverage: none

- run: composer install --no-progress
- run: composer check-cs
- run: composer install --no-progress --ansi
- run: composer check-cs --ansi
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yaml
Expand Up @@ -16,5 +16,5 @@ jobs:
php-version: 7.3
coverage: none

- run: composer install --no-progress
- run: composer phpstan
- run: composer install --no-progress --ansi
- run: composer phpstan --ansi
4 changes: 2 additions & 2 deletions .github/workflows/rector.yaml
Expand Up @@ -17,5 +17,5 @@ jobs:
php-version: 7.3
coverage: none

- run: composer install --no-progress
- run: composer rector
- run: composer install --no-progress --ansi
- run: composer rector --ansi
2 changes: 0 additions & 2 deletions changelog-linker.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -44,6 +44,6 @@
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --error-format symplify --ansi",
"changelog": "vendor/bin/changelog-linker dump-merges --in-categories --ansi",
"rector": "vendor/bin/rector process --config rector-ci.yaml --dry-run --ansi"
"rector": "vendor/bin/rector process --config rector-ci.php --dry-run --ansi"
}
}
30 changes: 0 additions & 30 deletions ecs.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions rector-ci.yaml

This file was deleted.

1 change: 1 addition & 0 deletions src/Event/GitOutputEvent.php
Expand Up @@ -31,6 +31,7 @@ public function __construct(
string $buffer
) {
parent::__construct($gitWrapper, $process, $gitCommand);

$this->type = $type;
$this->buffer = $buffer;
}
Expand Down
7 changes: 5 additions & 2 deletions src/EventSubscriber/GitLoggerEventSubscriber.php
Expand Up @@ -89,7 +89,8 @@ public function log(AbstractGitEvent $gitEvent, string $message, array $context
{
$method = $this->getLogLevelMapping(get_class($gitEvent));
$context += [
'command' => $gitEvent->getProcess()->getCommandLine(),
'command' => $gitEvent->getProcess()
->getCommandLine(),
];

$this->logger->{$method}($message, $context);
Expand All @@ -102,7 +103,9 @@ public function onPrepare(GitPrepareEvent $gitPrepareEvent): void

public function handleOutput(GitOutputEvent $gitOutputEvent): void
{
$context = ['error' => $gitOutputEvent->isError()];
$context = [
'error' => $gitOutputEvent->isError(),
];
$this->log($gitOutputEvent, $gitOutputEvent->getBuffer(), $context);
}

Expand Down
10 changes: 8 additions & 2 deletions src/GitBranches.php
Expand Up @@ -21,7 +21,9 @@ final class GitBranches implements IteratorAggregate
public function __construct(GitWorkingCopy $gitWorkingCopy)
{
$this->gitWorkingCopy = clone $gitWorkingCopy;
$gitWorkingCopy->branch(['a' => true]);
$gitWorkingCopy->branch([
'a' => true,
]);
}

/**
Expand All @@ -33,7 +35,11 @@ public function __construct(GitWorkingCopy $gitWorkingCopy)
*/
public function fetchBranches(bool $onlyRemote = false): array
{
$options = $onlyRemote ? ['r' => true] : ['a' => true];
$options = $onlyRemote ? [
'r' => true,
] : [
'a' => true,
];
$output = $this->gitWorkingCopy->branch($options);
$branches = (array) Strings::split(rtrim($output), "/\r\n|\n|\r/");
return array_map([$this, 'trimBranch'], $branches);
Expand Down
4 changes: 3 additions & 1 deletion src/GitTags.php
Expand Up @@ -30,7 +30,9 @@ public function __construct(GitWorkingCopy $gitWorkingCopy)
*/
public function fetchTags(): array
{
$output = $this->gitWorkingCopy->tag(['l' => true]);
$output = $this->gitWorkingCopy->tag([
'l' => true,
]);
$tags = (array) Strings::split(rtrim($output), "/\r\n|\n|\r/");
return array_map([$this, 'trimTags'], $tags);
}
Expand Down
4 changes: 2 additions & 2 deletions src/GitWorkingCopy.php
Expand Up @@ -436,7 +436,7 @@ public function cloneRepository(string $repository, array $options = []): string
}

/**
* Record changes to the repository. If only one argument is passed, it is assumed to be the commit message.
* Record changes to the repository. If only one argument is passed, it is assumed to be the commit message.
* Therefore `$git->commit('Message');` yields a `git commit -am "Message"` command.
*
* @code $git->commit('My commit message');
Expand Down Expand Up @@ -661,7 +661,7 @@ public function archive(...$argsAndOptions): string

/**
* @api
* Returns a GitTags object containing information on the repository's tags.
* Returns a GitTags object containing information on the repository's tags.
*/
public function tags(): GitTags
{
Expand Down
3 changes: 2 additions & 1 deletion src/Process/GitProcess.php
Expand Up @@ -121,6 +121,7 @@ private function resolveWorkingDirectory(?string $cwd, GitCommand $gitCommand):

private function dispatchEvent(Event $event): void
{
$this->gitWrapper->getDispatcher()->dispatch($event);
$this->gitWrapper->getDispatcher()
->dispatch($event);
}
}
3 changes: 2 additions & 1 deletion tests/Event/TestBypassEventSubscriber.php
Expand Up @@ -21,6 +21,7 @@ public static function getSubscribedEvents(): array

public function onPrepare(GitPrepareEvent $gitPrepareEvent): void
{
$gitPrepareEvent->getCommand()->bypass();
$gitPrepareEvent->getCommand()
->bypass();
}
}
8 changes: 6 additions & 2 deletions tests/EventSubscriber/GitLoggerEventSubscriberTest.php
Expand Up @@ -44,7 +44,9 @@ public function testRegisterLogger(): void
{
$logger = new TestLogger();
$this->gitWrapper->addLoggerEventSubscriber(new GitLoggerEventSubscriber($logger));
$git = $this->gitWrapper->init(self::REPO_DIR, ['bare' => true]);
$git = $this->gitWrapper->init(self::REPO_DIR, [
'bare' => true,
]);

$this->assertSame('Git command preparing to run', $logger->messages[0]);
$this->assertSame(
Expand Down Expand Up @@ -79,7 +81,9 @@ public function testLogBypassedCommand(): void
$logger = new TestLogger();
$this->gitWrapper->addLoggerEventSubscriber(new GitLoggerEventSubscriber($logger));

$command = new GitCommand('status', ['s' => true]);
$command = new GitCommand('status', [
's' => true,
]);
$command->bypass();

$this->gitWrapper->run($command);
Expand Down

0 comments on commit bc14ddb

Please sign in to comment.