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.
Over in #2226533: Changes to the Language class due to the LanguageInterface (followup)
we have made the mistake of creating a monster patch that needs a daily reroll -
it is upto 300 comments and the patch size is an unreviewable 260Kb
Other issues have been spawned to cut down the beast... but from here
https://www.drupal.org/node/2226533#comment-9162179
I want to break out all the annotation improvements into a more digestible form,
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff-3-5.txt | 873 bytes | martin107 |
#5 | language-2341927-5.patch | 5.43 KB | martin107 |
#3 | interdiff-1-3.txt | 2.23 KB | martin107 |
#3 | language-2341927-3.patch | 5.13 KB | martin107 |
#1 | language-2341927-1.patch | 4.23 KB | martin107 |
Comments
Comment #1
martin107 CreditAttribution: martin107 commentedAll looks ok to me....famous last words.
Comment #2
jhodgdonThis looks suspicious to me:
Is this perhaps string[] ?
And until we change our coding standards
this isn't a proper doc block... needs one-line description.
The rest looks good to me...
Comment #3
martin107 CreditAttribution: martin107 commentedI have fixed both issues ...
Regarding, the correct annotation for $langcode,
The situation is horribly confused,... and so thank you for making me double check.
If you look in the setup function, at the assignment of $langcode items ...
$this->$langcodes[$i] = $language
.. which is a line builds up an array of \Drupal\Core\Language\Language objects
which implies the that
* @var \Drupal\Core\Language\LanguageInterface[]
is the correct annotation .... BUT the real objection is WHY is a store of language objects called 'langcodes'?
the answer is that $langcode array is only ever used to pull out what is in effect the langcode property from within the selected language. ( the id )
So my fix is simplify and to store only what we want, not store a container holding what we want.
Comment #4
jhodgdonWell technically these are both class member variables and should have doc blocks, not one line @var statements (which are supposed to be only for local variables):
Other than that, this looks fine. It's not just documentation any more though.
Comment #5
martin107 CreditAttribution: martin107 commented@jhodgdon .. thanks again.
The next d8MI meeting is not for a week... I will try and get other eyes on this before then.
Comment #6
jhodgdonThis all looks good to me now. Thanks!
Comment #7
webchickCommitted and pushed to 8.x. Thanks!