Skip to content

Commit 4139cc6

Browse files
committed
Fixes for PHPStan issues
1 parent dbd0699 commit 4139cc6

Some content is hidden

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

46 files changed

+5982
-5262
lines changed

phpstan.neon

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
parameters:
2-
level: 2
2+
level: 5
33
paths:
44
- src
5-
ignoreErrors:
6-
- '#PHPDoc tag @param has invalid value#'

src/Endpoints/AsyncSearch.php

+81-76
Large diffs are not rendered by default.

src/Endpoints/Autoscaling.php

+39-35
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class Autoscaling extends AbstractEndpoint
3535
*
3636
* @param array{
3737
* name: string, // (REQUIRED) the name of the autoscaling policy
38-
* master_timeout: time, // Timeout for processing on master node
39-
* timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
40-
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
41-
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
42-
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
43-
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
44-
* filter_path: list, // A comma-separated list of filters used to reduce the response.
38+
* master_timeout?: int|string, // Timeout for processing on master node
39+
* timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster
40+
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
41+
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
42+
* error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false)
43+
* source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
44+
* filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response.
4545
* } $params
4646
*
4747
* @throws MissingParameterException if a required parameter is missing
@@ -51,8 +51,9 @@ class Autoscaling extends AbstractEndpoint
5151
*
5252
* @return Elasticsearch|Promise
5353
*/
54-
public function deleteAutoscalingPolicy(array $params = [])
54+
public function deleteAutoscalingPolicy(?array $params = null)
5555
{
56+
$params = $params ?? [];
5657
$this->checkRequiredParameters(['name'], $params);
5758
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
5859
$method = 'DELETE';
@@ -61,7 +62,7 @@ public function deleteAutoscalingPolicy(array $params = [])
6162
$headers = [
6263
'Accept' => 'application/json',
6364
];
64-
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
65+
$request = $this->createRequest($method, $url, $headers);
6566
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.delete_autoscaling_policy');
6667
return $this->client->sendRequest($request);
6768
}
@@ -73,12 +74,12 @@ public function deleteAutoscalingPolicy(array $params = [])
7374
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html
7475
*
7576
* @param array{
76-
* master_timeout: time, // Timeout for processing on master node
77-
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
78-
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
79-
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
80-
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
81-
* filter_path: list, // A comma-separated list of filters used to reduce the response.
77+
* master_timeout?: int|string, // Timeout for processing on master node
78+
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
79+
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
80+
* error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false)
81+
* source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
82+
* filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response.
8283
* } $params
8384
*
8485
* @throws NoNodeAvailableException if all the hosts are offline
@@ -87,16 +88,17 @@ public function deleteAutoscalingPolicy(array $params = [])
8788
*
8889
* @return Elasticsearch|Promise
8990
*/
90-
public function getAutoscalingCapacity(array $params = [])
91+
public function getAutoscalingCapacity(?array $params = null)
9192
{
93+
$params = $params ?? [];
9294
$url = '/_autoscaling/capacity';
9395
$method = 'GET';
9496

9597
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
9698
$headers = [
9799
'Accept' => 'application/json',
98100
];
99-
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
101+
$request = $this->createRequest($method, $url, $headers);
100102
$request = $this->addOtelAttributes($params, [], $request, 'autoscaling.get_autoscaling_capacity');
101103
return $this->client->sendRequest($request);
102104
}
@@ -109,12 +111,12 @@ public function getAutoscalingCapacity(array $params = [])
109111
*
110112
* @param array{
111113
* name: string, // (REQUIRED) the name of the autoscaling policy
112-
* master_timeout: time, // Timeout for processing on master node
113-
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
114-
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
115-
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
116-
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
117-
* filter_path: list, // A comma-separated list of filters used to reduce the response.
114+
* master_timeout?: int|string, // Timeout for processing on master node
115+
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
116+
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
117+
* error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false)
118+
* source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
119+
* filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response.
118120
* } $params
119121
*
120122
* @throws MissingParameterException if a required parameter is missing
@@ -124,8 +126,9 @@ public function getAutoscalingCapacity(array $params = [])
124126
*
125127
* @return Elasticsearch|Promise
126128
*/
127-
public function getAutoscalingPolicy(array $params = [])
129+
public function getAutoscalingPolicy(?array $params = null)
128130
{
131+
$params = $params ?? [];
129132
$this->checkRequiredParameters(['name'], $params);
130133
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
131134
$method = 'GET';
@@ -134,7 +137,7 @@ public function getAutoscalingPolicy(array $params = [])
134137
$headers = [
135138
'Accept' => 'application/json',
136139
];
137-
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
140+
$request = $this->createRequest($method, $url, $headers);
138141
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.get_autoscaling_policy');
139142
return $this->client->sendRequest($request);
140143
}
@@ -147,14 +150,14 @@ public function getAutoscalingPolicy(array $params = [])
147150
*
148151
* @param array{
149152
* name: string, // (REQUIRED) the name of the autoscaling policy
150-
* master_timeout: time, // Timeout for processing on master node
151-
* timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
152-
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
153-
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
154-
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
155-
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
156-
* filter_path: list, // A comma-separated list of filters used to reduce the response.
157-
* body: array, // (REQUIRED) the specification of the autoscaling policy
153+
* master_timeout?: int|string, // Timeout for processing on master node
154+
* timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster
155+
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
156+
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
157+
* error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false)
158+
* source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
159+
* filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response.
160+
* body: string|array<mixed>, // (REQUIRED) the specification of the autoscaling policy. If body is a string must be a valid JSON.
158161
* } $params
159162
*
160163
* @throws MissingParameterException if a required parameter is missing
@@ -164,8 +167,9 @@ public function getAutoscalingPolicy(array $params = [])
164167
*
165168
* @return Elasticsearch|Promise
166169
*/
167-
public function putAutoscalingPolicy(array $params = [])
170+
public function putAutoscalingPolicy(?array $params = null)
168171
{
172+
$params = $params ?? [];
169173
$this->checkRequiredParameters(['name','body'], $params);
170174
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
171175
$method = 'PUT';
@@ -175,7 +179,7 @@ public function putAutoscalingPolicy(array $params = [])
175179
'Accept' => 'application/json',
176180
'Content-Type' => 'application/json',
177181
];
178-
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
182+
$request = $this->createRequest($method, $url, $headers, $params['body']);
179183
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.put_autoscaling_policy');
180184
return $this->client->sendRequest($request);
181185
}

0 commit comments

Comments
 (0)