Problem/Motivation
DateTimeItem and DateRangeItem both have class constants. These should be on interfaces.
Proposed resolution
- Move the DateTimeItem constants onto DateTimeItemInterface as-is.
- Create DateRangeItemInterface, and move DateRangeItem constants as-is.
- Update usages to refer to the interface or static:: as appropriate.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#15 | datetime-interfaces_constants-2915046-15-D8.patch | 35.47 KB | ioana apetri |
#23 | 2915046-23-D8.patch | 34.92 KB | mohit1604 |
#29 | interdiff-23-29.txt | 448 bytes | jofitz |
#29 | 2915046-29.patch | 35.46 KB | jofitz |
#33 | 2915046-33-D8.patch | 34.95 KB | mohit1604 |
Issue fork drupal-2915046
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jibranComment #3
ioana apetri CreditAttribution: ioana apetri at OPTASY commentedI will work on this issue.
Comment #4
ioana apetri CreditAttribution: ioana apetri at OPTASY commentedHere is my patch, please review it:)
Comment #6
mpdonadioNot sure why the CI run stopped, but looks like there were some fails and exceptions:
https://dispatcher.drupalci.org/job/drupal_patches/41229/consoleText
Comment #7
ioana apetri CreditAttribution: ioana apetri at OPTASY commentedI checked the reports but I don't know why the 'FieldTypePluginManagerTest' class fails.
Here is the new patch with some updated.
Thanks.
Comment #9
mpdonadioThe report in https://www.drupal.org/pift-ci-job/838784 shows the problems. The `use` block for all of those classes need to be adjusted to add/swap out the new interface.
Comment #10
snehi CreditAttribution: snehi as a volunteer and at Publicis Sapient for Publicis Sapient commentedWith the latest test-bot results, i think the patch is looks good and even test is passed.
Changing the status from need work to need review.
Re-run the tests to finalizing the patch.
Comment #11
ioana apetri CreditAttribution: ioana apetri at OPTASY commentedthanks:)
Comment #13
mpdonadioThe fails in #7 are definitely real. They are from error messages:
1) Drupal\Tests\datetime_range\Functional\DateRangeFieldTest::testDateRangeField
PHPUnit_Framework_Exception: Fatal error: Interface 'Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItemInterface' not found in /var/www/html/core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php on line 25
The file for DateRangeItemInterface doesn't exists in the patch. It is possible when it was rolled, the file wasn't staged (eg, it was done via `git -a` and not `git -A`.
Comment #14
ioana apetri CreditAttribution: ioana apetri at OPTASY commentedI am checking:)
Comment #15
ioana apetri CreditAttribution: ioana apetri at OPTASY commentedIdead, it was this problem. Thanks
Comment #16
mpdonadioAssigning to myself for a full review. May take me a day or two to get to this.
Comment #17
jhedstromComment #18
jibranLet's update the existing one.
Comment #19
jibranGlobal constants in datetime.module are deprecated and DateTimeItemInterface has been introduced.
Comment #21
mpdonadioDoesn't apply to 8.6.x b/c a conflict in DateTimeComputed, so we need a reroll.
Comment #22
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #23
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedPatch for version 8.6.x , Please review it :)
Comment #25
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #26
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #27
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #28
mpdonadioIt looks like the patch in #23 wasn't rolled with the new file.
Comment #29
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-roll of patch in #15 (with interdiff against patch in #23 for reference).
Comment #30
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedPatch #29 looks good to me. Marking RTBC.
Comment #32
mpdonadioComment #33
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedThis should work fine :)
Comment #35
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedThis patch fails because of this duplicate use statement. Here is updated patch.
Comment #36
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #38
kporras07 CreditAttribution: kporras07 at Manatí commentedPatch updated with some references that were missing and added missing interface.
Comment #40
kporras07 CreditAttribution: kporras07 at Manatí commentedOne more try
Comment #41
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedLooks good to me marking RTBC.
Comment #42
jibranWe still have to update change record.
Comment #44
mpdonadio"Interface definition for Daterange items."
There are also a bunch of DateRangeItem:: usages left. See the report from PhpStorm.
Comment #45
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #46
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is updated patch which removes all the
DateRangeItem::
constant mentioned in #44 and unuseduse
statements.Comment #47
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #48
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs, Google Summer of Code for DrupalFit commentedPatch #46 looks good to me. Marking RTBC.
Comment #50
alexpottTestbot had a hiccup re-rtbcing
Comment #51
mpdonadioSuper nit, but "Interface definition for Daterange items."
PHP allows interfaces to extend other interfaces, so this should be `interface DateRangeItemInterface extends DateTimeItemInterface`
And then, we can change hunks like this to `DateRangeItemInterface::DATETIME_TYPE_DATETIME`. We just need to remember to add the new use (where needed) and remove the old one (as appropriate).
Comment #52
jofitz CreditAttribution: jofitz at ComputerMinds commentedAddress @mpdonadio's comments in #51.
Comment #53
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs, Google Summer of Code for DrupalFit commentedThe patch #52 applied successfully and takes all points into account as stated by @mpdonadio in #51.
Thanks @JoFitzgerald for the patch.
Marking it RTBC.
Comment #54
alexpottThese are unexpected changes.
Comment #55
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedFixing the issues mentioned by @alexpott. Even all the changes in default.settings.php is unexpected which convert square
[]
array syntax toarray()
syntax.Comment #56
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is updated patch which revert the
default.settnigs.php
changes. I am not sure if @Jo Fitzgerald's intention of making these changes was to make the uniform syntax of array in this file. Currentlydefault.settings.php
file uses mixture of square[]
syntax andarray()
syntax which is not a good idea. Fixing this kind of inconsistency as a side effect in this issue is also not a good idea. Converting array syntax to square array syntax should be followed up on this #2776975: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phaseComment #57
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #58
jhedstromThe latest patch addresses the remaining feedback I think.
Comment #59
larowlanShould these refer to the parent DateTimeInterface instead of the DateTimeRangeInterface?
DateTimeRangeInterface should only be used for the DATETIME_TYPE_ALLDAY constant right?
Few other instances
This looks right, but in other places we've done it with the DateTimeRangeInterface - I think we should be consistent, and use the defining interface, not the parent
Comment #60
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commented@larowlan Thanks for review. In point 1. and 2. all the places you mentioned we are using
DateRangeItemInterface::<CONSTANT>
only where it is related todaterange
field like inDateRangeDatelistWidget.php and DateRangeFieldTest.php
and DateRangeItemInterface extends DateTimeItemInterface. So i think it is safe to useDateRangeItemInterface::<CONSTANT>
for daterange field. I am not sure if there is any downside to this.I agree with you on point 3 we should use DateTimeRangeInterface instead of DateTimeItemInterface because that test is related to DateRangeItemTest.
This same goes for line 86 as well.
Comment #61
rakesh.gectcrComment #63
mpdonadioThis needs a reroll. But, re #59 for DateTimeItemInterface vs DateRangeItemInterface usages, I think if the context is in DateRange proper or referring to DateRange usages, then that interface should be used.
Comment #64
kostyashupenkoComment #73
dharmeshmertwal CreditAttribution: dharmeshmertwal as a volunteer and at Srijan | A Material+ Company commentedComment #74
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u at Zyxware Technologies commentedComment #78
andregp CreditAttribution: andregp at CI&T commentedMR seems okay. The last fail is random and unrelated. Changing status to Needs Review.
Comment #80
nod_D10 version needed
At this time we need a D10.1.x patch or MR for this issue.
Patch or MR doesn't apply anymore
The last patch or MR doesn't apply to the target branch, please reroll the code so that it can be reviewed by the automated testbot.
Comment #81
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedComment #83
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedRe Rolled for MR #2321 to 10.1.x branch
Comment #84
smustgrave CreditAttribution: smustgrave at Mobomo commentedWas tagged for change record updates. Maybe this needs it's own now.
Comment #85
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedDraft CR Created.
Comment #86
smustgrave CreditAttribution: smustgrave at Mobomo commentedLine core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php
------ ----------------------------------------------------------------------------------
72 Access to an undefined static property
static(Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase)::$field_type.
------ ----------------------------------------------------------------------------------
------ -------------------------------------------------------------------------
Line core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php
------ -------------------------------------------------------------------------
53 Access to an undefined static property
static(Drupal\Tests\datetime\Kernel\Views\FilterDateTest)::$field_name.
------ -------------------------------------------------------------------------
------ -------------------------------------------------------------------------------
Line core/modules/datetime_range/tests/src/Kernel/Views/FilterDateTest.php
------ -------------------------------------------------------------------------------
60 Access to an undefined static property
static(Drupal\Tests\datetime_range\Kernel\Views\FilterDateTest)::$field_name.
Comment #88
sahil.goyal CreditAttribution: sahil.goyal as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedAddressed the CCF error as described in #86.
Comment #89
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commented@sahil.goyal changes to variable name format should be in other way around.
Comment #90
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedComment #91
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoving to NW for failures in the MR.
Comment #92
sahil.goyal CreditAttribution: sahil.goyal as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedComment #93
smustgrave CreditAttribution: smustgrave at Mobomo commentedSearching for DateTimeItem:: still see there are about 30+ instances remaining.
Comment #94
rpayanmPlease review.
Comment #95
smustgrave CreditAttribution: smustgrave at Mobomo commentedWill let the committers decide but there are still some instances of DateTimeItem:: but they are in comments for some. Should these be updated too? Didn't think it was worth holding up the ticket.
Comment #96
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedgrep -R --color "DateTimeItem::" ./core
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: * Tests DateTimeItem::setValue().
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: // Test DateTimeItem::setValue() using string.
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with string value.');
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: // Test DateTimeItem::setValue() using property array.
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with array value.');
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: // Test DateTimeItem::setValue() using string.
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with string value.');
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: // Test DateTimeItem::setValue() using property array.
./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php: $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with array value.');
./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php: if ($parent_field_item_class === DateTimeItem::class) {
./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php: if ($parent_field_item_class === DateTimeItem::class) {
./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php: DateTimeItem::class,
./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php: DateTimeItem::class,
Comment #97
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedComment #98
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedPlease ignore Merge request !2321 ,
Updated Merge request !3013 to replace existing few more instances of "DateTimeItem::"
Comment #99
smustgrave CreditAttribution: smustgrave at Mobomo commented