Skip to content

Commit 1348fbe

Browse files
committed
Fixed phpstan issue
1 parent 3e7fa92 commit 1348fbe

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

phpstan-src-71.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ parameters:
66
- '#Variable (.*) in isset\(\) always exists and is not nullable.#'
77
- '#Constant JSON_THROW_ON_ERROR not found#'
88
- '#class JsonException#'
9+
-
10+
message: '#is not subtype of Throwable#'
11+
path: %currentWorkingDirectory%/src/Elasticsearch/ClientBuilder.php

phpstan-src.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ parameters:
44
# nullable types are missing everywhere
55
# this should be removed and fixed in the code later
66
- '#Variable (.*) in isset\(\) always exists and is not nullable.#'
7+
-
8+
message: '#is not subtype of Throwable#'
9+
path: %currentWorkingDirectory%/src/Elasticsearch/ClientBuilder.php

src/Elasticsearch/ClientBuilder.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,9 @@ public function setHosts(array $hosts): ClientBuilder
337337
*
338338
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
339339
*
340-
* @param string $id
341-
* @param string $apiKey
342-
*
343340
* @throws Elasticsearch\Common\Exceptions\AuthenticationConfigException
344341
*/
345-
public function setApiKey(string $id, string $apiKey)
342+
public function setApiKey(string $id, string $apiKey): ClientBuilder
346343
{
347344
if (isset($this->connectionParams['client']['curl'][CURLOPT_HTTPAUTH]) === true) {
348345
throw new AuthenticationConfigException("You can't use APIKey - and Basic Authenication together.");
@@ -363,7 +360,7 @@ public function setApiKey(string $id, string $apiKey)
363360
*
364361
* @throws Elasticsearch\Common\Exceptions\AuthenticationConfigException
365362
*/
366-
public function setBasicAuthentication(string $username, string $password)
363+
public function setBasicAuthentication(string $username, string $password): ClientBuilder
367364
{
368365
if (isset($this->connectionParams['client']['headers']['Authorization']) === true) {
369366
throw new AuthenticationConfigException("You can't use APIKey - and Basic Authenication together.");
@@ -388,7 +385,7 @@ public function setBasicAuthentication(string $username, string $password)
388385
*
389386
* @param string $cloudId
390387
*/
391-
public function setElasticCloudId(string $cloudId)
388+
public function setElasticCloudId(string $cloudId): ClientBuilder
392389
{
393390
// Register the Hosts array
394391
$this->setHosts([

src/Elasticsearch/Common/Exceptions/AuthenticationConfigException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<?php declare(strict_types = 1);
1+
<?php
2+
declare(strict_types = 1);
23

34
// Licensed to Elasticsearch B.V under one or more agreements.
45
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.

0 commit comments

Comments
 (0)