Part of #2571965: [meta] Fix PHP coding standards in core.

Problem/Motivation

Let's add more coding standards to our phpcs-based quality workflow!

Proposed resolution

  1. Add Drupal Coder to your Drupal codebase
    $ composer require drupal/coder
    $ ./vendor/bin/phpcs --config-set installed_paths /PATH/drupal/vendor/drupal/coder/coder_sniffer/
    
  2. Patch core/phpcs.xml.dist with the desired sniff.
  3. Running phpcs will show you errors that exist.
    $ cd core
    $ ../vendor/bin/phpcs -p -s
    
  4. Fix the errors. You should run phpcbf to auto-fix as many as possible.
    $ cd core
    $ ../vendor/bin/phpcbf
    
  5. You should then run phpcs again to see what it left behind.
  6. You should also review all changes. Generate a diff and read it.

To review: Add phpcs to your codebase, apply the patch, and run phpcs. Any errors reported by phpcs mean more work is needed.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen created an issue. See original summary.

Mile23’s picture

Version: 8.3.x-dev » 8.2.x-dev
FileSize
32.91 KB

Moved to 8.2.x because it's a docs-only improvement, but the patch applies to both 8.2.x and 8.3.x.

Mile23’s picture

Status: Active » Needs review
Eric_A’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#2783393: Fix 'Drupal.Commenting.FunctionComment.IncorrectParamVarName' coding standard

This not only fixes a standards violation but also brings back consistency between param and return in these classes that we lost when #2783393: Fix 'Drupal.Commenting.FunctionComment.IncorrectParamVarName' coding standard went into 8.2.x and 8.3.x.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 2e5e060 to 8.3.x and 53b5df5 to 8.2.x. Thanks!

  • alexpott committed 2e5e060 on 8.3.x
    Issue #2783395 by Mile23: Fix 'Drupal.Commenting.FunctionComment....

Status: Fixed » Closed (fixed)

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