Currently EntityInterface defines __construct() method with $values parameter without default value
But all implementations uses array $values = array()
Suppose better to make it consistent. phpStorm IDE highlights this as error
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 1796604-core-ei-4.patch | 1.2 KB | andypost |
| core-ei.patch | 590 bytes | andypost |
Comments
Comment #1
berdirNo, it needs to be fixed the other way round.
This definition makes no sense. You can't have an optional first argument and a required second.
Comment #2
berdirThe other option would be to switch $values and $entity_type.
Comment #3
sunLet's fix all implementations first.
Let's discuss whether to flip the arguments in a separate issue.
Comment #4
andypostNew patch to fix implementations
Also filed #1796760: Change order of parameters in Entity constructors
Comment #5
andypostThis is a actually a bug
Comment #6
podarok#4 looks like very simple catch
do we need separate issue #1796760: Change order of parameters in Entity constructors from this?
Comment #7
andypost@podarok #1796760 is different task, This issue about bug
Comment #8
podarok#7 if so
#4 looks good for me
any backgrounds from someone?
Comment #9
xjmLooks like a good cleanup to me.
Comment #10
chx commentedWell, certainly this public function __construct(array $values = array(), $entity_type) { makes no sense because if entity_type is mandatory then values is mandatory too. So yes this fix makes sense.
Comment #11
webchickComment #12
webchickOops. Clicking around too fast. :)
This one is simple enough. Committed and pushed to 8.x. Thanks!