Skip to content

Commit 912dd12

Browse files
mhujerpolyfractal
authored andcommitted
Upgrade to PHPStan 0.9.1 (#713)
* fix invalid types in phpdoc in src/ * fix invalid types in phpdoc in tests/ * PHPStan 0.9.1
1 parent 6c91ce6 commit 912dd12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+451
-292
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
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.5",
22+
"phpstan/phpstan-shim": "0.9.1",
2323
"phpunit/phpunit": "6.3.0",
2424
"squizlabs/php_codesniffer": "3.0.2",
2525
"symfony/finder": "^2.8",

phpstan-src.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
parameters:
22
ignoreErrors:
3+
4+
# nullable types are missing everywhere
5+
# this should be removed and fixed in the code later
6+
- '#Variable (.*) in isset\(\) always exists and is not nullable.#'

phpstan-tests.neon

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ parameters:
22
ignoreErrors:
33
- '#Mockery\\MockInterface::shouldReceive\(\)#'
44
- '#Mockery\\MockInterface given#'
5-
- '#Mockery\\MockInterface\[\] given#'
65

76
# because of \Elasticsearch\Tests\RegisteredNamespaceTest
87
- '#Call to an undefined method Elasticsearch\\Client::foo\(\)#'
98
- '#Call to an undefined method Elasticsearch\\Client::bar\(\)#'
109

1110
# because of \Elasticsearch\Tests\ClientBuilderTest
1211
- '#expects Psr\\Log\\LoggerInterface, Elasticsearch\\Tests\\ClientBuilder\\DummyLogger given.$#'
12+
13+
# probably PHPStan issue, because it actually works https://3v4l.org/s3U2B
14+
- '#Argument of an invalid type array\|stdClass supplied for foreach, only iterables are supported#'

src/Elasticsearch/Client.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function __construct(Transport $transport, callable $endpoint, array $reg
111111
}
112112

113113
/**
114-
* @param $params
114+
* @param string[] $params
115115
* @return array
116116
*/
117117
public function info($params = [])
@@ -127,7 +127,7 @@ public function info($params = [])
127127
}
128128

