Skip to content

Commit 58b0875

Browse files
committed
Add type-hints
1 parent b3c9119 commit 58b0875

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

lib/Elastica/QueryBuilder.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QueryBuilder
3131
*/
3232
public function __construct(Version $version = null)
3333
{
34-
$this->_version = $version ?: new Version\Latest();
34+
$this->_version = $version ?? new Version\Latest();
3535

3636
$this->addDSL(new DSL\Query());
3737
$this->addDSL(new DSL\Aggregation());
@@ -41,14 +41,9 @@ public function __construct(Version $version = null)
4141
/**
4242
* Returns Facade for custom DSL object.
4343
*
44-
* @param $dsl
45-
* @param array $arguments
46-
*
4744
* @throws QueryBuilderException
48-
*
49-
* @return Facade
5045
*/
51-
public function __call($dsl, array $arguments)
46+
public function __call(string $dsl, array $arguments): Facade
5247
{
5348
if (false === isset($this->_facades[$dsl])) {
5449
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)