NEXT_MAJOR: replace usage of deprecated 'choice_list' option, when bumping requirements to SF 2.7+.

{@inheritdoc}
506584
public function configureOptions(OptionsResolver $resolver)
    {
        $that = $this;

        if (!interface_exists(ChoiceLoaderInterface::class)) {
            $resolver->setDefaults([
                'context' => null,
                'category' => null,
                'choice_list' => static function (Options $opts, $previousValue) use ($that) {
                    return new SimpleChoiceList($that->getChoices($opts));
                },
            ]);

            return;
        }
        $resolver->setDefaults([
            'context' => null,
            'category' => null,
            'choice_loader' => static function (Options $opts, $previousValue) use ($that) {
                return new CategoryChoiceLoader(array_flip($that->getChoices($opts)));
            },
        ]);
    }
948120
public function MoodleQuickForm_selectwithlink($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($elementName, $elementLabel, $options, $attributes, $linkdata);
    }
736773
public function loadValuesForChoices(array $choices, $value = null)
    {
        @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);

        // Optimize
        $choices = array_filter($choices);
        if (empty($choices)) {
            return [];
        }

        // If no callable is set, choices are the same as values
        if (null === $value) {
            return $choices;
        }

        return $this->loadChoiceList($value)->getValuesForChoices($choices);
    }
920219
public function load_choices() {
        global $CFG; // Remove this line and behold the horror of behat test failures!
        $this->choices = array();
        foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
            if (file_exists($plugindir . '/lib.php')) {
                require_once($plugindir . '/lib.php');
                // Check to see if the class exists. Check the correct plugin convention first.
                if (class_exists('gradereport_' . $plugin)) {
                    $classname = 'gradereport_' . $plugin;
                } else if (class_exists('grade_report_' . $plugin)) {
                    // We are using the old plugin naming convention.
                    $classname = 'grade_report_' . $plugin;
                } else {
                    continue;
                }
                if ($classname::supports_mygrades()) {
                    $this->choices[$plugin] = get_string('pluginname', 'gradereport_' . $plugin);
                }
            }
        }
        // Add an option to specify an external url.
        $this->choices['external'] = get_string('externalurl', 'grades');
        return true;
    }
350954
public function iSelect( $option )
    {
        trigger_error(
            "iSelect is deprecated since v6.3.0, use PlatformUI Context iSelect instead",
            E_USER_DEPRECATED
        );
        $elements = $this->getXpath()->findXpath( "//select" );
        Assertion::assertNotEmpty( $elements, "Unable to find a select field" );
        $elements[0]->selectOption( $option );
    }
240308
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
    {
        @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED);

        if (!$this->formatter instanceof ChoiceMessageFormatterInterface) {
            throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter)));
        }

        if (null === $domain) {
            $domain = 'messages';
        }

        $id = (string) $id;
        $catalogue = $this->getCatalogue($locale);
        $locale = $catalogue->getLocale();
        while (!$catalogue->defines($id, $domain)) {
            if ($cat = $catalogue->getFallbackCatalogue()) {
                $catalogue = $cat;
                $locale = $catalogue->getLocale();
            } else {
                break;
            }
        }

        if ($this->hasIntlFormatter && $catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) {
            return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, ['%count%' => $number] + $parameters);
        }

        return $this->formatter->choiceFormat($catalogue->get($id, $domain), $number, $locale, $parameters);
    }
605151
private function setAllowSslDowngrade($choice)
    {
        $repos = $this->getComposer()->getRepositoryManager()->getRepositories();

        /** @var ConfigurableRepositoryInterface $repo */
        foreach ($repos as $repo) {
            if (!$repo instanceof ComposerRepository) {
                continue;
            }
            $reflection = new \ReflectionClass($repo);
            $allowSslDowngrade = $reflection->getProperty('allowSslDowngrade');
            $allowSslDowngrade->setAccessible(true);
            $allowSslDowngrade->setValue($repo, $choice);
        }

        $config = $this->getComposer()->getConfig();
        $reflection = new \ReflectionClass($config);
        $property = $reflection->getProperty('config');
        $property->setAccessible(true);
        $values = $property->getValue($config);
        $values['secure-http'] = !$choice;
        $property->setValue($config, $values);
    }
