-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relax value
type in SetProcessor
to allow mixed
#2082
Conversation
1cfbc61
to
adda166
Compare
* @return $this | ||
*/ | ||
public function setValue(string $value): self | ||
public function setValue($value): self |
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.
That's would be a BC break for anyone who reimplemented this method and kept the string $value
signature.
But it should be very limited as extending this processor is probably not widespread at all.
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.
Agree, but I also hope this is very rare. I suggest we mark it as a breaking change in the changelog with a note on when it would be breaking (someone inheriting SetProcessor).
It is one of these scenarios I think where in theory it is a breaking change and I'm pretty sure someone is going to bring up that because of that we (I) don't follow semver but working around it would not bring benefits to the large majority of users. I'm +1 on the change.
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'll update the PR later adding it in the BC Break section, it wasn't intentional, I changed it in the constructor which is not BC break and then changed it in the setValue
without thinking about that.
adda166
to
eb7e4ea
Compare
There is also another similar issue with Elastica/src/Index/Settings.php Lines 262 to 266 in ff1a6e0
It expects a Elastica/tests/Index/SettingsTest.php Lines 239 to 243 in 4321f37
seems like it could accept at least should we proceed the same way? |
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, I would say lets do the same.
CHANGELOG.md
Outdated
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
## [Unreleased](https://github.com/ruflin/Elastica/compare/7.1.5...master) | |||
### Backward Compatibility Breaks | |||
* Removed `string` parameter type-hint to `value` in `SetProcessor::setValue`. |
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.
Can you expand this a bit more and explain in which scenarios it is breaking? Basically only if someone inherits from SetProcessor
eb7e4ea
to
eddd2aa
Compare
It is defined as
string
, but intests
there are a couple of places where another type is used:Elastica/tests/Processor/SetProcessorTest.php
Line 20 in 732ccf3
Elastica/tests/PipelineTest.php
Line 26 in 8ecc5cd
Looking at the documentation: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/set-processor.html#set-processor looks like any type can be used.