PHPSTAN next minor warnings

Created on 12 February 2025, 3 months ago

Problem/Motivation

https://git.drupalcode.org/project/ui_suite_uswds/-/jobs/4334672

Running phpstan (next minor) on ui_suite_uswds I get

Note: Using configuration file /builds/project/ui_suite_uswds/web/modules/custom/ui_suite_uswds/phpstan.neon.
PHP Fatal error: Declaration of Drupal\ui_patterns\ComponentPluginManager::processDefinitionCategory(array &$definition): void must be compatible with Drupal\Core\Theme\ComponentPluginManager::processDefinitionCategory(&$definition): void in /builds/project/ui_suite_uswds/web/modules/contrib/ui_patterns/src/ComponentPluginManager.php on line 144
Fatal error: Declaration of Drupal\ui_patterns\ComponentPluginManager::processDefinitionCategory(array &$definition): void must be compatible with Drupal\Core\Theme\ComponentPluginManager::processDefinitionCategory(&$definition): void in /builds/project/ui_suite_uswds/web/modules/contrib/ui_patterns/src/ComponentPluginManager.php on line 144

Steps to reproduce

Proposed resolution

TBD

Remaining tasks

Determine if an issue in ui_patterns

User interface changes

NA

API changes

NA

Data model changes

NA

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States smustgrave

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @smustgrave
  • πŸ‡«πŸ‡·France pdureau Paris
  • πŸ‡«πŸ‡·France pdureau Paris
  • First commit to issue fork.
  • @reinfate opened merge request.
  • In https://www.drupal.org/project/drupal/issues/3474533 ✨ ComponentPluginManager must implement CategorizingPluginManagerInterface Active the core's SDC plugin manager now also implements the CategorizingPluginManagerInterface and uses the \Drupal\Core\Plugin\CategorizingPluginManagerTrait like the \Drupal\ui_patterns\ComponentPluginManager but its processDefinitionCategory doesn't have the type hint for parameter.
    The CategorizingPluginManagerTrait also doesn't specify a type hint, but overriding the trait's method with a different signature is allowed, while overriding the parent class method like that causes a critical error.
    This prevents the module from working at all after the change from the mentioned issue.

    It should be safe to just remove the type hint, so the method signature is the same as in the parent and trait.

Production build 0.71.5 2024