Problem/Motivation

In the lights of configuration forms starting from 10.4.0 / 11.0.0, now warn users if a value of the configuration entity they are related to is being overridden (see the change record), we might want to consider popularizing the necessary #config_target render array key as a suggestion of Drupal Practice.

Unfortunately, I'm not deeply familiar with the details of how PHPCS rules are supposed to be defined. Still, I think it could be a rather simple condition: IF the class extends ConfigFormBase → THEN check whether the #config_target attribute is present in the buildForm() method. (Of course, there are always exceptions (example) but we can still cover the 99% of cases by tieing the rule to the buildForm() method.)

I have searched the issue queue here on Drupal.org and in the code repository on GitHub for similar mention with no luck.

Any thoughts?

Comments

baluertl created an issue.