@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | |
79 | 79 | // every action has to get executed |
80 | 80 | $actionConfigFail->expects($this->atLeastOnce()) |
81 | - ->method('getAction') |
|
82 | - ->willReturn(CH_PATH_FILES . '/bin/failure'); |
|
81 | + ->method('getAction') |
|
82 | + ->willReturn(CH_PATH_FILES . '/bin/failure'); |
|
83 | 83 | |
84 | 84 | // so even if the first actions fails this action has to get executed |
85 | 85 | $actionConfigSuccess->expects($this->atLeastOnce()) |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | |
89 | 89 | $hookConfig->method('isEnabled')->willReturn(true); |
90 | 90 | $hookConfig->expects($this->once()) |
91 | - ->method('getActions') |
|
92 | - ->willReturn([$actionConfigFail, $actionConfigSuccess]); |
|
91 | + ->method('getActions') |
|
92 | + ->willReturn([$actionConfigFail, $actionConfigSuccess]); |
|
93 | 93 | |
94 | 94 | $config->expects($this->once())->method('getHookConfigToExecute')->willReturn($hookConfig); |
95 | 95 | $config->method('isHookEnabled')->willReturn(true); |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | $hookConfig->method('isEnabled')->willReturn(true); |
127 | 127 | $hookConfig->expects($this->once()) |
128 | - ->method('getActions') |
|
129 | - ->willReturn([$actionConfigFail, $actionConfigSuccess]); |
|
128 | + ->method('getActions') |
|
129 | + ->willReturn([$actionConfigFail, $actionConfigSuccess]); |
|
130 | 130 | |
131 | 131 | $config->expects($this->once())->method('getHookConfigToExecute')->willReturn($hookConfig); |
132 | 132 | $config->expects($this->atLeastOnce())->method('isHookEnabled')->willReturn(true); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $command = $io->getArgument(Hooks::ARG_COMMAND); |
51 | 51 | |
52 | 52 | /** @var \CaptainHook\App\Git\ChangedFiles\Detecting $class */ |
53 | - $class = self::$detectors[$command] ?? '\\CaptainHook\\App\\Git\\ChangedFiles\\Detector\\Fallback'; |
|
53 | + $class = self::$detectors[$command] ?? '\\CaptainHook\\App\\Git\\ChangedFiles\\Detector\\Fallback'; |
|
54 | 54 | return new $class($io, $repository); |
55 | 55 | } |
56 | 56 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | $io = $this->createIOMock(); |
46 | 46 | $io->method('getArgument')->willReturn('hook:pre-push'); |
47 | 47 | $io->expects($this->atLeastOnce()) |
48 | - ->method('getStandardInput') |
|
49 | - ->willReturn( |
|
50 | - [ |
|
51 | - 'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' . |
|
52 | - ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8' |
|
53 | - ] |
|
54 | - ); |
|
48 | + ->method('getStandardInput') |
|
49 | + ->willReturn( |
|
50 | + [ |
|
51 | + 'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' . |
|
52 | + ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8' |
|
53 | + ] |
|
54 | + ); |
|
55 | 55 | $operator = $this->createGitDiffOperator(['fiz.php', 'foo.txt']); |
56 | 56 | $repository = $this->createRepositoryMock(''); |
57 | 57 | $repository->expects($this->once())->method('getDiffOperator')->willReturn($operator); |
@@ -81,7 +81,7 @@ |
||
81 | 81 | '<fg=red>Warning: Hook script is out of date</>', |
82 | 82 | 'The git hook script needs to be updated.', |
83 | 83 | 'Required version is <info>' . CH::MIN_REQ_INSTALLER . '</info>' |
84 | - . ' found <fg=red>' . $installerVersion . '</>.', |
|
84 | + . ' found <fg=red>' . $installerVersion . '</>.', |
|
85 | 85 | 'Please re-install your hook by running:', |
86 | 86 | ' <comment>captainhook install ' . $this->hook . '</comment>', |
87 | 87 | '', |
@@ -59,7 +59,7 @@ |
||
59 | 59 | */ |
60 | 60 | public function handle(Event $event): void |
61 | 61 | { |
62 | - if (!IOUtil::answerToBool($event->io()->ask(PHP_EOL . $this->question . ' ', $this->default ? 'y' : 'n'))) { |
|
62 | + if (!IOUtil::answerToBool($event->io()->ask(PHP_EOL . $this->question . ' ', $this->default ? 'y' : 'n'))) { |
|
63 | 63 | throw new ActionFailed('no confirmation, abort!'); |
64 | 64 | } |
65 | 65 | } |
@@ -166,7 +166,7 @@ |
||
166 | 166 | $repo = new Repository($fakeRepo->getRoot()); |
167 | 167 | |
168 | 168 | $config->method('isHookEnabled')->willReturnCallback( |
169 | - function (string $hook): bool { |
|
169 | + function(string $hook): bool { |
|
170 | 170 | return $hook === 'pre-push'; |
171 | 171 | } |
172 | 172 | ); |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | |
177 | 177 | $runner = new Uninstaller($io, $config, $repo); |
178 | 178 | $runner->setHook('post-merge') |
179 | - ->setMoveExistingTo('foo/bar/') |
|
180 | - ->run(); |
|
179 | + ->setMoveExistingTo('foo/bar/') |
|
180 | + ->run(); |
|
181 | 181 | |
182 | 182 | $this->assertFileDoesNotExist($fakeRepo->getHookDir() . '/post-merge'); |
183 | 183 | $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/post-merge'); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | |
209 | 209 | $runner = new Uninstaller($io, $config, $repo); |
210 | 210 | $runner->setHook('pre-commit') |
211 | - ->setMoveExistingTo('foo') |
|
212 | - ->run(); |
|
211 | + ->setMoveExistingTo('foo') |
|
212 | + ->run(); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | public function testMoveExistingHookWhenMoveExistingIsAnAbsolutePath(): void |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | |
238 | 238 | $runner = new Uninstaller($io, $config, $repo); |
239 | 239 | $runner->setHook('pre-commit') |
240 | - ->setMoveExistingTo($virtualFs->url() . '/foo/bar') |
|
241 | - ->run(); |
|
240 | + ->setMoveExistingTo($virtualFs->url() . '/foo/bar') |
|
241 | + ->run(); |
|
242 | 242 | |
243 | 243 | $this->assertFileDoesNotExist($fakeRepo->getHookDir() . '/pre-commit'); |
244 | 244 | $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/pre-commit'); |
@@ -37,32 +37,32 @@ |
||
37 | 37 | { |
38 | 38 | parent::configure(); |
39 | 39 | $this->setName('uninstall') |
40 | - ->setDescription('Remove all git hooks from your .git/hooks directory') |
|
41 | - ->setHelp('Remove all git hooks from your .git/hooks directory') |
|
42 | - ->addArgument( |
|
43 | - 'hook', |
|
44 | - InputArgument::OPTIONAL, |
|
45 | - 'Remove only this one hook. By default all hooks get uninstalled' |
|
46 | - ) |
|
47 | - ->addOption( |
|
48 | - 'force', |
|
49 | - 'f', |
|
50 | - InputOption::VALUE_NONE, |
|
51 | - 'Force install without confirmation' |
|
52 | - ) |
|
53 | - ->addOption( |
|
54 | - 'only-disabled', |
|
55 | - null, |
|
56 | - InputOption::VALUE_NONE, |
|
57 | - 'Limit the hooks you want to remove to those that are not enabled in your conf. ' . |
|
58 | - 'By default all hooks get uninstalled' |
|
59 | - ) |
|
60 | - ->addOption( |
|
61 | - 'move-existing-to', |
|
62 | - null, |
|
63 | - InputOption::VALUE_OPTIONAL, |
|
64 | - 'Move existing hooks to this directory' |
|
65 | - ); |
|
40 | + ->setDescription('Remove all git hooks from your .git/hooks directory') |
|
41 | + ->setHelp('Remove all git hooks from your .git/hooks directory') |
|
42 | + ->addArgument( |
|
43 | + 'hook', |
|
44 | + InputArgument::OPTIONAL, |
|
45 | + 'Remove only this one hook. By default all hooks get uninstalled' |
|
46 | + ) |
|
47 | + ->addOption( |
|
48 | + 'force', |
|
49 | + 'f', |
|
50 | + InputOption::VALUE_NONE, |
|
51 | + 'Force install without confirmation' |
|
52 | + ) |
|
53 | + ->addOption( |
|
54 | + 'only-disabled', |
|
55 | + null, |
|
56 | + InputOption::VALUE_NONE, |
|
57 | + 'Limit the hooks you want to remove to those that are not enabled in your conf. ' . |
|
58 | + 'By default all hooks get uninstalled' |
|
59 | + ) |
|
60 | + ->addOption( |
|
61 | + 'move-existing-to', |
|
62 | + null, |
|
63 | + InputOption::VALUE_OPTIONAL, |
|
64 | + 'Move existing hooks to this directory' |
|
65 | + ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ); |
82 | 82 | |
83 | 83 | if (IOUtil::answerToBool($answer)) { |
84 | - $call = '\\CaptainHook' . '\\App' . '\\Hook\\PHP\\Action\\Linting'; |
|
84 | + $call = '\\CaptainHook' . '\\App' . '\\Hook\\PHP\\Action\\Linting'; |
|
85 | 85 | $config->addAction(new Config\Action($call)); |
86 | 86 | } |
87 | 87 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | |
126 | 126 | if (IOUtil::answerToBool($answer)) { |
127 | - $call = $this->io->ask( |
|
127 | + $call = $this->io->ask( |
|
128 | 128 | ' <info>Enter the phpcs command you want to execute.</info> ' |
129 | 129 | . '<comment>[phpcs --standard=psr2 src]</comment> ', |
130 | 130 | 'phpcs --standard=psr2 src' |
@@ -109,7 +109,7 @@ |
||
109 | 109 | |
110 | 110 | $executableInclude = substr($executablePath, 0, 1) == '/' |
111 | 111 | ? '\'' . $executablePath . '\'' |
112 | - : '__DIR__ . \'/../../' . $executablePath . '\''; |
|
112 | + : '__DIR__ . \'/../../' . $executablePath . '\''; |
|
113 | 113 | |
114 | 114 | $bootstrapOption = $this->getBootstrapCmdOption(); |
115 | 115 | $bootstrapOptionQuoted = empty($bootstrapOption) ? '' : ' \'' . $bootstrapOption . '\','; |