Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2014 at 21:20 UTC
Updated:
5 Sep 2014 at 11:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alimac commentedComment #2
alimac commented@alexpott pointed out that the setId() method was only used in tests (in phpStorm, right click on the method name and select Find Usages to find usages of a particular method). The value of id is set in the constructor and should not be modified afterward.
This patch removes the setId() method from
core/lib/Drupal/Core/Language/LanguageInterface.php,core/modules/language/src/Entity/Language.php,core/lib/Drupal/Core/Language/Language.phpand the tests.Comment #3
alimac commentedAttaching patch.
Comment #5
alimac commentedRerolled.
Comment #7
alimac commentedRerolled, again.
Comment #8
alimac commentedComment #10
alimac commentedI fixed the syntax problem and @jmolivas spotted an extraneous line of code. Hopefully this one passes.
Comment #11
thehong commentedI think we need add some more comment to Language.id, why there's no setter for it.
Comment #12
yesct commented@thehong hm. Maybe, but this is a common pattern already in core. (of having an id property, a id() function (getter) and no setter).
If we wanted to add a comment explaining that id was immutable and has no setter on purpose... it would be a separate issue to find all the classes that have a protected id which does not have a setter, and add a similar comment to all of them.
Comment #13
martin107 commentedI agree with the thrust of the issue...
In terms of review....
1) The implementation makes complete sense.
2) The immutability argument in #12 follows a recognizable established pattern.
3) After a slow and steady scan of the patch - nothing is out scope or inappropriate.
So +1 from me.
Comment #14
thehong commentedI think this is small issue with coding standard, should change to
array('key' => 'value')Comment #15
thehong commentedComment #16
martin107 commented@thehong forgive me but I don't understand what you are saying.
Comment #17
thehong commented@martin107, the patch is just missing spaces around '=>'. Please check more at https://www.drupal.org/coding-standards#array
Comment #18
martin107 commentedAh thank you ... fixed.
Comment #19
penyaskitoMuch more sense. RTBC.
Comment #20
penyaskitoRegret.
Can we use $this->language per consistence with the other tests?
Comment #22
alexpottCommitted 4b42df3 and pushed to 8.0.x. Thanks!
@penyaskito don't think that matters - it's a test - file a followup issue if you like.