Task/SimpleBatchTask.php
public function execute(ProcessState $state)
    {
        $batchCount = $this->getOption($state, 'batch_count');
        $this->elements[] = $state->getInput();

        if (null !== $batchCount && \count($this->elements) >= $batchCount) {
            $state->setOutput($this->elements);
            $this->elements = [];
        } else {
            $state->setSkipped(true);
        }
    }
public function execute(ProcessState $state)
    {
        $batchCount = $this->getOption($state, 'batch_count');
        $this->elements[] = $state->getInput();

        if (null !== $batchCount && \count($this->elements) >= $batchCount) {
            $state->setOutput($this->elements);
            $this->elements = [];
        } else {
            $state->setSkipped(true);
        }
    }
@param ProcessState $state

@throws \Symfony\Component\OptionsResolver\Exception\ExceptionInterface
@throws \InvalidArgumentException