@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * Add a hook |
| 70 | 70 | * |
| 71 | - * @param mixed $callback The callback function to call |
|
| 71 | + * @param callable $callback The callback function to call |
|
| 72 | 72 | * @param string $hook The name of the hook to add |
| 73 | 73 | * @param string $name The name of the command to hook |
| 74 | 74 | * ('*' for all) |
@@ -82,12 +82,18 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | + /** |
|
| 86 | + * @param \Consolidation\AnnotatedCommand\Parser\CommandInfo $commandInfo |
|
| 87 | + */ |
|
| 85 | 88 | public function recordHookOptions($commandInfo, $name) |
| 86 | 89 | { |
| 87 | 90 | $this->hookOptions[$name][] = $commandInfo; |
| 88 | 91 | return $this; |
| 89 | 92 | } |
| 90 | 93 | |
| 94 | + /** |
|
| 95 | + * @param \Consolidation\AnnotatedCommand\AnnotatedCommand $command |
|
| 96 | + */ |
|
| 91 | 97 | public static function getNames($command, $callback) |
| 92 | 98 | { |
| 93 | 99 | return array_filter( |
@@ -324,6 +330,9 @@ discard block |
||
| 324 | 330 | return $this; |
| 325 | 331 | } |
| 326 | 332 | |
| 333 | + /** |
|
| 334 | + * @param Command $command |
|
| 335 | + */ |
|
| 327 | 336 | public function getHookOptionsForCommand($command) |
| 328 | 337 | { |
| 329 | 338 | $names = $this->addWildcardHooksToNames($command->getNames(), $command->getAnnotationData()); |
@@ -2,19 +2,12 @@ |
||
| 2 | 2 | namespace Consolidation\AnnotatedCommand\Hooks; |
| 3 | 3 | |
| 4 | 4 | use Symfony\Component\Console\Command\Command; |
| 5 | -use Symfony\Component\Console\Input\InputInterface; |
|
| 6 | -use Symfony\Component\Console\Output\OutputInterface; |
|
| 7 | - |
|
| 8 | 5 | use Symfony\Component\Console\ConsoleEvents; |
| 9 | 6 | use Symfony\Component\Console\Event\ConsoleCommandEvent; |
| 10 | 7 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
| 11 | 8 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
| 12 | 9 | use Symfony\Component\EventDispatcher\EventDispatcher; |
| 13 | - |
|
| 14 | -use Consolidation\AnnotatedCommand\ExitCodeInterface; |
|
| 15 | 10 | use Consolidation\AnnotatedCommand\OutputDataInterface; |
| 16 | -use Consolidation\AnnotatedCommand\AnnotationData; |
|
| 17 | -use Consolidation\AnnotatedCommand\CommandData; |
|
| 18 | 11 | use Consolidation\AnnotatedCommand\CommandError; |
| 19 | 12 | use Consolidation\AnnotatedCommand\Hooks\Dispatchers\CommandEventHookDispatcher; |
| 20 | 13 | use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy; |