Task/File/FolderBrowserTask.php
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired(
            [
                'folder_path',
            ]
        );
        $resolver->setAllowedTypes('folder_path', ['string']);
        /** @noinspection PhpUnusedParameterInspection */
        $resolver->setNormalizer(
            'folder_path',
            function (Options $options, $value) {
                if (!is_dir($value)) {
                    throw new InvalidConfigurationException(
                        "Folder path does not exists or is not a folder: '{$value}'"
                    );
                }
                if (!is_readable($value)) {
                    throw new InvalidConfigurationException("Folder path is not readable: '{$value}'");
                }

                return $value;
            }
        );
        $resolver->setDefaults(
            [
                'name_pattern' => null,
                'empty_log_level' => LogLevel::WARNING,
            ]
        );
        $resolver->setAllowedTypes('name_pattern', ['NULL', 'string']);
        $resolver->setAllowedValues(
            'empty_log_level',
            [
                LogLevel::ALERT,
                LogLevel::CRITICAL,
                LogLevel::DEBUG,
                LogLevel::EMERGENCY,
                LogLevel::ERROR,
                LogLevel::INFO,
                LogLevel::NOTICE,
                LogLevel::WARNING,
            ]
        );
    }
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired(
            [
                'folder_path',
            ]
        );
        $resolver->setAllowedTypes('folder_path', ['string']);
        /** @noinspection PhpUnusedParameterInspection */
        $resolver->setNormalizer(
            'folder_path',
            function (Options $options, $value) {
                if (!is_dir($value)) {
                    throw new InvalidConfigurationException(
                        "Folder path does not exists or is not a folder: '{$value}'"
                    );
                }
                if (!is_readable($value)) {
                    throw new InvalidConfigurationException("Folder path is not readable: '{$value}'");
                }

                return $value;
            }
        );
        $resolver->setDefaults(
            [
                'name_pattern' => null,
                'empty_log_level' => LogLevel::WARNING,
            ]
        );
        $resolver->setAllowedTypes('name_pattern', ['NULL', 'string']);
        $resolver->setAllowedValues(
            'empty_log_level',
            [
                LogLevel::ALERT,
                LogLevel::CRITICAL,
                LogLevel::DEBUG,
                LogLevel::EMERGENCY,
                LogLevel::ERROR,
                LogLevel::INFO,
                LogLevel::NOTICE,
                LogLevel::WARNING,
            ]
        );
    }
@param OptionsResolver $resolver

@throws \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
@throws \Symfony\Component\OptionsResolver\Exception\AccessException
@throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException