-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Ability to replace key in ArrayUtils::merge #6903
Ability to replace key in ArrayUtils::merge #6903
Conversation
|
||
namespace Zend\Stdlib\ArrayUtils; | ||
|
||
class MergeReplaceKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also suggest making this final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? By final
we close the doors to extending logic in this class. I see use case where someone want to add filter to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is indeed what final
is for. This object is just a thin data wrapper, and I don't see any advantage in extending it, not even in cases where you want to fetch data from, say, a DB connection.
If you think there is a use-case for extension, then I suggest interfacing it instead, and making this concrete implementation final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface makes sense
@snapshotpl manually merged, thank you!
|
…ReplaceKeyInterface`
…removing inherited docblock documentation
…ly introduced tests
…g-keys-in-array-utils' into develop Close zendframework/zendframework#6903
It's related with remove key #6899 @Ocramius