Problem/Motivation

DBTNG Example doesn't meet Drupal coding standards according to phpcs.

Proposed resolution

Make the suggestions by phpcs.

Comments

jlbellido created an issue. See original summary.

jlbellido’s picture

Issue summary: View changes
fafnirical’s picture

Title: Update DBTNG Example to meet coding standars » Update DBTNG Example to meet coding standards
Issue tags: +Coding standards
Parent issue: #2659852: Update Cron Example to meet coding standards » #2176147: [meta] Coding standards review for D8 Examples
jlbellido’s picture

Status: Active » Needs review
StatusFileSize
new4.84 KB

Hi!
Here is a patch solving most of the warnings and errors returned from Code Sniffer. Although, there are still a couple of errors:

FILE: ...l8/modules/examples/dbtng_example/src/Tests/DBTNGExampleTest.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
  48 | ERROR | Public method name
     |       | "DBTNGExampleTest::testDBTNGExample" is not in
     |       | lowerCamel format
  93 | ERROR | Public method name "DBTNGExampleTest::testUI" is not
     |       | in lowerCamel format
 139 | ERROR | Public method name
     |       | "DBTNGExampleTest::testDBTNGExampleStorage" is not in
     |       | lowerCamel format
----------------------------------------------------------------------


FILE: ...upal8/modules/examples/dbtng_example/src/DBTNGExampleStorage.php
----------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
----------------------------------------------------------------------
 125 | ERROR | Tags must be grouped together in a doc comment
 126 | ERROR | Tags must be grouped together in a doc comment
 133 | ERROR | Tags must be grouped together in a doc comment
 136 | ERROR | Tags must be grouped together in a doc comment
 143 | ERROR | Tags must be grouped together in a doc comment
 151 | ERROR | Tags must be grouped together in a doc comment
 157 | ERROR | Tags must be grouped together in a doc comment
----------------------------------------------------------------------

Time: 380ms; Memory: 8.25Mb

But I'm not sure about them.

Cheers!

mile23’s picture

Status: Needs review » Needs work
  1. +++ b/dbtng_example/dbtng_example.module
    @@ -2,8 +2,7 @@
    + * This is an example outlining how a module can use the new DBTNG database API.
    

    DBTNG is no longer new. It was new with Drupal 7. :-)

  2. +++ b/dbtng_example/src/DBTNGExampleStorage.php
    @@ -2,11 +2,16 @@
    + * @package Drupal\dbtng_example
    

    Drupal coding standards exclude @package

jlbellido’s picture

StatusFileSize
new4.8 KB
new824 bytes

Ups! I didn't see that ;P

Here is a new patch with your suggestions.

Thanks!

jlbellido’s picture

Status: Needs work » Needs review

  • Mile23 committed e47db44 on 8.x-1.x authored by jlbellido
    Issue #2659866 by jlbellido, Fafnirical: Update DBTNG Example to meet...
mile23’s picture

Status: Needs review » Fixed

Removing 'new' is really outside the scope of this issue, but it'll fly this time.

There are still a few problems, but they deal with @code and are basically false positives from coder.

There are also problems with fully-capitalized acronym names like DBTNG. I think we can fix that along with some directory hierarchy problems (forms and controllers should be in their own directories, for instance). That can be a follow-up issue.

Committing and marked as fixed. Thanks!

mile23’s picture

Status: Fixed » Closed (fixed)

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