129129
/**
130-
* @param $params array Associative array of parameters
130+
* @param array $params Associative array of parameters
131131
*
132132
* @return bool
133133
*/
@@ -168,7 +168,7 @@ public function ping($params = [])
168168
* ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field
169169
* ['_source_include'] = (list) A list of fields to extract and return from the _source field
170170
*
171-
* @param $params array Associative array of parameters
171+
* @param array $params Associative array of parameters
172172
*
173173
* @return array
174174
*/
@@ -202,7 +202,7 @@ public function get($params)
202202
* ['refresh'] = (boolean) Refresh the shard containing the document before performing the operation
203203
* ['routing'] = (string) Specific routing value
204204
*
205-
* @param $params array Associative array of parameters
205+
* @param array $params Associative array of parameters
206206
*
207207
* @return array
208208
*/
@@ -238,7 +238,7 @@ public function getSource($params)
238238
* ['timeout'] = (time) Explicit operation timeout
239239
* ['version_type'] = (enum) Specific version type
240240
*
241-
* @param $params array Associative array of parameters
241+
* @param array $params Associative array of parameters
242242
*
243243
* @return array
244244
*/
@@ -337,7 +337,7 @@ public function deleteByQuery($params = array())
337337
* ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
338338
* ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
339339
*
340-
* @param $params array Associative array of parameters
340+
* @param array $params Associative array of parameters
341341
*
342342
* @return array
343343
*/
@@ -375,7 +375,7 @@ public function count($params = array())
375375
* ['version'] = (number) Explicit version number for concurrency control
376376
* ['version_type'] = (enum) Specific version type
377377
*
378-
* @param $params array Associative array of parameters
378+
* @param array $params Associative array of parameters
379379
*
380380
* @return array
381381
*
@@ -408,7 +408,7 @@ public function countPercolate($params = array())
408408
* ['prefer_local'] = (boolean) With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)
409409
* ['body'] = (array) The document (`doc`) to percolate against registered queries; optionally also a `query` to limit the percolation to specific registered queries
410410
*
411-
* @param $params array Associative array of parameters
411+
* @param array $params Associative array of parameters
412412
*
413413
* @return array
414414
*
@@ -442,7 +442,7 @@ public function percolate($params)
442442
* ['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
443443
* ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
444444
*
445-
* @param $params array Associative array of parameters
445+
* @param array $params Associative array of parameters
446446
*
447447
* @return array
448448
*
@@ -481,7 +481,7 @@ public function mpercolate($params = array())
481481
* ['parent'] = (string) Parent id of documents. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".
482482
* ['realtime'] = (boolean) Specifies if request is real-time as opposed to near-real-time (default: true).
483483
*
484-
* @param $params array Associative array of parameters
484+
* @param array $params Associative array of parameters
485485
*
486486
* @return array
487487
*/
@@ -521,7 +521,7 @@ public function termvectors($params = array())
521521
* ['parent'] = (string) Parent id of documents. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".
522522
* ['realtime'] = (boolean) Specifies if request is real-time as opposed to near-real-time (default: true).
523523
*
524-
* @param $params array Associative array of parameters
524+
* @param array $params Associative array of parameters
525525
*
526526
* @return array
527527
*/
@@ -554,7 +554,7 @@ public function mtermvectors($params = array())
554554
* ['refresh'] = (boolean) Refresh the shard containing the document before performing the operation
555555
* ['routing'] = (string) Specific routing value
556556
*
557-
* @param $params array Associative array of parameters
557+
* @param array $params Associative array of parameters
558558
*
559559
* @return array | boolean
560560
*/
@@ -594,7 +594,7 @@ public function exists($params)
594594
* ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field
595595
* ['_source_include'] = (list) A list of fields to extract and return from the _source field
596596
*
597-
* @param $params array Associative array of parameters
597+
* @param array $params Associative array of parameters
598598
*
599599
* @return array
600600
*/
@@ -623,7 +623,7 @@ public function mget($params = array())
623623
* ['search_type'] = (enum) Search operation type
624624
* ['body'] = (array|string) The request definitions (metadata-search request definition pairs), separated by newlines
625625
*
626-
* @param $params array Associative array of parameters
626+
* @param array $params Associative array of parameters
627627
*
628628
* @return array
629629
*/
@@ -653,7 +653,7 @@ public function msearch($params = array())
653653
* ['body'] = (array|string) The request definitions (metadata-search request definition pairs), separated by newlines
654654
* ['max_concurrent_searches'] = (number) Controls the maximum number of concurrent searches the multi search api will execute
655655
*
656-
* @param $params array Associative array of parameters
656+
* @param array $params Associative array of parameters
657657
*
658658
* @return array
659659
*/
@@ -692,7 +692,7 @@ public function msearchTemplate($params = array())
692692
* ['version_type'] = (enum) Specific version type
693693
* ['body'] = (array) The document
694694
*
695-
* @param $params array Associative array of parameters
695+
* @param array $params Associative array of parameters
696696
*
697697
* @return array
698698
*/
@@ -726,7 +726,7 @@ public function create($params)
726726
* ['fields'] = (list) Default comma-separated list of fields to return in the response for updates
727727
* ['body'] = (array) The document
728728
*
729-
* @param $params array Associative array of parameters
729+
* @param array $params Associative array of parameters
730730
*
731731
* @return array
732732
*/
@@ -766,7 +766,7 @@ public function bulk($params = array())
766766
* ['version_type'] = (enum) Specific version type
767767
* ['body'] = (array) The document
768768
*
769-
* @param $params array Associative array of parameters
769+
* @param array $params Associative array of parameters
770770
*
771771
* @return array
772772
*/
@@ -799,7 +799,7 @@ public function index($params)
799799
* ['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
800800
* ['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
801801
*
802-
* @param $params array Associative array of parameters
802+
* @param array $params Associative array of parameters
803803
*
804804
* @return array
805805
*/
@@ -825,7 +825,7 @@ public function reindex($params)
825825
* ['source'] = (string) The URL-encoded request definition (instead of using request body)
826826
* ['body'] = (array) The request definition
827827
*
828-
* @param $params array Associative array of parameters
828+
* @param array $params Associative array of parameters
829829
*
830830
* @return array
831831
*/
@@ -867,7 +867,7 @@ public function suggest($params = array())
867867
* ['_source_include'] = (list) A list of fields to extract and return from the _source field
868868
* ['body'] = (string) The URL-encoded query definition (instead of using the request body)
869869
*
870-
* @param $params array Associative array of parameters
870+
* @param array $params Associative array of parameters
871871
*
872872
* @return array
873873
*/
@@ -929,7 +929,7 @@ public function explain($params)
929929
* ['version'] = (boolean) Specify whether to return document version as part of a hit
930930
* ['body'] = (array|string) The search definition using the Query DSL
931931
*
932-
* @param $params array Associative array of parameters
932+
* @param array $params Associative array of parameters
933933
*
934934
* @return array
935935
*/
@@ -962,7 +962,7 @@ public function search($params = array())
962962
* ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
963963
* ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
964964
*
965-
* @param $params array Associative array of parameters
965+
* @param array $params Associative array of parameters
966966
*
967967
* @return array
968968
*/
@@ -987,7 +987,7 @@ public function searchShards($params = array())
987987
* $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
988988
* ['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types
989989
*
990-
* @param $params array Associative array of parameters
990+
* @param array $params Associative array of parameters
991991
*
992992
* @return array
993993
*/
@@ -1015,7 +1015,7 @@ public function searchTemplate($params = array())
10151015
* ['scroll'] = (duration) Specify how long a consistent view of the index should be maintained for scrolled search
10161016
* ['body'] = (string) The scroll ID for scrolled search
10171017
*
1018-
* @param $params array Associative array of parameters
1018+
* @param array $params Associative array of parameters
10191019
*
10201020
* @return array
10211021
*/
@@ -1043,7 +1043,7 @@ public function scroll($params = array())
10431043
* ['scroll'] = (duration) Specify how long a consistent view of the index should be maintained for scrolled search
10441044
* ['body'] = (string) The scroll ID for scrolled search
10451045
*
1046-
* @param $params array Associative array of parameters
1046+
* @param array $params Associative array of parameters
10471047
*
10481048
* @return array
10491049
*/
@@ -1083,7 +1083,7 @@ public function clearScroll($params = array())
10831083
* ['version_type'] = (number) Explicit version number for concurrency control
10841084
* ['body'] = (array) The request definition using either `script` or partial `doc`
10851085
*
1086-
* @param $params array Associative array of parameters
1086+
* @param array $params Associative array of parameters
10871087
*
10881088
* @return array
10891089
*/
@@ -1204,7 +1204,7 @@ public function updateByQuery($params = array())
12041204
* $params['id'] = (string) The script ID (Required)
12051205
* ['lang'] = (string) The script language (Required)
12061206
*
1207-
* @param $params array Associative array of parameters
1207+
* @param array $params Associative array of parameters
12081208
*
12091209
* @return array
12101210
*/
@@ -1229,7 +1229,7 @@ public function getScript($params)
12291229
* $params['id'] = (string) The script ID (Required)
12301230
* ['lang'] = (string) The script language (Required)
12311231
*
1232-
* @param $params array Associative array of parameters
1232+
* @param array $params Associative array of parameters
12331233
*
12341234
* @return array
12351235
*/
@@ -1254,7 +1254,7 @@ public function deleteScript($params)
12541254
* $params['id'] = (string) The script ID (Required)
12551255
* ['lang'] = (string) The script language (Required)
12561256
*
1257-
* @param $params array Associative array of parameters
1257+
* @param array $params Associative array of parameters
12581258
*
12591259
* @return array
12601260
*/
@@ -1279,7 +1279,7 @@ public function putScript($params)
12791279
/**
12801280
* $params['id'] = (string) The search template ID (Required)
12811281
*
1282-
* @param $params array Associative array of parameters
1282+
* @param array $params Associative array of parameters
12831283
*
12841284
* @return array
12851285
*/
@@ -1301,7 +1301,7 @@ public function getTemplate($params)
13011301
/**
13021302
* $params['id'] = (string) The search template ID (Required)
13031303
*
1304-
* @param $params array Associative array of parameters
1304+
* @param array $params Associative array of parameters
13051305
*
13061306
* @return array
13071307
*/
@@ -1328,7 +1328,7 @@ public function deleteTemplate($params)
13281328
* ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
13291329
* ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
13301330
*
1331-
* @param $params array Associative array of parameters
1331+
* @param array $params Associative array of parameters
13321332
*
13331333
* @return array
13341334
*/
@@ -1355,7 +1355,7 @@ public function fieldStats($params = array())
13551355
* ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
13561356
* ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
13571357
*
1358-
* @param $params array Associative array of parameters
1358+
* @param array $params Associative array of parameters
13591359
*
13601360
* @return array
13611361
*/
@@ -1379,7 +1379,7 @@ public function fieldCaps($params = array())
13791379
/**
13801380
* $params['id'] = (string) ID of the template to render
13811381
*
1382-
* @param $params array Associative array of parameters
1382+
* @param array $params Associative array of parameters
13831383
*
13841384
* @return array
13851385
*/
@@ -1483,8 +1483,8 @@ public function remote()
14831483
/**
14841484
* Catchall for registered namespaces
14851485
*
1486-
* @param $name
1487-
* @param $arguments
1486+
* @param string $name
1487+
* @param array $arguments
14881488
* @return Object
14891489
* @throws BadMethodCallException if the namespace cannot be found
14901490
*/
@@ -1538,7 +1538,7 @@ private function verifyNotNullOrEmpty($name, $var)
15381538
}
15391539

15401540
/**
1541-
* @param $endpoint AbstractEndpoint
1541+
* @param AbstractEndpoint $endpoint
15421542
*
15431543
* @throws \Exception
15441544
* @return array

0 commit comments

Comments
 (0)