Verified Commit 29dc14b2 authored by Dave Long's avatar Dave Long
Browse files

Issue #3355839 by mondrake: Prepare FormBuilder for variadic functions

parent b48a95b7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -10,12 +10,15 @@

# Skip DebugClassLoader false positives.
%Method "[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "(?!Drupal\\)[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%
%The "Drupal\\[^"]+" method will require a new "[^"]+" argument in the next major version of its interface "Drupal\\[^"]+", not defining it is deprecated%

# The following deprecation is listed for Twig 2 compatibility when unit
# testing using \Symfony\Component\ErrorHandler\DebugClassLoader.
%The "Twig\\Environment::getTemplateClass\(\)" method is considered internal\. It may change without further notice\. You should not extend it from "Drupal\\Core\\Template\\TwigEnvironment"\.%

# Drupal 11.
%Drupal\\Core\\Form\\FormBuilder::getForm\(\).* will require a new "mixed \.\.\. \$args" argument in the next major version of its interface%
%Drupal\\Core\\Form\\FormBuilder::submitForm\(\).* will require a new "mixed \.\.\. \$args" argument in the next major version of its interface%

# PHPUnit 9.
%"PHPUnit\\Framework\\TestListener".*is deprecated%
%"PHPUnit\\Framework\\TestListenerDefaultImplementation".*is deprecated%
+2 −1
Original line number Diff line number Diff line
@@ -120,7 +120,8 @@ public function fetchField($index = 0);
   * or stdClass if not specified.
   *
   * phpcs:disable Drupal.Commenting
   * @todo Remove PHPCS overrides https://www.drupal.org/node/3354672.
   * @todo Uncomment new method parameters before drupal:11.0.0.
   * @see https://www.drupal.org/project/drupal/issues/3354672
   *
   * @param string|null $class_name
   *   Name of the created class.
+14 −4
Original line number Diff line number Diff line
@@ -46,20 +46,25 @@ public function getFormId($form_arg, FormStateInterface &$form_state);
   *   The value must be one of the following:
   *   - The name of a class that implements \Drupal\Core\Form\FormInterface.
   *   - An instance of a class that implements \Drupal\Core\Form\FormInterface.
   * @param ...
   * phpcs:disable Drupal.Commenting
   * @todo Uncomment new method parameters before drupal:11.0.0.
   * @see https://www.drupal.org/project/drupal/issues/3354672
   *
   * @param mixed ...$args
   *   Any additional arguments are passed on to the functions called by
   *   \Drupal::formBuilder()->getForm(), including the unique form constructor
   *   function. For example, the node_edit form requires that a node object is
   *   passed in here when it is called. These are available to implementations
   *   of hook_form_alter() and hook_form_FORM_ID_alter() as the array
   *   $form_state->getBuildInfo()['args'].
   * phpcs:enable
   *
   * @return array
   *   The form array.
   *
   * @see \Drupal\Core\Form\FormBuilderInterface::buildForm()
   */
  public function getForm($form_arg);
  public function getForm($form_arg /* , mixed ...$args */);

  /**
   * Builds and processes a form for a given form ID.
@@ -158,7 +163,11 @@ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form
   *   checkbox or other control that browsers submit by not having a
   *   \Drupal::request()->request entry, include the key, but set the value to
   *   NULL.
   * @param ...
   * phpcs:disable Drupal.Commenting
   * @todo Uncomment new method parameters before drupal:11.0.0.
   * @see https://www.drupal.org/project/drupal/issues/3354672
   *
   * @param mixed ...$args
   *   Any additional arguments are passed on to the functions called by
   *   self::submitForm(), including the unique form constructor function.
   *   For example, the node_edit form requires that a node object be passed
@@ -176,8 +185,9 @@ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form
   *   $form_state->addBuildInfo('args', [&$object]);
   *   \Drupal::formBuilder()->submitForm('mymodule_form', $form_state);
   *   @endcode
   * phpcs:enable
   */
  public function submitForm($form_arg, FormStateInterface &$form_state);
  public function submitForm($form_arg, FormStateInterface &$form_state /* , mixed ...$args */);

  /**
   * Retrieves the structured array that defines a given form.