Open lostcarpark opened 1 year ago
This may not be possible. The type definitions that are currently used come directly from the function definition. Some add parameter types to the docblock, but others do not. For example, hook_form_alter does not dictate that $form
is an array or that $form_id
is a string anywhere:
/**
* ...
*
* @param $form
* Nested array of form elements that comprise the form.
* @param $form_state
* The current state of the form. The arguments that
* \Drupal::formBuilder()->getForm() was originally called with are available
* in the array $form_state->getBuildInfo()['args'].
* @param $form_id
* A string that is the unique ID of the form, set by
* Drupal\Core\Form\FormInterface::getFormId().
*
* @see hook_form_BASE_FORM_ID_alter()
* @see hook_form_FORM_ID_alter()
*
* @ingroup form_api
*/
function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
...
}
Not sure if the metadata exists to produce this, but it would be great if the hook templates could include more types. An example might be:
It would be great if this could be expanded to: