@@ -44,28 +44,28 @@ abstract class Hook extends RepositoryAware
44
44
*
45
45
* @var bool
46
46
*/
47
- private $ skipActions = false ;
47
+ private bool $ skipActions = false ;
48
48
49
49
/**
50
50
* Event dispatcher
51
51
*
52
52
* @var \CaptainHook\App\Event\Dispatcher
53
53
*/
54
- protected $ dispatcher ;
54
+ protected Dispatcher $ dispatcher ;
55
55
56
56
/**
57
57
* List of error messages to display after all action have finished
58
58
*
59
59
* @var array<\Exception>
60
60
*/
61
- protected $ errors = [];
61
+ protected array $ errors = [];
62
62
63
63
/**
64
64
* Plugins to apply to this hook
65
65
*
66
66
* @var array<Plugin\Hook>|null
67
67
*/
68
- private $ hookPlugins = null ;
68
+ private ? array $ hookPlugins = null ;
69
69
70
70
public function __construct (IO $ io , Config $ config , Repository $ repository )
71
71
{
@@ -245,7 +245,6 @@ private function executeActions(array $actions): void
245
245
} else {
246
246
$ this ->executeFailAfterAllActions ($ actions );
247
247
}
248
- $ this ->io ->write ($ this ->formatCollectedErrors ());
249
248
} catch (Exception $ e ) {
250
249
$ this ->dispatcher ->dispatch ('onHookFailure ' );
251
250
throw $ e ;
@@ -288,7 +287,7 @@ private function executeFailAfterAllActions(array $actions): void
288
287
289
288
if ($ failedActions > 0 ) {
290
289
throw new ActionFailed (
291
- ' <error> ' . $ failedActions . ' action ' . ($ failedActions > 1 ? 's ' : '' ) . ' failed</error> '
290
+ $ failedActions . ' action ' . ($ failedActions > 1 ? 's ' : '' ) . ' failed '
292
291
. PHP_EOL
293
292
. $ this ->formatCollectedErrors ()
294
293
);
@@ -312,7 +311,10 @@ private function handleAction(Config\Action $action): void
312
311
return ;
313
312
}
314
313
315
- $ this ->io ->write (' - <fg=blue> ' . $ this ->formatActionOutput ($ action ->getAction ()) . '</> : ' , false );
314
+ $ this ->io ->write (
315
+ ' - <fg=blue> ' . $ this ->formatActionOutput ($ action ->getAction ()) . '</> : ' ,
316
+ $ this ->io ->isVerbose ()
317
+ );
316
318
317
319
if (!$ this ->doConditionsApply ($ action ->getConditions ())) {
318
320
$ this ->io ->write ('<comment>skipped</comment> ' , true );
@@ -476,8 +478,7 @@ private function executeHookPluginsFor(string $method, ?Config\Action $action =
476
478
$ plugins = $ this ->getHookPlugins ();
477
479
478
480
if (count ($ plugins ) === 0 ) {
479
- $ this ->io ->write (['' , 'No plugins to execute for: <comment> ' . $ method . '</comment> ' ], true , IO ::DEBUG );
480
-
481
+ $ this ->io ->write (['No plugins to execute for: <comment> ' . $ method . '</comment> ' ], true , IO ::DEBUG );
481
482
return ;
482
483
}
483
484
@@ -487,7 +488,7 @@ private function executeHookPluginsFor(string $method, ?Config\Action $action =
487
488
$ params [] = $ action ;
488
489
}
489
490
490
- $ this ->io ->write (['' , ' Executing plugins for: <comment> ' . $ method . '</comment> ' ], true , IO ::DEBUG );
491
+ $ this ->io ->write (['Executing plugins for: <comment> ' . $ method . '</comment> ' ], true , IO ::DEBUG );
491
492
492
493
foreach ($ plugins as $ plugin ) {
493
494
$ this ->io ->write ('<info>- Running ' . get_class ($ plugin ) . ':: ' . $ method . '</info> ' , true , IO ::DEBUG );
0 commit comments