Task/File/FileFetchTask.php
protected function findMatchingFiles(ProcessState $state)
    {
        $filePattern = $this->getOption($state, 'file_pattern');
        if ($filePattern) {
            foreach ($this->sourceFS->listContents('/') as $file) {
                if ('file' === $file['type']
                    && preg_match($filePattern, $file['path'])
                    && !\in_array($file['path'], $this->matchingFiles, true)) {
                    $this->matchingFiles[] = $file['path'];
                }
            }
        } else {
            $input = $state->getInput();
            if (!$input) {
                throw new \UnexpectedValueException('No pattern neither input provided for the Task');
            }
            if (\is_array($input)) {
                foreach ($input as $file) {
                    if (!\in_array($file, $this->matchingFiles, true)) {
                        $this->matchingFiles[] = $file;
                    }
                }
            } elseif (!\in_array($input, $this->matchingFiles, true)) {
                $this->matchingFiles[] = $input;
            }
        }
    }
protected function findMatchingFiles(ProcessState $state)
    {
        $filePattern = $this->getOption($state, 'file_pattern');
        if ($filePattern) {
            foreach ($this->sourceFS->listContents('/') as $file) {
                if ('file' === $file['type']
                    && preg_match($filePattern, $file['path'])
                    && !\in_array($file['path'], $this->matchingFiles, true)) {
                    $this->matchingFiles[] = $file['path'];
                }
            }
        } else {
            $input = $state->getInput();
            if (!$input) {
                throw new \UnexpectedValueException('No pattern neither input provided for the Task');
            }
            if (\is_array($input)) {
                foreach ($input as $file) {
                    if (!\in_array($file, $this->matchingFiles, true)) {
                        $this->matchingFiles[] = $file;
                    }
                }
            } elseif (!\in_array($input, $this->matchingFiles, true)) {
                $this->matchingFiles[] = $input;
            }
        }
    }
@param ProcessState $state

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