855211
public static function MakeOptionList ($inherent_options = []) {
		return $inherent_options + static::GetDefaultOptions() + [
			\PDO::ATTR_ERRMODE			=> \PDO::ERRMODE_EXCEPTION,
			\PDO::ATTR_ORACLE_NULLS		=> \PDO::NULL_NATURAL,
			\PDO::ATTR_EMULATE_PREPARES	=> FALSE,
		];
	}
814346
protected function warnAboutDeprecatedOptions(array $options, $template = null)
    {
        if (!isset($this->input)) {
            return;
        }
        if ($template === null) {
            $template = 'The option --%s is deprecated and no longer used. It will be removed in a future version.';
        }
        foreach ($options as $option) {
            if ($this->input->hasOption($option) && $this->input->getOption($option)) {
                $this->labeledMessage(
                    'DEPRECATED',
                    sprintf($template, $option)
                );
            }
        }
    }
429538
private function getApiOptionsDeclaration()
    {

        // we got a max instances allowed in normality tags
        $apiOptions = json_encode( $this->apiOptions );
        $apiOptions = Php::varExport( $apiOptions, true );

        $this->class->classComponents[] = new VariableDeclaration(
            'apiOptions',
            new SFormatf( <<<'PHP'
                /**
                 * API options from relation
                 * @var array
                 */
                protected $apiOptions = %s;
PHP
                , $apiOptions
            )
        );

    }
842031
function (options) {
		
			var i, length;
		
			inputEx.SelectField.superclass.setOptions.call(this, options);
		
			this.options.choices = lang.isArray(options.choices) ? options.choices : [];
		
			// Retro-compatibility with old pattern (changed since 2010-06-30)
			if (lang.isArray(options.selectValues)) {
			
				for (i = 0, length = options.selectValues.length; i < length; i += 1) {
				
					this.options.choices.push({
						value: options.selectValues[i],
						label: "" + ((options.selectOptions && !lang.isUndefined(options.selectOptions[i])) ? options.selectOptions[i] : options.selectValues[i])
					});
				
				}
			}
		
		}
209973
protected function getOptionListFromJasper()
    {
        $optionList = array();

        //Get the options from the jasper server
        $inputControlStateArray = JasperHelper::convertInputControlState($this->state);

        foreach ($inputControlStateArray["option"] as $key => $option) {
            //Create an option instance for each option
            $optionList[] = new Option (
                $option["value"],
                $option["label"],
                $option["selected"]
            );
        }

        //Return the options list
        return $optionList;
    }
982565
private function getOptionsResolverFunctionDeclaration()
    {

        // get required properties
        $required = [];
        $optional = [];
        $allowedValues = [];

        // optional
        foreach( $this->entity->dataTypes as $name => $dataType ) {

            // is required
            if( !$dataType->getDefault() and !$dataType->isNullable() ) {
                $required[] = $name;
            } else {
                $optional[] = $name;
            }

            // set allowed values (currently only works for enums)
            if( $dataType->isEnum($enumName) ) {
                // At the moment this is bugged in Symfony.Don't think it is of vital importance. Ignoring for now.
                # $allowedValues[$name] = $enumName;
            }

        }

        // allowed values declaration
        $allowedValuesPhp = '';
        if( $allowedValues ) {
            $allowedValuesPhp = "\n\$resolver->setAllowedValues(\n    array(\n";
            // at the moment this enum supported only
            foreach( $allowedValues as $column => $enumName ) {
                $allowedValuesPhp .= sprintf(
                    '        %s => Enum::getValues(%s),%s',
                    Php::varExport( $column ),
                    Php::varExport( $enumName ),
                    "\n"
                );
            }
            $allowedValuesPhp .= "    )\n);";
            $allowedValuesPhp = new Format( $allowedValuesPhp );
        }

        // require block
        $requiredPhp = new Format();
        if( $required ) {
            $requiredPhp = "\n\$resolver->setRequired(\n" . (new Format(Php::varExport( $required )))->indent(4) . "\n);";
            $requiredPhp = new Format($requiredPhp);
            $requiredPhp->indent(24);
        }

        // optional
        $optionalPhp = new Format();
        if( $optional ) {
            $optionalPhp = "\n\$resolver->setOptional(\n" . (new Format(Php::varExport( $optional )))->indent(4) . "\n);";
            $optionalPhp = new Format($optionalPhp);
            $optionalPhp->indent(24);
        }

        $this->class->addUses('Symfony\Component\OptionsResolver\OptionsResolver');
        $this->class->classComponents[] = new FunctionDeclaration(
            'resolverGet',
            new Sformatf( <<<'PHP'
                /**
                 * Resolver getter. Singleton
                 * @return Symfony\Component\Options\Resolver
                 */
                public function resolverGet()
                {
                    // do we already have a resolver instance
                    if( !$this->resolver ) {

                        $resolver = new OptionsResolver();%s%s%s
                        $this->resolver = $resolver;

                    }
                    return $this->resolver;
                }
PHP
                , $requiredPhp,
                $optionalPhp,
                $allowedValuesPhp
            )
        );

        $this->class->classComponents[] = new VariableDeclaration(
            'resolver',
            new SFormatf( <<<'PHP'
                /**
                 * Options Resolver
                 * @var array
                 */
                private $resolver;
PHP
            )
        );

    }
