Issue #3355839 by mondrake: Prepare FormBuilder for variadic functions

merge-requests/4157/merge
Dave Long 2023-07-26 12:29:50 +01:00
parent b48a95b797
commit 29dc14b207
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
3 changed files with 20 additions and 6 deletions

View File

@ -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%

View File

@ -120,7 +120,8 @@ interface StatementInterface extends \Traversable {
* 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.

View File

@ -46,20 +46,25 @@ interface FormBuilderInterface {
* 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 @@ interface FormBuilderInterface {
* 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 @@ interface FormBuilderInterface {
* $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.