@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $runner = new Reader($io, $config, $repo); |
| 38 | 38 | $runner->setHook('pre-commit') |
| 39 | - ->run(); |
|
| 39 | + ->run(); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testDoesNotAllowInvalidHookNames(): void |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $runner = new Reader($io, $config, $repo); |
| 51 | 51 | $runner->setHook('foo') |
| 52 | - ->run(); |
|
| 52 | + ->run(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function testItDisplaysOnlyActions(): void |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $runner = new Reader($io, $config, $repo); |
| 65 | 65 | $runner->setHook('pre-commit') |
| 66 | - ->display(Reader::OPT_ACTIONS, true) |
|
| 67 | - ->run(); |
|
| 66 | + ->display(Reader::OPT_ACTIONS, true) |
|
| 67 | + ->run(); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function testItDisplaysActionsAndConditions(): void |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | * @param bool $assoc |
| 32 | 32 | * @return \stdClass|array<string, mixed>|null |
| 33 | 33 | */ |
| 34 | - public function read(bool $assoc = false): array|stdClass|null |
|
| 34 | + public function read(bool $assoc = false): array | stdClass | null |
|
| 35 | 35 | { |
| 36 | 36 | $json = json_decode(parent::read(), $assoc); |
| 37 | 37 | if (json_last_error() !== JSON_ERROR_NONE) { |
@@ -142,9 +142,9 @@ |
||
| 142 | 142 | |
| 143 | 143 | // combine all the parts to create a new commit message |
| 144 | 144 | $msgText = $msgData[self::TARGET_SUBJECT] . PHP_EOL |
| 145 | - . PHP_EOL |
|
| 146 | - . $msgData[self::TARGET_BODY] . PHP_EOL |
|
| 147 | - . $msg->getComments(); |
|
| 145 | + . PHP_EOL |
|
| 146 | + . $msgData[self::TARGET_BODY] . PHP_EOL |
|
| 147 | + . $msg->getComments(); |
|
| 148 | 148 | |
| 149 | 149 | return new CommitMessage($msgText, $msg->getCommentCharacter()); |
| 150 | 150 | } |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | { |
| 163 | 163 | $issueID = preg_replace_callback( |
| 164 | 164 | '/\$(\d+)/', |
| 165 | - function ($matches) use ($issueID) { |
|
| 165 | + function($matches) use ($issueID) { |
|
| 166 | 166 | return $matches[1] === '1' ? $issueID : ''; |
| 167 | 167 | }, |
| 168 | 168 | $pattern |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $this->io->write('<info>Unstaged intent-to-add files detected.</info>'); |
| 121 | 121 | |
| 122 | 122 | $this->repository->getIndexOperator()->removeFiles( |
| 123 | - array_map(function (Path $path): string { |
|
| 123 | + array_map(function(Path $path): string { |
|
| 124 | 124 | return $path->getPath(); |
| 125 | 125 | }, $this->intentToAddFiles), |
| 126 | 126 | false, |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $this->repository->getIndexOperator()->recordIntentToAddFiles( |
| 144 | - array_map(function (Path $path): string { |
|
| 144 | + array_map(function(Path $path): string { |
|
| 145 | 145 | return $path->getPath(); |
| 146 | 146 | }, $this->intentToAddFiles) |
| 147 | 147 | ); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | // At this point, the working tree should be pristine, so the |
| 203 | 203 | // patch should cleanly apply. |
| 204 | - $this->applyPatch((string)$this->unstagedPatchFile); |
|
| 204 | + $this->applyPatch((string) $this->unstagedPatchFile); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | $this->io->write("<info>Restored changes from {$this->unstagedPatchFile}.</info>"); |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | // if a hook is configured and no force option is set, |
| 229 | 229 | // ask the user if overwriting the hook is ok |
| 230 | 230 | if ($this->needConfirmation($hook)) { |
| 231 | - $ans = $this->io->ask( |
|
| 231 | + $ans = $this->io->ask( |
|
| 232 | 232 | 'The <comment>' . $hook . '</comment> hook exists! Overwrite? <comment>[y,N]</comment> ', |
| 233 | 233 | 'n' |
| 234 | 234 | ); |
@@ -140,6 +140,6 @@ |
||
| 140 | 140 | if (!$this->isLink()) { |
| 141 | 141 | throw new RuntimeException('Not a symbolic link: ' . $this->path); |
| 142 | 142 | } |
| 143 | - return (string)readlink($this->path); |
|
| 143 | + return (string) readlink($this->path); |
|
| 144 | 144 | } |
| 145 | 145 | } |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | $template = $this->createTemplateMock(); |
| 163 | 163 | |
| 164 | 164 | $template->expects($this->once()) |
| 165 | - ->method('getCode') |
|
| 166 | - ->with('pre-commit') |
|
| 167 | - ->willReturn(''); |
|
| 165 | + ->method('getCode') |
|
| 166 | + ->with('pre-commit') |
|
| 167 | + ->willReturn(''); |
|
| 168 | 168 | |
| 169 | 169 | $runner = new Installer($io, $config, $repo, $template); |
| 170 | 170 | $runner->setHook('pre-commit'); |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | $template = $this->createTemplateMock(); |
| 185 | 185 | |
| 186 | 186 | $file = $this->getMockBuilder(File::class) |
| 187 | - ->disableOriginalConstructor() |
|
| 188 | - ->getMock(); |
|
| 187 | + ->disableOriginalConstructor() |
|
| 188 | + ->getMock(); |
|
| 189 | 189 | |
| 190 | 190 | $runner = new FakeInstaller($io, $config, $repo, $template); |
| 191 | 191 | $file->method('isLink')->willReturn(true); |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | $template = $this->createTemplateMock(); |
| 209 | 209 | |
| 210 | 210 | $file = $this->getMockBuilder(File::class) |
| 211 | - ->disableOriginalConstructor() |
|
| 212 | - ->getMock(); |
|
| 211 | + ->disableOriginalConstructor() |
|
| 212 | + ->getMock(); |
|
| 213 | 213 | |
| 214 | 214 | $runner = new FakeInstaller($io, $config, $repo, $template); |
| 215 | 215 | $file->method('isLink')->willReturn(true); |
@@ -265,14 +265,14 @@ discard block |
||
| 265 | 265 | $repo = new Repository($fakeRepo->getRoot()); |
| 266 | 266 | |
| 267 | 267 | $template->expects($this->once()) |
| 268 | - ->method('getCode') |
|
| 269 | - ->with('pre-commit') |
|
| 270 | - ->willReturn(''); |
|
| 268 | + ->method('getCode') |
|
| 269 | + ->with('pre-commit') |
|
| 270 | + ->willReturn(''); |
|
| 271 | 271 | |
| 272 | 272 | $runner = new Installer($io, $config, $repo, $template); |
| 273 | 273 | $runner->setHook('pre-commit') |
| 274 | - ->setMoveExistingTo('foo/bar/') |
|
| 275 | - ->run(); |
|
| 274 | + ->setMoveExistingTo('foo/bar/') |
|
| 275 | + ->run(); |
|
| 276 | 276 | |
| 277 | 277 | $this->assertFileExists($fakeRepo->getHookDir() . '/pre-commit'); |
| 278 | 278 | $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/pre-commit'); |
@@ -303,14 +303,14 @@ discard block |
||
| 303 | 303 | $repo = new Repository($fakeRepo->getRoot()); |
| 304 | 304 | |
| 305 | 305 | $template->expects($this->once()) |
| 306 | - ->method('getCode') |
|
| 307 | - ->with('pre-commit') |
|
| 308 | - ->willReturn(''); |
|
| 306 | + ->method('getCode') |
|
| 307 | + ->with('pre-commit') |
|
| 308 | + ->willReturn(''); |
|
| 309 | 309 | |
| 310 | 310 | $runner = new Installer($io, $config, $repo, $template); |
| 311 | 311 | $runner->setHook('pre-commit') |
| 312 | - ->setMoveExistingTo('foo/bar/') |
|
| 313 | - ->run(); |
|
| 312 | + ->setMoveExistingTo('foo/bar/') |
|
| 313 | + ->run(); |
|
| 314 | 314 | |
| 315 | 315 | $this->assertFileExists($fakeRepo->getHookDir() . '/pre-commit'); |
| 316 | 316 | } |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | $runner = new Installer($io, $config, $repo, $template); |
| 346 | 346 | $runner->setHook('pre-commit') |
| 347 | - ->setMoveExistingTo('foo') |
|
| 348 | - ->run(); |
|
| 347 | + ->setMoveExistingTo('foo') |
|
| 348 | + ->run(); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | public function createResolverMock(string $executable = 'vendor/bin/captainhook', bool $isPhar = false): Resolver |
| 34 | 34 | { |
| 35 | 35 | $repo = $this->getMockBuilder(Resolver::class) |
| 36 | - ->disableOriginalConstructor() |
|
| 37 | - ->getMock(); |
|
| 36 | + ->disableOriginalConstructor() |
|
| 37 | + ->getMock(); |
|
| 38 | 38 | |
| 39 | 39 | $repo->method('getExecutable')->willReturn($executable); |
| 40 | 40 | $repo->method('isPharRelease')->willReturn($isPhar); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | |
| 54 | 54 | $repo = $this->getMockBuilder(Repository::class) |
| 55 | - ->disableOriginalConstructor() |
|
| 56 | - ->getMock(); |
|
| 55 | + ->disableOriginalConstructor() |
|
| 56 | + ->getMock(); |
|
| 57 | 57 | |
| 58 | 58 | $repo->method('getRoot')->willReturn($root); |
| 59 | 59 | $repo->method('getHooksDir')->willReturn(empty($hooksDir) ? $root . '/.git/hooks' : $hooksDir); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | public function createGitInfoOperator(string $tag = 'v1.0.0', string $branch = 'master'): Info |
| 72 | 72 | { |
| 73 | 73 | $operator = $this->getMockBuilder(Info::class) |
| 74 | - ->disableOriginalConstructor() |
|
| 75 | - ->getMock(); |
|
| 74 | + ->disableOriginalConstructor() |
|
| 75 | + ->getMock(); |
|
| 76 | 76 | |
| 77 | 77 | $operator->method('getCurrentTag')->willReturn($tag); |
| 78 | 78 | $operator->method('getCurrentBranch')->willReturn($branch); |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | public function createGitDiffOperator(array $changedFiles = []): Diff |
| 90 | 90 | { |
| 91 | 91 | $operator = $this->getMockBuilder(Diff::class) |
| 92 | - ->disableOriginalConstructor() |
|
| 93 | - ->getMock(); |
|
| 92 | + ->disableOriginalConstructor() |
|
| 93 | + ->getMock(); |
|
| 94 | 94 | |
| 95 | 95 | $operator->method('getChangedFiles')->willReturn($changedFiles); |
| 96 | 96 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | public function createGitIndexOperator(array $stagedFiles = []): Index |
| 133 | 133 | { |
| 134 | 134 | $operator = $this->getMockBuilder(Index::class) |
| 135 | - ->disableOriginalConstructor() |
|
| 136 | - ->getMock(); |
|
| 135 | + ->disableOriginalConstructor() |
|
| 136 | + ->getMock(); |
|
| 137 | 137 | |
| 138 | 138 | $operator->method('getStagedFiles')->willReturn($stagedFiles); |
| 139 | 139 | |
@@ -52,8 +52,8 @@ |
||
| 52 | 52 | $config = '/foo/bar/fiz/baz/config.json'; |
| 53 | 53 | $input = new ArrayInput(['--configuration' => $config]); |
| 54 | 54 | $output = $this->getMockBuilder(OutputInterface::class) |
| 55 | - ->disableOriginalConstructor() |
|
| 56 | - ->getMock(); |
|
| 55 | + ->disableOriginalConstructor() |
|
| 56 | + ->getMock(); |
|
| 57 | 57 | $output->method('isVerbose')->willReturn(true); |
| 58 | 58 | |
| 59 | 59 | $configure = new Configuration($resolver); |