Bug report
Doing some maintenance I ran into bunch of these errors:
Form alter hook "form_node_foobar_edit_form_alter"
implementation must have 2 or 3 parameters. Expected signature:
method(&$form, \Drupal\Core\Form\FormStateInterface $form_state[,
$form_id])
🪪 hookFormAlter.invalidParameterCount
I'm not sure why the form_alter rule cares about having to few parameters. Specifically, dropping the $form_state when not used. Seems like not including unused parameters would be a best practice. I tried to follow the history on the code but there doesn't seem to be a reference or discussion so figured I'd ask.
Code snippet that reproduces the problem
Reference to the code.
https://github.com/mglaman/phpstan-drupal/blame/70c804da7e9f61e9c60785827e7d360b9444ca24/src/Rules/Drupal/HookFormAlterRule.php#L115-L124
Bug report
Doing some maintenance I ran into bunch of these errors:
I'm not sure why the form_alter rule cares about having to few parameters. Specifically, dropping the $form_state when not used. Seems like not including unused parameters would be a best practice. I tried to follow the history on the code but there doesn't seem to be a reference or discussion so figured I'd ask.
Code snippet that reproduces the problem
Reference to the code.
https://github.com/mglaman/phpstan-drupal/blame/70c804da7e9f61e9c60785827e7d360b9444ca24/src/Rules/Drupal/HookFormAlterRule.php#L115-L124