Problem/Motivation

Lots of code in the hal, serialization and rest modules has significant coding standards violations.

This makes maintenance and patches more painful.

Proposed resolution

Fix coding standard errors.

Remaining tasks

Review & commit.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

clemens.tolboom’s picture

Title: Move out of scope items » Rest collection patch : move out of scope items
larowlan’s picture

Status: Active » Needs review
StatusFileSize
new135.83 KB

these bits

Status: Needs review » Needs work

The last submitted patch, 2: rest-collection-2100637-no-oos.1.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new20.32 KB

didn't merge HEAD

Status: Needs review » Needs work

The last submitted patch, 4: rest-collection-2100637-no-oos.2.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new20.47 KB
new389 bytes

missed a use statement

Crell’s picture

  1. +++ b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php
    @@ -187,6 +204,7 @@ public function denormalize($data, $class, $format = NULL, array $context = arra
    +      // @todo: Method 'denormalize' not found in class \Symfony\Component\Serializer\SerializerInterface
           $this->serializer->denormalize($field_data, $field_class, $format, $context);
    

    Er. This todo makes it sound like the line after it will fatal error. Assuming that doesn't happen, it means the comment is confusing.

  2. +++ b/core/modules/hal/src/Normalizer/FieldNormalizer.php
    @@ -77,6 +81,7 @@ public function denormalize($data, $class, $format = NULL, array $context = arra
    +      // @todo Method 'denormalize' not found in class \Symfony\Component\Serializer\SerializerInterface
           $this->serializer->denormalize($field_item_data, $field_item_class, $format, $context);
    

    As above.

  3. +++ b/core/modules/hal/src/Normalizer/FieldNormalizer.php
    @@ -101,6 +106,7 @@ protected function normalizeFieldItems($field, $format, $context) {
    +        // @todo Method 'normalize' not found in class \Symfony\Component\Serializer\SerializerInterface
             $normalized_field_items[] = $this->serializer->normalize($field_item, $format, $context);
    

    As above.

  4. +++ b/core/modules/hal/src/Tests/NormalizerTestBase.php
    @@ -20,13 +20,13 @@
     /**
      * Test the HAL normalizer.
      */
    -abstract class NormalizerTestBase extends DrupalUnitTestBase {
    +abstract class NormalizerTestBase extends KernelTestBase {
    

    Why?

  5. +++ b/core/modules/serialization/src/EntityResolver/UuidReferenceInterface.php
    @@ -20,7 +20,7 @@
    -   * @return string
    +   * @return string|null
        *   A UUID.
    

    Please clarify when null would be returned instead of a UUID string.

Other than those nits this seems quite reasonable.

larowlan’s picture

To be honest I have no idea about the changes, other than that they were out of scope in the other issue (which I reviewed). I rolled the patch as penance for objecting over there.

Crell’s picture

Clemens can weigh in on them, then. :-)

alexpott’s picture

Can someone properly title and scope this issue to say want is actually being changed here. thanks.

klausi’s picture

Title: Rest collection patch : move out of scope items » Fix coding standard errors in REST and HAL module
Status: Needs review » Needs work

Better title, looking at the patch.

Needs work for the issue summary update and what we want to do here.

wim leers’s picture

Title: Fix coding standard errors in REST and HAL module » Fix coding standard errors in REST, HAL and Serialization modules
Priority: Normal » Minor
Issue summary: View changes
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.

wim leers’s picture

Issue tags: +Needs reroll, +Novice, +php-novice
wim leers’s picture

Status: Needs review » Needs work
Saphyel’s picture

Assigned: Unassigned » Saphyel

The patch doesn't apply anymore, I'm going redo it

Saphyel’s picture

Assigned: Saphyel » Unassigned
StatusFileSize
new54.33 KB

I mainly focus on comments and variable names.. it requires more time than I though :(

Saphyel’s picture

StatusFileSize
new54.33 KB

re-uploading because I don't see the option for test :S

alexpott’s picture

See https://www.drupal.org/core/scope for guidelines and examples for Drupal core issue scope. Coding standards are being handled by #2571965: [meta] Fix PHP coding standards in core, stage 1. Ideally coding standards should be fixed by enabling the rule in phpcs.xml.dist and fixing core to comply with the rule. That way we can test and prevent regressions.

Saphyel’s picture

@alexpott yes, I used code sniffer and I fixed a lot of things but there is still a lot of them...

alexpott’s picture

@Saphyel the point is we're trying to make core comply with coding standards one by one see the sub issues of #2571965: [meta] Fix PHP coding standards in core, stage 1. Grab bag issues like this make that effort more complex. And if we do it that way we can prevent regressions and introducing new coding standards fails.

I think this issue should be closed because of scope. And effort put into #2571965: [meta] Fix PHP coding standards in core, stage 1 and it's children.

clemens.tolboom’s picture

Status: Needs work » Closed (outdated)

@Saphyel you created #2709151: Fix coding standard errors in REST, HAL and Serialization modules containing same patch as you put in #2362495-18: Fix coding standard errors in REST, HAL and Serialization modules

As stated in #2571965: [meta] Fix PHP coding standards in core, stage 1

Instead we will now split up the work per type of coding standard. For example in separate issues we'll deal with trailing whitespace, inline comments, line lengths, etc. This will be much easier to review, since every patch will only contain very similar fixes.

I close #2362495: Fix coding standard errors in REST, HAL and Serialization modules and #2709151: Fix coding standard errors in REST, HAL and Serialization modules as both do not comply to the workflow defined in #2571965: [meta] Fix PHP coding standards in core, stage 1

Saphyel’s picture

@clemens.tolboom oks sorry I misunderstand it