Problem/Motivation

Update drupal/coder to the latest version.

Proposed resolution

Fix failing coding standards. Note DateTimePlus contains some non-standard documentation that doesn't work. See $settings documentation on https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Date...

    * @param array $settings
    *   @see __construct()

The @see does not work at all - and doesn't work in PHPStorm either. Fortunately there are other methods that already have

   * @param array $settings
   *   (optional) A keyed array for settings, suitable for passing on to
   *   __construct().

so we can copy that.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

alexpott’s picture

There's one more fail on 9.0.x when running phpcs...

klausi’s picture

Status: Needs review » Needs work

Looks good, just one super minor comment we should clean up:

+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -212,10 +215,13 @@ public static function createFromTimestamp($timestamp, $timezone = NULL, $settin
    * @param mixed $time
-   *   @see __construct()
+   *   String representing the time.

the data type says mixed but the comment says string. On the constructor the data type is also string. So let's change the data type to string here so that we don't introduce a contradicting comment.

alexpott’s picture

Good idea. I borrowed the docs from core PHP

    /**
     * Parse a string into a new DateTime object according to the specified format
     * @param string $format Format accepted by date().
     * @param string $time String representing the time.
     * @param DateTimeZone $timezone A DateTimeZone object representing the desired time zone.
     * @return DateTime|false
     * @link https://php.net/manual/en/datetime.createfromformat.php
     */
    public static function createFromFormat ($format, $time, DateTimeZone $timezone=null) {}

So yep this has to be a string.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

PHPCS does not report problems, we should be good.

neclimdul’s picture

+++ b/core/phpcs.xml.dist
@@ -329,6 +328,11 @@
+  <rule ref="Squiz.WhiteSpace.OperatorSpacing">
+  <properties>
+    <property name="ignoreNewlines" value="true"/>
+  </properties>
+  </rule>

The properties indention is off here. I guess we should nit the style on a style commit but that can be fixed on commit.

alexpott’s picture

heddn’s picture

This needs backporting to 8.8. I'm using "drupal/core-dev": "^8.8" and right now my site is failing on running phpcs using the default core styles on 8.8.1.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: 3099583-9.0.x-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Spokje’s picture

Status: Needs work » Needs review

Patch for D8.9 in #8 applies cleanly and greenly on D8.8.x: https://www.drupal.org/pift-ci-job/1520837

neclimdul’s picture

Status: Needs review » Reviewed & tested by the community

9 too. I think that might be some random or unrelated failure that happened before. LGTM.

alexpott’s picture

Okay so the 9.0.x branch has been updated - but is currently failing coder :( - here's a new patch.

alexpott’s picture

Some CS errors have been added by recent patches...

  • catch committed a0bdf62 on 9.0.x
    Issue #3099583 by alexpott, klausi, neclimdul, heddn: Update coder to 8....
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed a0bdf62 and pushed to 9.0.x, and cherry-picked to 8.9.x. Thanks!

  • catch committed 36c790e on 8.9.x
    Issue #3099583 by alexpott, klausi, neclimdul, heddn: Update coder to 8....

Status: Fixed » Closed (fixed)

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