This is just a little housekeeping - don't mind me.

I am just answering the @todo in Flag::toArray()

To put the method into natural language.

CALL the parent method and THEN ensure that a SPECIAL subset of properties go through their respective magic getters.

Now that we have a proper schema for Flag.... I think this is redundant. As an experiment I am removing the method and letting the parent method function on its own.

  public function toArray() {
    // @todo Do we need Flag::toArray() any longer?
    $properties = parent::toArray();
    $names = [
      'flag_type',
      'link_type',
      'flagTypeConfig',
      'linkTypeConfig',
    ];

    foreach ($names as $name) {
      $properties[$name] = $this->get($name);
    }

    return $properties;
  }

As a minor side issue ,, as I touch files I want to remove the now redundant @file tags.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martin107 created an issue. See original summary.

martin107’s picture

Status: Active » Needs review
Berdir’s picture

Status: Needs review » Needs work
+++ b/src/Entity/Flag.php
@@ -1,9 +1,4 @@
 <?php
-/**
- * @file
- * Contains \Drupal\flag\Entity\Flag.
- */

I'd suggest to do a single patch to remove them all instead. You'll end up with conflicts if you do it in many different patches.

You will have to reupload the patch, testbot gets confused sometimes when you upload a patch initially.

While it should be fine to remove this, the recommended way to do this now is to have an explicit config_export annotation, see \Drupal\user\Entity\Role for example.

joachim’s picture

> the now redundant @file tags.

We're removing @file tags?

martin107’s picture

Status: Needs work » Needs review
FileSize
886 bytes

Thanks very much, for directing me to config_export.

flag_type and link_type are are already in.

So I am adding what is missing ( flagTypeConfig and linkTypeConfig )

Ok I will leave the @file for another time.

We're removing @file tags?

It is gone from core.

#2304909: Relax requirement for @file when using OO Class or Interface per file

it has been factored into the phpcs rule set and is showing up alot for me.

  • martin107 authored a9db0c5 on 8.x-4.x
    Issue #2707127 by martin107: Removed unnecessary Flag::toArray().
    
socketwench’s picture

Status: Needs review » Fixed

Looks good to me. Thanks!

Status: Fixed » Closed (fixed)

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