364670
@Deprecated
  public SoyEasyList newEasyListFromList(SoyList list) {
    EasyListImpl result = new EasyListImpl();
    for (SoyValueProvider provider : list.asJavaList()) {
      result.add(provider);
    }
    return result;
  }
1259906
public function defaultSelectizeOptions()
    {
        $metadata = $this->metadata();
        $options = [];

        if (isset($metadata['data']['selectize_options'])) {
            $options = $metadata['data']['selectize_options'];
            $options = $this->parseSelectizeOptions($options);
        }

        if ($this->deferred()) {
            $placeholder = $this->translator()->trans('Search...');
        } else {
            $placeholder = $this->translator()->trans('Select...');
        }

        $options['placeholder'] = $placeholder;
        $prop = $this->property();
        if ($prop instanceof SelectablePropertyInterface) {
            $choices = iterator_to_array($this->choices());

            if (isset($options['options'])) {
                $options['options'] = array_merge($options['options'], $choices);
            } else {
                $options['options'] = $choices;
            }

            $items = $this->propertyVal();

            if ($prop instanceof AbstractProperty) {
                $items = $prop->parseVal($items);

                if ($prop->l10n()) {
                    $items = (string)$this->translator()->translation($items);
                }

                if (is_string($items)) {
                    $items = explode($prop->multipleSeparator(), $items);
                }
            }

            if (!$prop->multiple()) {
                $items = (array)$items;
            }

            if (!$items) {
                $items = [];
            }

            // workaround for object setter casting the property as object.
            if ($items instanceof ModelInterface) {
                $items = $this->mapObjToChoice($items)['value'];
            }

            if (is_scalar($items)) {
                $items = [$items];
            }

            if (!isset($options['items'])) {
                $options['items'] = [];
            }
            $options['items'] = array_merge($options['items'], $items);
        }

        return $options;
    }
172157
def v2_translator(self, option):
        
        new_option = option
        new_value = getattr(self, option)

        renaming_pairs = {
            "dontfrag": "dont_fragment",
            "maxhops": "max_hops",
            "firsthop": "first_hop",
            "use_NSID": "set_nsid_bit",
            "cd": "set_cd_bit",
            "do": "set_do_bit",
            "qbuf": "include_qbuf",
            "recursion_desired": "set_rd_bit",
            "noabuf": "include_abuf"
        }
        if option in renaming_pairs.keys():
            warninglog = (
                "DeprecationWarning: {0} option has been deprecated and "
                "renamed to {1}."
            ).format(option, renaming_pairs[option])
            print(warninglog)
            new_option = renaming_pairs[option]

        # noabuf was changed to include_abuf so we need a double-negative
        if option == "noabuf":
            new_value = not new_value

        return new_option, new_value
176920
function validateListFromOptions (opts, name) {
    if (opts.all) return Array.from(supported[name].values())

    let list = opts[name]
    if (!list) {
      if (name === 'arch') {
        list = hostArch()
      } else {
        list = process[name]
      }
    } else if (list === 'all') {
      return Array.from(supported[name].values())
    }

    if (!Array.isArray(list)) {
      if (typeof list === 'string') {
        list = list.split(/,\s*/)
      } else {
        return unsupportedListOption(name, list, supported[name])
      }
    }

    const officialElectronPackages = usingOfficialElectronPackages(opts)

    for (let value of list) {
      if (officialElectronPackages && !supported[name].has(value)) {
        return unsupportedListOption(name, value, supported[name])
      }
    }

    return list
  }