- Issue created by @quietone
- 🇳🇱Netherlands bbrala Netherlands
THis is the changelist:
https://git.drupalcode.org/project/coder/-/compare/8.3.28..8.3.29?from_p...There are changes to that sniff it seems.
I would suspect: https://git.drupalcode.org/project/coder/-/commit/78034f0a41956c4f8d3808...
- 🇦🇹Austria klausi 🇦🇹 Vienna
Thanks for reporting!
We improved the handling of phpcs ignores, and now the exact line where the problem is (the @return line in the doc comment) is returned. I assumed it would be enough to move "phpcs:ignore Drupal.Commenting.FunctionComment.MissingReturnComment" into the doc comment, but turns out that this results in a different error:
/** * Provides a collection of condition plugins. */ class ConditionPluginCollection extends DefaultLazyPluginCollection { /** * {@inheritdoc} * * phpcs:ignore Drupal.Commenting.FunctionComment.MissingReturnComment * @return \Drupal\Core\Condition\ConditionInterface */ public function &get($instance_id) { return 'x'; } }
Opened a PR to make that work as well: https://github.com/pfrenssen/coder/pull/265/files
Of course it would be so much better if you just add the missing return comment. Then you don't need confusing phpcs ignore statements littered in Drupal core. Example:
/** * Provides a collection of condition plugins. */ class ConditionPluginCollection extends DefaultLazyPluginCollection { /** * {@inheritdoc} * * @return \Drupal\Core\Condition\ConditionInterface * The condition for the given instance ID. */ public function &get($instance_id) { return 'x'; } }
- 🇦🇹Austria klausi 🇦🇹 Vienna
Merged that one.
For Drupal core you have 3 options:
1) Add a return comment to your @return docs, remove phpcs:ignore (best solution IMO)
2) Globally ignore Drupal.Commenting.FunctionComment.MissingReturnComment in the phpcs.xml.dist config file when updating Coder, fix those instances later
3) Wait for Coder 8.3.30 with this fix and upgrade to that, but you will still have to move the phpcs:ignore statements into the doc comment before the @return as in the example here. - 🇳🇿New Zealand quietone
@klausi, thanks for the fix! I am now eagerly waiting on the next release.