mglaman / phpstan-drupal

Extension for PHPStan to allow analysis of Drupal code.
https://phpstan-drupal.mglaman.dev/
MIT License
191 stars 76 forks source link

Validate FormBuilderInterface::getForm() arguments by inspecting form class #749

Open andriokha opened 3 months ago

andriokha commented 3 months ago

Feature request

While https://www.drupal.org/node/3432087 should improve phpstan processing of FormBuilderInterface::getForm(), it'd be great if we could use the first argument to look up what other arguments are valid.

For example when analyzing the following

$this->formBuilder->getForm(EntityModerationForm::class, $entity);

The correct number and types of arguments can be found by inspecting EntityModerationForm::buildForm().

nlighteneddesign commented 3 months ago

This may also be relevant: https://www.drupal.org/project/drupal/issues/3431285