Skip to content

Commit 816f88e

Browse files
committed
Add type-hints
1 parent 646114e commit 816f88e

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

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.

0 commit comments

Comments
 (0)