Remove __construct() from the interface definition.
Problem/Motivation
Having __construct() definition in Interface is bad in that is serve no purpose. At its core, an interface is a contract. There is no implementation attached with an interface and hence there is nothing to initialize and no need for a constructor.
Even worse, you cannot re-use the Interface for a new fancy object, which could need another sort of constructor (e.g. with more parameters, or/and no parameters at all). There is abstract classes for this.
Refactored solution
Move the __construct() definition to the concrete implementations.
Remaining tasks
Decide if we need the __construct() anyway so we can refactor using an abstract class instead of an interface.
Comments
Comment #1
sylvain lecoy commentedThere is something freaky in that a simple modification from EntityFormControllerInterface result in breaking a test in Layout ????????
Comment #2
sylvain lecoy commentedentity_form_controller.patch queued for re-testing.
Comment #3
sylvain lecoy commentedOk it was a testbot bug.
Comment #4
tim.plunkettCan you provide a single patch?
Also, http://drupal.org/project/issues/search/drupal?issue_tags=best%20practices shows nothing else, I don't think that is a tag in use.
Comment #5
sylvain lecoy commentedComment #6
tim.plunkettThanks! Assuming nothing blows up, this looks good.
I realize you're just moving these, but you might as well add the datatype here (string, in most cases)
Comment #7
sylvain lecoy commentedDid it !
Also please not remove this tag it being in use from now :)
Comment #8
tstoecklerThat is incorrect.
I guess the standard here would be "Constructs" instead of "Creates" and "TypedData" instead of "typed data"
Comment #9
sylvain lecoy commentedCould not find any consistent standard in core yet. But I have been using 'Constructs' for this patch.
Comment #10
tstoecklerGreat!
Comment #11
chx commentedYes that's a good idea!
Comment #12
dries commentedCommitted to 8.x. Thanks!
Comment #14
sylvain lecoy commentedNeed backport ?
Comment #15
sylvain lecoy commentedI have an HTTP error 0 on /comment-upload/js
Comment #16
tstoecklerLooks good.
Comment #17
sylvain lecoy commentedComment #18
David_Rothstein commentedIt looks like the Drupal 8 patch moved the documentation to the implementing classes, which makes sense to me.
Why doesn't the Drupal 7 patch do the same? That documentation is useful and we don't want it to completely disappear...
Comment #19
sylvain lecoy commentedYou are right, my bad !
Comment #21
sylvain lecoy commentedLet's try this again.
Comment #22
sylvain lecoy commentedComment #23
sylvain lecoy commentedAny chances to review this ?
Comment #24
sylvain lecoy commentedI think I fixed the comment in #18 and such a trivial fix would allow me to set this as RTBC ?
Comment #25
tstoecklerRTBC++
Comment #26
David_Rothstein commentedCommitted to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/f58bc6a