Skip to content

Commit

Permalink
Fixed phpstan issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Aug 12, 2019
1 parent 3e7fa92 commit 1348fbe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions phpstan-src-71.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ parameters:
- '#Variable (.*) in isset\(\) always exists and is not nullable.#'
- '#Constant JSON_THROW_ON_ERROR not found#'
- '#class JsonException#'
-
message: '#is not subtype of Throwable#'
path: %currentWorkingDirectory%/src/Elasticsearch/ClientBuilder.php
3 changes: 3 additions & 0 deletions phpstan-src.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ parameters:
# nullable types are missing everywhere
# this should be removed and fixed in the code later
- '#Variable (.*) in isset\(\) always exists and is not nullable.#'
-
message: '#is not subtype of Throwable#'
path: %currentWorkingDirectory%/src/Elasticsearch/ClientBuilder.php
9 changes: 3 additions & 6 deletions src/Elasticsearch/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,9 @@ public function setHosts(array $hosts): ClientBuilder
*
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
*
* @param string $id
* @param string $apiKey
*
* @throws Elasticsearch\Common\Exceptions\AuthenticationConfigException
*/
public function setApiKey(string $id, string $apiKey)
public function setApiKey(string $id, string $apiKey): ClientBuilder
{
if (isset($this->connectionParams['client']['curl'][CURLOPT_HTTPAUTH]) === true) {
throw new AuthenticationConfigException("You can't use APIKey - and Basic Authenication together.");
Expand All @@ -363,7 +360,7 @@ public function setApiKey(string $id, string $apiKey)
*
* @throws Elasticsearch\Common\Exceptions\AuthenticationConfigException
*/
public function setBasicAuthentication(string $username, string $password)
public function setBasicAuthentication(string $username, string $password): ClientBuilder
{
if (isset($this->connectionParams['client']['headers']['Authorization']) === true) {
throw new AuthenticationConfigException("You can't use APIKey - and Basic Authenication together.");
Expand All @@ -388,7 +385,7 @@ public function setBasicAuthentication(string $username, string $password)
*
* @param string $cloudId
*/
public function setElasticCloudId(string $cloudId)
public function setElasticCloudId(string $cloudId): ClientBuilder
{
// Register the Hosts array
$this->setHosts([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php declare(strict_types = 1);
<?php
declare(strict_types = 1);

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

0 comments on commit 1348fbe

Please sign in to comment.