Problem/Motivation

There are many coding standards problems in core/lib/Drupal/Core/Database/Schema.php

Proposed resolution

Fix the code according to the coding standards

Remaining tasks

Fix the followings errors:

----------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
 468 | ERROR | Parameter tags must be grouped together in a doc
     |       | comment
 468 | ERROR | Tags must be grouped together in a doc comment
 482 | ERROR | Tags must be grouped together in a doc comment
 498 | ERROR | Tags must be grouped together in a doc comment
 551 | ERROR | Tags must be grouped together in a doc comment
 556 | ERROR | Tags must be grouped together in a doc comment

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adriancid created an issue. See original summary.

adriancid’s picture

Status: Active » Needs review
FileSize
18.19 KB

Status: Needs review » Needs work

The last submitted patch, 2: coding_standards_problems_in_schema-2863877-2.patch, failed testing.

daffie’s picture

+++ b/core/lib/Drupal/Core/Database/Schema.php
@@ -29,16 +31,26 @@
-  public function __construct($connection) {
...
+  public function __construct(Connection $connection) {

If you change the methods parameter definition, you must do the same to all method from the classes that inherit from this class. So the MySQL, PostgreSQL and SQLite versions of Schema. If you do that then you can also add inherit docblocks where needed. ;-)

daffie’s picture

Forget about the inherit docblock. You have created #2863750: Add inheritdoc function doc comment to schema classes for that.

daffie’s picture

I think that it is better to remove the parameter type hints, they are a BC-break. We can do them in Drupal 9.0. Feel free to make a new issue for that. You can have the parameter type hints in the docblocks. Conclusion: remove the parameter type hints in the methods and not the docblocks and the patch will be RTBC.

empesan’s picture

I've added a patch based on @adriancid patch adding the changes suggested by @daffie

cilefen’s picture

Thank you for your work on cleaning up Drupal core's code style!

In order to fix core coding standards in a maintainable way, all our coding standards issues should be done on a per-rule basis across all of core, rather than fixing standards in individual modules or files. We should also separate fixes where we need to write new documentation from fixes where we need to correct existing standards. This all should be done as part of #2571965: [meta] Fix PHP coding standards in core. A good place to start is the child issues of #2572645: [Meta] Fix 'Drupal.Commenting.FunctionComment' coding standard.

For background information on why we usually will not commit coding standards fixes that aren't scoped in that way, see the core issue scope guidelines, especially the note about coding standards cleanups. That document also includes numerous suggestions for scoping issues including documentation coding standards cleanups.

Contributing to the overall plan above will help ensure that your fixes for core's coding standards remain in core the long term.

hgunicamp’s picture

Issue tags: +ciandt-contrib

After applying the 'coding_standards_problems_in_schema-2863877-7.patch' patch and running phpcs again, I still found some mistakes.

phpcs --standard=Drupal core/lib/Drupal/Core/Database/Schema.php

FILE: ...ogestag/temp/drupal/core/lib/Drupal/Core/Database/Schema.php
----------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 11 LINES
----------------------------------------------------------------------
53 | ERROR | Type hint "\Drupal\Core\Database\Connection" missing
| | for $connection
406 | ERROR | Type hint "array" missing for $fields
435 | ERROR | Type hint "array" missing for $fields
468 | ERROR | Parameter tags must be grouped together in a doc
| | comment
468 | ERROR | Tags must be grouped together in a doc comment
482 | ERROR | Tags must be grouped together in a doc comment
498 | ERROR | Tags must be grouped together in a doc comment
513 | ERROR | Type hint "array" missing for $fields
551 | ERROR | Tags must be grouped together in a doc comment
556 | ERROR | Tags must be grouped together in a doc comment
596 | ERROR | Type hint "array" missing for $spec
596 | ERROR | Type hint "array" missing for $keys_new
631 | ERROR | Type hint "array" missing for $fields
----------------------------------------------------------------------

Time: 170ms; Memory: 11.5Mb

hgunicamp’s picture

Sorry. I tested the patch before reading cilefen comment.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#3207949: Fix Drupal.Commenting.FunctionComment.MissingParamType

This work is now being done by sniff. The work here is now in #3207949: Fix Drupal.Commenting.FunctionComment.MissingParamType so closing this as a duplicate. I've identified credit to add over there, let me know if I got it wrong.