- ๐บ๐ธUnited States smustgrave
Seems to have some open points in the threads.
Also was tagged for a followup in #15 have those points been documented?
- ๐ฌ๐งUnited Kingdom joachim
Could someone explain what the thing of commenting out single function parameters is meant to do and how it works:
public function getForm($form_arg/* , ...$args */) {
- ๐ฌ๐งUnited Kingdom catch
I don't think the deprecation notice in the MR can ever be triggered successfully but ๐ Replace func_get_args with variable-length argument in FormBuilder Needs review solves this problem and I think it's ready to go.
- Status changed to Needs review
over 1 year ago 3:16pm 17 April 2023 - last update
over 1 year ago 29,207 pass - ๐ฎ๐นItaly mondrake ๐ฎ๐น
@catch I think you meant ๐ Remove the debug classloader deprecation silencing for Drupal interfaces Closed: duplicate . I am attaching here the patch from there and close the other as dupe of this.
- Status changed to Needs review
over 1 year ago 3:21pm 17 April 2023 - ๐ฎ๐นItaly mondrake ๐ฎ๐น
#24 from https://drupal.slack.com/archives/C1BMUQ9U6/p1681721410656849 (my additions in square brackets):
[...] Symfony lets you add commented out arguments to interfaces that trigger a deprecation error [via Symfony's debug classloader] when they aren't implemented [...]
- ๐ฌ๐งUnited Kingdom catch
+++ b/core/lib/Drupal/Core/Form/FormBuilderInterface.php @@ -46,20 +46,22 @@ public function getFormId($form_arg, FormStateInterface &$form_state); * - An instance of a class that implements \Drupal\Core\Form\FormInterface. - * @param ... + * phpcs:disable Drupal.Commenting + * @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 *
One more thing - do we need a note saying that defining this will be required in Drupal 11. There is otherwise no way to add a custom message anywhere afaict.
- ๐ฎ๐นItaly mondrake ๐ฎ๐น
How about opening an issue for the D11 queue listing all the interfaces to be changed, and refer such cases in code to that issue. Would also solve issues like https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/lib/Drupal/... where an addition was made in D9 but then everyone forgot about fixing it for D10 and so now it's too late.
- last update
over 1 year ago Custom Commands Failed - Status changed to Needs work
over 1 year ago 4:57pm 17 April 2023 - Status changed to Needs review
over 1 year ago 4:58pm 17 April 2023 - last update
over 1 year ago 29,207 pass - ๐ฎ๐นItaly mondrake ๐ฎ๐น
Strange, attached files got lost in the x-post with @longwave
- ๐ซ๐ทFrance andypost
-
+++ b/core/lib/Drupal/Core/Database/StatementInterface.php @@ -120,7 +120,8 @@ public function fetchField($index = 0); + * @see https://www.drupal.org/project/drupal/issues/3354672. +++ b/core/lib/Drupal/Core/Form/FormBuilderInterface.php @@ -46,20 +46,25 @@ public function getFormId($form_arg, FormStateInterface &$form_state); + * @see https://www.drupal.org/project/drupal/issues/3354672. @@ -158,7 +163,11 @@ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form + * @see https://www.drupal.org/project/drupal/issues/3354672.
@see shouldn't use dot at the end
-
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -211,13 +211,12 @@ public function getFormId($form_arg, FormStateInterface &$form_state) { - public function getForm($form_arg) { + public function getForm($form_arg, mixed ...$args) { ... + if (!empty($args)) { + $form_state->addBuildInfo('args', array_values($args));
Maybe check for emptiness is not needed as it's ok to use empty array or even NULL if passed
-
- Status changed to Needs work
over 1 year ago 2:17pm 21 April 2023 - ๐บ๐ธUnited States smustgrave
For the pints in #34
Also was tagged for followups in #15.
- Assigned to mondrake
- Status changed to Needs review
over 1 year ago 8:43am 22 April 2023 - last update
over 1 year ago 29,302 pass - ๐ฎ๐นItaly mondrake ๐ฎ๐น
Addressed #34.
Follow-up re. #15, ๐ [meta] Replace usage of func_get_args with variadic functions Active .
- Issue was unassigned.
- Status changed to Needs work
over 1 year ago 10:49am 22 April 2023 - ๐ฌ๐งUnited Kingdom longwave UK
We still have a BC break as noted in #15 - we can't add the args to the concrete method until Drupal 11, in case someone has already extended FormBuilder::getForm(): https://3v4l.org/nblth
Symfony EventDispatcher did not add them either: https://github.com/symfony/event-dispatcher/blob/4.4/EventDispatcher.php...
- Status changed to Needs review
over 1 year ago 9:51pm 22 April 2023 - ๐ฎ๐นItaly mondrake ๐ฎ๐น
#39 if I add the new parameter commented out in the concrete class too, though, we get the deprecation error:
- ๐ฌ๐งUnited Kingdom longwave UK
We have to add that exact deprecation to the ignore file until 11.x opens. This means the deprecation will be skipped for core, but if anyone else is extending the class then they will still get the deprecation notice now - if we keep the regex deprecation instead then downstream users will not be notified.
- Status changed to Needs work
over 1 year ago 10:46pm 22 April 2023 - ๐ฎ๐นItaly mondrake ๐ฎ๐น
#41 changes the scope significantly, so I will postpone this one (the actual change) to D11, and file ๐ Prepare FormBuilder for variadic functions Fixed for the D10 deprecation.
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
Updating title, tags and version number based on recent announcement at https://www.drupal.org/about/core/blog/new-drupal-core-branching-scheme-... โ
- Status changed to Active
9 months ago 5:33am 4 March 2024 - Status changed to Closed: outdated
8 months ago 11:32am 18 March 2024 - ๐ฎ๐นItaly mondrake ๐ฎ๐น
Opened ๐ Replace func_get_args with variable-length argument in FormBuilder Active since the issue fork was too old here to be able to place a MR against 11.x.