Skip to content

Commit 5b6fe18

Browse files
committed
Revert "Fix for PHPStan issues"
This reverts commit 5a03628.
1 parent 5a03628 commit 5b6fe18

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

+5261
-5983
lines changed

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
2-
level: 5
2+
level: 2
33
paths:
44
- src
55
ignoreErrors:
6-
6+
- '#PHPDoc tag @param has invalid value#'

src/Endpoints/AsyncSearch.php

Lines changed: 76 additions & 81 deletions
Large diffs are not rendered by default.

src/Endpoints/Autoscaling.php

Lines changed: 35 additions & 39 deletions
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?: 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, // A comma-separated list of filters used to reduce the response.
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.
4545
* } $params
4646
*
4747
* @throws MissingParameterException if a required parameter is missing
@@ -51,9 +51,8 @@ class Autoscaling extends AbstractEndpoint
5151
*
5252
* @return Elasticsearch|Promise
5353
*/
54-
public function deleteAutoscalingPolicy(?array $params = null)
54+
public function deleteAutoscalingPolicy(array $params = [])
5555
{
56-
$params = $params ?? [];
5756
$this->checkRequiredParameters(['name'], $params);
5857
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
5958
$method = 'DELETE';
@@ -62,7 +61,7 @@ public function deleteAutoscalingPolicy(?array $params = null)
6261
$headers = [
6362
'Accept' => 'application/json',
6463
];
65-
$request = $this->createRequest($method, $url, $headers);
64+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
6665
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.delete_autoscaling_policy');
6766
return $this->client->sendRequest($request);
6867
}
@@ -74,12 +73,12 @@ public function deleteAutoscalingPolicy(?array $params = null)
7473
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html
7574
*
7675
* @param array{
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, // A comma-separated list of filters used to reduce the response.
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.
8382
* } $params
8483
*
8584
* @throws NoNodeAvailableException if all the hosts are offline
@@ -88,17 +87,16 @@ public function deleteAutoscalingPolicy(?array $params = null)
8887
*
8988
* @return Elasticsearch|Promise
9089
*/
91-
public function getAutoscalingCapacity(?array $params = null)
90+
public function getAutoscalingCapacity(array $params = [])
9291
{
93-
$params = $params ?? [];
9492
$url = '/_autoscaling/capacity';
9593
$method = 'GET';
9694

9795
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
9896
$headers = [
9997
'Accept' => 'application/json',
10098
];
101-
$request = $this->createRequest($method, $url, $headers);
99+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
102100
$request = $this->addOtelAttributes($params, [], $request, 'autoscaling.get_autoscaling_capacity');
103101
return $this->client->sendRequest($request);
104102
}
@@ -111,12 +109,12 @@ public function getAutoscalingCapacity(?array $params = null)
111109
*
112110
* @param array{
113111
* name: string, // (REQUIRED) the name of the autoscaling policy
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, // A comma-separated list of filters used to reduce the response.
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.
120118
* } $params
121119
*
122120
* @throws MissingParameterException if a required parameter is missing
@@ -126,9 +124,8 @@ public function getAutoscalingCapacity(?array $params = null)
126124
*
127125
* @return Elasticsearch|Promise
128126
*/
129-
public function getAutoscalingPolicy(?array $params = null)
127+
public function getAutoscalingPolicy(array $params = [])
130128
{
131-
$params = $params ?? [];
132129
$this->checkRequiredParameters(['name'], $params);
133130
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
134131
$method = 'GET';
@@ -137,7 +134,7 @@ public function getAutoscalingPolicy(?array $params = null)
137134
$headers = [
138135
'Accept' => 'application/json',
139136
];
140-
$request = $this->createRequest($method, $url, $headers);
137+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
141138
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.get_autoscaling_policy');
142139
return $this->client->sendRequest($request);
143140
}
@@ -150,14 +147,14 @@ public function getAutoscalingPolicy(?array $params = null)
150147
*
151148
* @param array{
152149
* name: string, // (REQUIRED) the name 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, // A comma-separated list of filters used to reduce the response.
160-
* body: string|array, // (REQUIRED) the specification of the autoscaling policy. If body is a string must be a valid JSON.
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
161158
* } $params
162159
*
163160
* @throws MissingParameterException if a required parameter is missing
@@ -167,9 +164,8 @@ public function getAutoscalingPolicy(?array $params = null)
167164
*
168165
* @return Elasticsearch|Promise
169166
*/
170-
public function putAutoscalingPolicy(?array $params = null)
167+
public function putAutoscalingPolicy(array $params = [])
171168
{
172-
$params = $params ?? [];
173169
$this->checkRequiredParameters(['name','body'], $params);
174170
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
175171
$method = 'PUT';
@@ -179,7 +175,7 @@ public function putAutoscalingPolicy(?array $params = null)
179175
'Accept' => 'application/json',
180176
'Content-Type' => 'application/json',
181177
];
182-
$request = $this->createRequest($method, $url, $headers, $params['body']);
178+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
183179
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.put_autoscaling_policy');
184180
return $this->client->sendRequest($request);
185181
}

0 commit comments

Comments
 (0)