- Issue created by @adamfranco
- last update
about 1 year ago 9,628 pass - @adamfranco opened merge request.
The phpstan-drupal extension for PHPStan allows defining information about entity types to improve static analysis of Drupal code. For instance, knowing what entity storage class is returned from the entity type manager and the entity class returned from create/load methods.
Using a configuration file and a definition the composer.json, Group can provide this information. The information will be picked up by phpstan/extension-installer.
In addition to allowing static analysis of the Group module itself using phpstan/phpstan-drupal, this information will allow static analysis of other modules that integrate with Group to properly determine the available methods on Group's entities when they are returned by the EntityTypeManager.
See the phpstan-drupal README and this phpstan-drupal issue for additional context https://github.com/mglaman/phpstan-drupal/issues/281
Create an entity_mapping.neon file and register it in the composer.json for phpstan/extension-installer
composer create-project drupal/recommended-project drupal
cd drupal/
composer config repositories.group vcs https://git.drupalcode.org/issue/group-3397015.git
composer require drupal/group:dev-3397015-entitymappings-phpstan
vendor/phpstan/extension-installer/src/GeneratedConfig.php
and verify Group's config is includedvendor/bin/phpstan analyse web/modules/contrib/group/
Active
3.2
Code