-
Notifications
You must be signed in to change notification settings - Fork 733
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
6.x compatible with php8.0 #1977
6.x compatible with php8.0 #1977
Conversation
6b63a53
to
87c72eb
Compare
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.
@AskaoAhmedSaad It would be nice if we could make 6.x compatible with PHP 8.0 but we should not make it a breaking change for existing users. Any ideas on how we can make it non breaking? I remember we had similar challenges with other PHP versions and reserved terms. Can you check it how we have solved it in other places / PR?
@@ -1,216 +0,0 @@ | |||
<?php |
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.
This looks like a breaking 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.
It definitely is :)
I was going to try and make a similar patch... Don't remove the Swap If people are still using |
@@ -12,7 +12,7 @@ | |||
} | |||
], | |||
"require": { | |||
"php": "^7.0", | |||
"php": "^7.0 | ^8.0", |
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.
Use ||
as per https://github.com/ruflin/Elastica/blob/master/composer.json#L18 for consistency
* @deprecated since version 6.1.2, use the MatchQuery class instead. | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html | ||
*/ | ||
class Match extends AbstractQuery |
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.
This should become class Match extends MatchQuery
and otherwise be empty of content
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.
Keeping the comments above too, of course.
@@ -3,7 +3,7 @@ | |||
namespace Elastica\Query; | |||
|
|||
/** | |||
* Match none query. Returns no results. | |||
* MatchQuery none query. Returns no results. |
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.
This shouldn't be replaced. See master https://github.com/ruflin/Elastica/blob/master/src/Query/MatchNone.php#L6
@@ -3,7 +3,7 @@ | |||
namespace Elastica\Query; | |||
|
|||
/** | |||
* Match all query. Returns all results. | |||
* MatchQuery all query. Returns all results. |
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.
This shouldn't be replaced.
@@ -3,7 +3,7 @@ | |||
namespace Elastica\Query; | |||
|
|||
/** | |||
* Match Phrase query. | |||
* MatchQuery Phrase query. |
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.
This shouldn't be replaced.
@@ -94,7 +94,7 @@ public function setOperator($operator = self::OPERATOR_OR) | |||
} | |||
|
|||
/** | |||
* Set field minimum should match for Match Query. | |||
* Set field minimum should match for MatchQuery Query. |
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.
This shouldn't be replaced.
@@ -106,7 +106,7 @@ public function setMinimumShouldMatch($minimumShouldMatch) | |||
} | |||
|
|||
/** | |||
* Set zero terms query for Match Query. | |||
* Set zero terms query for MatchQuery Query. |
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.
This shouldn't be replaced.
@@ -120,7 +120,7 @@ public function setZeroTermsQuery($zeroTermQuery = self::ZERO_TERM_NONE) | |||
} | |||
|
|||
/** | |||
* Set cutoff frequency for Match Query. | |||
* Set cutoff frequency for MatchQuery Query. |
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.
This shouldn't be replaced.
@@ -26,7 +26,7 @@ public function testPercolateQueryOnNewDocument() | |||
$doc = new Document(2, ['message' => 'A new bonsai tree in the office']); | |||
$this->documentType->addDocument($queryDoc); | |||
$this->index->refresh(); | |||
//Match a document to the registered percolator queries: | |||
//MatchQuery a document to the registered percolator queries: |
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.
This shouldn't be replaced.
@@ -40,7 +40,7 @@ public function testPercolateQueryOnNewDocument() | |||
$this->index->refresh(); | |||
$resultSet = $this->index->search($percolateQuery); | |||
|
|||
//Match a document to the registered percolator queries: | |||
//MatchQuery a document to the registered percolator queries: |
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.
This shouldn't be replaced.
Looks like this has just been done as a literal find and replace. Only really the code uses of the And reverting them makes the diff smaller for people to review. |
@reedy @ruflin having a class with the name "Match" gives a parser error at PHP 8 environment, do you have a suggestion to overcome this and at the same time not to break the other PHP versions ? I think maybe we can have a special version name with removing Match class totally and replace it with MatchQuery |
It should only error if you execute the file using it (or lint it etc)... What are you doing to cause/see that error? |
I re-made your commit without the comment changes in https://github.com/reedy/Elastica/tree/6xphp8 composer.json:
Test PHP script:
Run it
|
CI seems fine with the I've got #1981 to the point where I think I'm just fiddling with fixing up some minor test breakages (function calls that need updating) |
As #1981 goes more into the direction we want to go I'm going to close this PR for now. @AskaoAhmedSaad Thanks for kicking this off and I would appreciate if you could chime in on #1981 In case we change direction, we can still reopen this one. |
make version 6.x compatible with php8.0