|
13 | 13 |
|
14 | 14 | namespace Webmozarts\Console\Parallelization;
|
15 | 15 |
|
16 |
| -use Closure; |
17 | 16 | use Symfony\Bundle\FrameworkBundle\Console\Application as FrameworkBundleApplication;
|
18 | 17 | use Symfony\Component\Console\Command\Command;
|
19 | 18 | use Symfony\Component\Console\Input\InputDefinition;
|
|
30 | 29 | use Webmozarts\Console\Parallelization\Logger\DebugProgressBarFactory;
|
31 | 30 | use Webmozarts\Console\Parallelization\Logger\Logger;
|
32 | 31 | use Webmozarts\Console\Parallelization\Logger\StandardLogger;
|
| 32 | +use function func_get_args; |
33 | 33 |
|
34 | 34 | abstract class ParallelCommand extends Command
|
35 | 35 | {
|
36 |
| - use Parallelization; |
37 |
| - // TODO: simply add the Parallelization trait for 3.x where all the BC |
38 |
| - // layer of the trait is removed. |
39 |
| - |
40 | 36 | protected function configure(): void
|
41 | 37 | {
|
42 | 38 | ParallelizationInput::configureCommand($this);
|
@@ -125,14 +121,15 @@ protected function getParallelExecutableFactory(
|
125 | 121 | InputDefinition $commandDefinition,
|
126 | 122 | ErrorHandler $errorHandler
|
127 | 123 | ): ParallelExecutorFactory {
|
128 |
| - return ParallelExecutorFactory::create( |
129 |
| - Closure::fromCallable($fetchItems), |
130 |
| - Closure::fromCallable($runSingleCommand), |
131 |
| - Closure::fromCallable($getItemName), |
132 |
| - $commandName, |
133 |
| - $commandDefinition, |
134 |
| - $errorHandler, |
135 |
| - ); |
| 124 | + // If you are looking at this code to wonder if you should call it when |
| 125 | + // overriding this method, it is highly recommended you don't and just |
| 126 | + // call `ParallelExecutorFactory::create(...func_get_args())`. |
| 127 | + // |
| 128 | + // Configuring the factory is recommended to be done in |
| 129 | + // ::configureParallelExecutableFactory() instead which is |
| 130 | + // simpler to override, unless you _really_ need one of the |
| 131 | + // parameters passed to this method. |
| 132 | + return ParallelExecutorFactory::create(...func_get_args()); |
136 | 133 | }
|
137 | 134 |
|
138 | 135 | /**
|
|
0 commit comments