In file /Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlConnectionTest.php we have wrong usage of @return phpDoc with [].

Instead of '@return []' we need to use '@return array'.

Comments

IRuslan created an issue. See original summary.

IRuslan’s picture

Issue summary: View changes
IRuslan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.21 KB

Patch in the attachment.

IRuslan’s picture

StatusFileSize
new1.7 KB

Also noted same problem in core/modules/locale/src/PluralFormula.php.
Patch is updated.

Status: Needs review » Needs work

The last submitted patch, 4: fix-phpdoc-return-2659412-4.patch, failed testing.

IRuslan’s picture

Status: Needs work » Needs review

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

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

daffie’s picture

Status: Needs review » Closed (won't fix)

The preferred way in Drupal for describing an array is with square brackets. So I am closing this issue.

@IRuslan: Thank you for your effort.

IRuslan’s picture

Status: Closed (won't fix) » Needs review

Actually, I disagree.
If we search within core '@return []' - only usages from ConnectionTest.php will be found, while if you will search for '@return array' there are more than 1000 usages.
As a result, whole Core code written in '@return array' manner instead of '@return []'.

daffie’s picture

@IRuslan: From the https://www.drupal.org/coding-standards/docs#types. I read the following:

For the PHP built-in types, use the following names:
array (NOT "Array"). However, the [] syntax (see above) is preferred if appropriate

So it used to be "array" and now squared brackets are preferred. Both are good. If you agree, we can close this issue.

IRuslan’s picture

Status: Needs review » Closed (won't fix)

Ok, thanks for the link.

I just wanted to be consistent in Core:)
But I think there are a lot of more important issues to review.