Skip to content

Commit

Permalink
update rector
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 4, 2020
1 parent bc14ddb commit c44fd80
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -21,7 +21,7 @@
"phpstan/phpstan": "^0.12.18",
"symplify/changelog-linker": "^8.3",
"symplify/phpstan-extensions": "^8.3",
"rector/rector": "^0.7.10",
"rector/rector": "^0.8.10",
"tracy/tracy": "^2.7",
"phpstan/phpstan-phpunit": "^0.12",
"migrify/config-transformer": "^0.3.48"
Expand Down
5 changes: 5 additions & 0 deletions rector-ci.php
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

Expand All @@ -22,4 +23,8 @@
SetList::PHP_71,
SetList::PHP_72,
]);

$parameters->set(Option::SKIP, [
PrivatizeFinalClassMethodRector::class => [__DIR__ . '/tests/GitWorkingCopyTest.php'],
]);
};
2 changes: 1 addition & 1 deletion src/EventSubscriber/StreamOutputEventSubscriber.php
Expand Up @@ -15,6 +15,6 @@ final class StreamOutputEventSubscriber extends AbstractOutputEventSubscriber
public function handleOutput(GitOutputEvent $gitOutputEvent): void
{
$handler = $gitOutputEvent->isError() ? STDERR : STDOUT;
fputs($handler, $gitOutputEvent->getBuffer());
fwrite($handler, $gitOutputEvent->getBuffer());
}
}
4 changes: 3 additions & 1 deletion src/GitBranches.php
Expand Up @@ -42,7 +42,9 @@ public function fetchBranches(bool $onlyRemote = false): array
];
$output = $this->gitWorkingCopy->branch($options);
$branches = (array) Strings::split(rtrim($output), "/\r\n|\n|\r/");
return array_map([$this, 'trimBranch'], $branches);
return array_map(function (string $branch): string {
return $this->trimBranch($branch);
}, $branches);
}

public function trimBranch(string $branch): string
Expand Down
4 changes: 3 additions & 1 deletion src/GitTags.php
Expand Up @@ -34,7 +34,9 @@ public function fetchTags(): array
'l' => true,
]);
$tags = (array) Strings::split(rtrim($output), "/\r\n|\n|\r/");
return array_map([$this, 'trimTags'], $tags);
return array_map(function (string $branch): string {
return $this->trimTags($branch);
}, $tags);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/GitWorkingCopyTest.php
Expand Up @@ -817,7 +817,7 @@ protected function assertNoRemoteBranch(GitWorkingCopy $gitWorkingCopy, string $
$this->assertArrayNotHasKey($branch, array_flip($branches));
}

protected function createRemote(): void
private function createRemote(): void
{
// Create a clone of the working copy that will serve as a remote.
$git = $this->gitWrapper->cloneRepository('file://' . realpath(self::REPO_DIR), self::REMOTE_REPO_DIR);
Expand Down
1 change: 1 addition & 0 deletions tests/GitWrapperTest.php
Expand Up @@ -149,6 +149,7 @@ public function testGitRunDirectoryError(): void
$command = new GitCommand();
$command->setFlag('version');
$command->setDirectory('/some/bad/directory');

$this->gitWrapper->run($command);
}

Expand Down

0 comments on commit c44fd80

Please sign in to comment.