Skip to content

Commit 418f3fb

Browse files
mhujerpolyfractal
authored andcommitted
PHPStan check src/ on level 2 (#675)
* rebuild docs * drop Monolog dependency from ClientBuilder * [TEST] typos * [TEST] rename phpstan config * fix issues found by PHPStan up to the level 2 * update phpstan/phpstan to 0.8.5 * PHPStan checks src/ on level 2
1 parent 828a0de commit 418f3fb

File tree

13 files changed

+26
-19
lines changed

13 files changed

+26
-19
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"cpliakas/git-wrapper": "~1.0",
2020
"doctrine/inflector": "^1.1",
2121
"mockery/mockery": "0.9.4",
22-
"phpstan/phpstan-shim": "0.8.3",
22+
"phpstan/phpstan-shim": "0.8.5",
2323
"phpunit/phpunit": "6.3.0",
2424
"squizlabs/php_codesniffer": "3.0.2",
2525
"symfony/finder": "^2.8",
@@ -48,7 +48,8 @@
4848
"phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp tests"
4949
],
5050
"phpstan": [
51-
"@php vendor/phpstan/phpstan-shim/phpstan.phar analyse -c phpstan.neon tests --level 7 --no-progress"
51+
"@php vendor/phpstan/phpstan-shim/phpstan.phar analyse -c phpstan-src.neon src --level 2 --no-progress",
52+
"@php vendor/phpstan/phpstan-shim/phpstan.phar analyse -c phpstan-tests.neon tests --level 7 --no-progress"
5253
]
5354
}
5455
}

phpstan-src.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
ignoreErrors:
3+
4+
# because src\Elasticsearch\Connections\Connection.php
5+
- '#Anonymous function has an unused use \$logger.#'
6+
- '#Anonymous function has an unused use \$tracer.#'
File renamed without changes.

src/Elasticsearch/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Client
8282
*/
8383
protected $remote;
8484

85-
/** @var callback */
85+
/** @var callable */
8686
protected $endpoints;
8787

8888
/** @var NamespaceBuilderInterface[] */
@@ -1030,7 +1030,7 @@ public function scroll($params = array())
10301030

10311031
/** @var \Elasticsearch\Endpoints\Scroll $endpoint */
10321032
$endpoint = $endpointBuilder('Scroll');
1033-
$endpoint->setScrollID($scrollID)
1033+
$endpoint->setScrollId($scrollID)
10341034
->setScroll($scroll)
10351035
->setBody($body);
10361036
$endpoint->setParams($params);
@@ -1057,7 +1057,7 @@ public function clearScroll($params = array())
10571057

10581058
/** @var \Elasticsearch\Endpoints\ClearScroll $endpoint */
10591059
$endpoint = $endpointBuilder('ClearScroll');
1060-
$endpoint->setScrollID($scrollID)
1060+
$endpoint->setScrollId($scrollID)
10611061
->setBody($body);
10621062
$endpoint->setParams($params);
10631063

src/Elasticsearch/ClientBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ClientBuilder
3737
/** @var Transport */
3838
private $transport;
3939

40-
/** @var callback */
40+
/** @var callable */
4141
private $endpoint;
4242

4343
/** @var NamespaceBuilderInterface[] */
@@ -99,7 +99,7 @@ public static function create()
9999

100100
/**
101101
* Can supply first parm to Client::__construct() when invoking manually or with dependency injection
102-
* @return this->ransport
102+
* @return Transport
103103
*
104104
*/
105105
public function getTransport()
@@ -109,7 +109,7 @@ public function getTransport()
109109

110110
/**
111111
* Can supply second parm to Client::__construct() when invoking manually or with dependency injection
112-
* @return this->endpoint
112+
* @return callable
113113
*
114114
*/
115115
public function getEndpoint()
@@ -119,7 +119,7 @@ public function getEndpoint()
119119

120120
/**
121121
* Can supply third parm to Client::__construct() when invoking manually or with dependency injection
122-
* @return this->registeredNamespacesBuilders
122+
* @return NamespaceBuilderInterface[]
123123
*
124124
*/
125125
public function getRegisteredNamespacesBuilders()

src/Elasticsearch/ConnectionPool/Selectors/SelectorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface SelectorInterface
1616
/**
1717
* Perform logic to select a single ConnectionInterface instance from the array provided
1818
*
19-
* @param ConnectionInterface[] $connections an array of ConnectionInterface instances to choose from
19+
* @param \Elasticsearch\Connections\ConnectionInterface[] $connections an array of ConnectionInterface instances to choose from
2020
*
2121
* @return \Elasticsearch\Connections\ConnectionInterface
2222
*/

src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SearchResponseIterator implements Iterator
4444
private $scroll_id;
4545

4646
/**
47-
* @var duration
47+
* @var string duration
4848
*/
4949
private $scroll_ttl;
5050

src/Elasticsearch/Namespaces/AbstractNamespace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class AbstractNamespace
1919
/** @var \Elasticsearch\Transport */
2020
protected $transport;
2121

22-
/** @var callback */
22+
/** @var callable */
2323
protected $endpoints;
2424

2525
/**

src/Elasticsearch/Namespaces/CatNamespace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function allocation($params = array())
6060

6161
/** @var \Elasticsearch\Endpoints\Cat\Allocation $endpoint */
6262
$endpoint = $endpointBuilder('Cat\Allocation');
63-
$endpoint->setNodeID($nodeID);
63+
$endpoint->setNodeId($nodeID);
6464
$endpoint->setParams($params);
6565

6666
return $this->performRequest($endpoint);

0 commit comments

Comments
 (0)