The phpcbf --standard=Drupal,DrupalPractice command converted the following code (PCA module, dev version):

define('PCA_PC_TEST', 'WR2 6NJ'); // WR2 6NJ is a test code (no credits are needed).
define('PCA_URL', 'http://services.postcodeanywhere.co.uk/');
define('PCA_FORMAT', 'xmla.ws'); // Supported formats: xmla.ws or json.ws (needs some work).

into:

define('PCA_DEMO_KEY', 'RA24-BZ17-JR72-WN38');
define('PCA_PC_TEST', 'WR2 6NJ');
// WR2 6NJ is a test code (no credits are needed).
define('PCA_URL', 'http://services.postcodeanywhere.co.uk/');
define('PCA_FORMAT', 'xmla.ws');
// Supported formats: xmla.ws or json.ws (needs some work).
define('PCA_CACHE', 'cache_postcodeanywhere');

If the comments needs to be in separate line, so I think they should be before the relevant code line, otherwise the comments between two code lines are confusing to which code they explain.

So I believe it should be converted into:

define('PCA_DEMO_KEY', 'RA24-BZ17-JR72-WN38');
// WR2 6NJ is a test code (no credits are needed).
define('PCA_PC_TEST', 'WR2 6NJ');
define('PCA_URL', 'http://services.postcodeanywhere.co.uk/');
// Supported formats: xmla.ws or json.ws (needs some work).
define('PCA_FORMAT', 'xmla.ws');
define('PCA_CACHE', 'cache_postcodeanywhere');

or leave them untouched.

--

The same this code:

  drupal_add_js($settings, 'setting'); // Append settings into JS file.
  drupal_add_js(drupal_get_path('module', 'postcodeanywhere') . '/postcodeanywhere.js', 'file');

is converted into:

  drupal_add_js($settings, 'setting');
  // Append settings into JS file.
  drupal_add_js(drupal_get_path('module', 'postcodeanywhere') . '/postcodeanywhere.js', 'file');

and we don't know to which code line this comment belong to.

Comments

kenorb created an issue. See original summary.

kenorb’s picture

Issue summary: View changes
klausi’s picture

Title: Moved inline comments below the code aren't obvious. » Inline comments should be moved to the line before the statement

  • klausi committed 323e8de on 8.x-2.x
    Issue #2605980: Inline comments should be moved to the line before the...
klausi’s picture

Status: Active » Fixed

Committed a fix, thanks for reporting!

Status: Fixed » Closed (fixed)

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