Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | removeToArray-2707127-5.patch | 886 bytes | martin107 |
| |||
removeToArray.patch | 840 bytes | martin107 | |
Comments
Comment #2
martin107 CreditAttribution: martin107 commentedComment #3
BerdirI'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.
Comment #4
joachim CreditAttribution: joachim commented> the now redundant @file tags.
We're removing @file tags?
Comment #5
martin107 CreditAttribution: martin107 commentedThanks 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.
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.
Comment #7
socketwench CreditAttribution: socketwench at FFW commentedLooks good to me. Thanks!