Looking at DurationInterface I noticed some copy&paste mistakes slipped through. As dates (DateTimeInterface) durations are not primitive as getValue/setValue does not return the duration object. Attached patch fixes that.

CommentFileSizeAuthor
d8_duration.patch735 bytesfago
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, d8_duration.patch, failed testing.

fago’s picture

Status: Needs work » Needs review

d8_duration.patch queued for re-testing.

Berdir’s picture

Not sure I understand the argument as both implementations extend from a primitive data type.

fago’s picture

The implementations yes, but not the interface. The duration is implemented as a string and therefore implements StringInterface, however the DurationInterface should not extend PrimitiveInterface as the duration itself is not primitive. According to PrimitiveInterface - it would have to use get/setValue to get/set the primitive value, i.e. the duration. However, get/setValue does not get/set a duration object as specified by Durationinterface - so extending PrimitiveInterface is wrong.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense.

If you have a TimeSpan, you can use it as an integer by doing an instanceof IntegerInterface, in that case, it's a primitive value. When you're working with the DurationInterface, it's not.

chx’s picture

Issue title of the month.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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