Skip to content

Commit d3dc5a7

Browse files
authored
Merge pull request #1693 from deguif/bump-query-builder-version
Bump query builder version to 7.0
2 parents 61a8ba5 + d21ff4d commit d3dc5a7

File tree

6 files changed

+12
-17
lines changed

6 files changed

+12
-17
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file based on the
1919

2020
### Backward Compatibility Breaks
2121
* The class `\Elastica\Type\Mapping` has been moved to `\Elastica\Mapping` [#1666](https://github.com/ruflin/Elastica/pull/1666)
22+
* The class `\Elastica\QueryBuilder\Version\Version240` has been moved to `\Elastica\QueryBuilder\Version\Version700` and type query was removed [#1693](https://github.com/ruflin/Elastica/pull/1693)
2223
* The `\Elastica\Query::$_suggest` property has been renamed to `$hasSuggest` and is now private, it should not be used from extending classes [#1679](https://github.com/ruflin/Elastica/pull/1679)
2324
* `\Elastica\Document` expects a string as ID, not an int [#1672](https://github.com/ruflin/Elastica/pull/1672).
2425
* Removed `\Elastica\Query\GeohashCell` query, use `\Elastica\Query\GeoBoundingBox` instead [#1672](https://github.com/ruflin/Elastica/pull/1672).

lib/Elastica/QueryBuilder.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ class QueryBuilder
2626

2727
/**
2828
* Constructor.
29-
*
30-
* @param Version $version
3129
*/
3230
public function __construct(Version $version = null)
3331
{
34-
$this->_version = $version ?: new Version\Latest();
32+
$this->_version = $version ?? new Version\Latest();
3533

3634
$this->addDSL(new DSL\Query());
3735
$this->addDSL(new DSL\Aggregation());
@@ -41,13 +39,9 @@ public function __construct(Version $version = null)
4139
/**
4240
* Returns Facade for custom DSL object.
4341
*
44-
* @param $dsl
45-
*
4642
* @throws QueryBuilderException
47-
*
48-
* @return Facade
4943
*/
50-
public function __call($dsl, array $arguments)
44+
public function __call(string $dsl, array $arguments): Facade
5145
{
5246
if (false === isset($this->_facades[$dsl])) {
5347
throw new QueryBuilderException('DSL "'.$dsl.'" not supported');

lib/Elastica/QueryBuilder/DSL.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
*/
1010
interface DSL
1111
{
12-
const TYPE_QUERY = 'query';
13-
const TYPE_AGGREGATION = 'aggregation';
14-
const TYPE_SUGGEST = 'suggest';
15-
const TYPE_COLLAPSE = 'collapse';
12+
public const TYPE_QUERY = 'query';
13+
public const TYPE_AGGREGATION = 'aggregation';
14+
public const TYPE_SUGGEST = 'suggest';
15+
public const TYPE_COLLAPSE = 'collapse';
1616

1717
/**
1818
* must return type for QueryBuilder usage.

lib/Elastica/QueryBuilder/Version/Latest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* @author Manuel Andreo Garcia <[email protected]>
1313
*/
14-
class Latest extends Version240
14+
class Latest extends Version700
1515
{
1616
// this class always points to the latest valid DSL version
1717
}

lib/Elastica/QueryBuilder/Version/Version240.php renamed to lib/Elastica/QueryBuilder/Version/Version700.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
use Elastica\QueryBuilder\Version;
66

77
/**
8-
* elasticsearch 2.4 DSL.
8+
* elasticsearch 7.0 DSL.
99
*
10-
* @see https://www.elastic.co/guide/en/elasticsearch/reference/2.4/index.html
10+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/index.html
1111
*
1212
* @author Cariou Pierre-Yves <[email protected]>
1313
*/
14-
class Version240 extends Version
14+
class Version700 extends Version
1515
{
1616
protected $queries = [
1717
'match',

test/Elastica/QueryBuilder/VersionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testVersions()
2020
];
2121

2222
$versions = [
23-
new Version\Version240(),
23+
new Version\Version700(),
2424
new Version\Latest(),
2525
];
2626

0 commit comments

Comments
 (0)