Problem/Motivation

Running PHPStan at level 8 over the module reports eight errors: seven in the plugin and one in the test.

Seven are array shapes. Every method taking or returning an array declares it as a bare "array", so PHPStan cannot tell what is inside and reports "no value type specified in iterable type array". This is not pedantry on a condition plugin: the configuration array and the "bundles" key inside it are the whole contract of the plugin, and the visited set passed by reference through the recursion is easy to get wrong.

One is a real type mismatch: a test passes the result of label() as the assertion message, and label() returns TranslatableMarkup, string or null, while the assertion expects a string.

Drupal.org runs PHPStan at a lower level by default, so none of this fails the pipeline today. That is exactly why it is worth fixing now, while the module is small.

Comments

trebormc created an issue. See original summary.

  • trebormc committed 7f1b0f98 on 1.0.x
    Issue #3619003 by trebormc: Fix PHPStan level 8 errors.
    
trebormc’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.