-
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
Enable declare_strict_types option and apply @PHP80Migration set with… #2190
Conversation
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.
Looks like this triggered quite a list of CI failures :-)
@@ -1,5 +1,7 @@ | |||
<?php | |||
|
|||
declare(strict_types=1); |
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.
Is this line automatically added to each file or is this something done manually?
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.
With the help of PHP-CS-Fixer declare_strict_types
rule included in @PHP80Migration:risky
rule set.
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.
Great, I was worried there would a be manual step involved.
Yeah. Here is a lot what need to be done. |
bb28ac4
to
c416ac8
Compare
3e9905e
to
c5e6d8c
Compare
cb7e575
to
0b40f26
Compare
5a3cbd2
to
49a378a
Compare
84f70e5
to
26246cb
Compare
55c5834
to
a09bd5a
Compare
ready for review @ruflin |
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.
Change LGTM. I'll get this in directly to make sure we don't have any future conflicts. I have one question around a change in the test but we can still follow up on this separately.
@@ -38,7 +40,7 @@ public function testSetReadOnly(): void | |||
$index->addDocument($doc2); | |||
$this->fail('should throw read only exception'); | |||
} catch (ClientResponseException $e) { | |||
$error = \json_decode($e->getResponse()->getBody(), true)['error'] ?? null; | |||
$error = \json_decode((string) $e->getResponse()->getBody(), true)['error']['root_cause'][0] ?? null; |
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.
Do you know why this changed?
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 a good catch:
Seems like elasticsearch response looks like:
{
"error": {
"type": "cluster_block_exception",
"root_cause": [
{
"type": "cluster_block_exception",
...
}
]
}
}
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 wonder why the test passed before 🤔 If I remember correctly, there was a major ES version where the response format changed, but that was quite a while ago. Good to know we have it covered in the tests.
@@ -136,8 +137,7 @@ public function testDeleteAliasWithException(): void | |||
$indexAlias->delete(); | |||
$this->fail('Should throw exception because you should delete the concrete index and not the alias'); | |||
} catch (ClientResponseException $e) { | |||
$response = ResponseConverter::toElastica($e->getResponse()); | |||
$error = $response->getFullError(); | |||
$error = \json_decode((string) $e->getResponse()->getBody(), true)['error']['root_cause'][0] ?? null; |
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.
What is the reason you removed the ResponseCoverter here?
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.
ResponseCoverter
in my opinion should work with code related to src
folder (production code). Official Elasticsearch client does not return ResponseInterface
.
I'm planning to raise a new PR where we won't allow ResponseInterface as an option to ResponseCoverter
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.
Does this make migration from 7.x potentially harder? Lets discuss on the upcoming PR, code will make it much easier to fully understand what you mean by this.
Thanks for all the cleanup @sidz One thing I just noticed after merging, no changelog 🤦 |
I'll add in the separate PR |
This PR enables
declare_strict_types
option and applies@PHP80Migration
set with risky rules.