Skip to content

Commit

Permalink
Add strict types to other namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sidz committed Mar 24, 2024
1 parent 308188e commit 0b40f26
Show file tree
Hide file tree
Showing 86 changed files with 178 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Bulk/Action.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk;

use Elastica\Bulk;
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/Action/AbstractDocument.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk\Action;

use Elastica\AbstractUpdateAction;
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/Action/CreateDocument.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk\Action;

class CreateDocument extends IndexDocument
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/Action/DeleteDocument.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk\Action;

use Elastica\AbstractUpdateAction;
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/Action/IndexDocument.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk\Action;

use Elastica\AbstractUpdateAction;
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/Action/UpdateDocument.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk\Action;

use Elastica\Document;
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/Response.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk;

use Elastica\Response as BaseResponse;
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk/ResponseSet.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Bulk;

use Elastica\Response as BaseResponse;
Expand Down
2 changes: 2 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica;

use Elastic\Elasticsearch\ClientInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Cluster/Health.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Cluster;

use Elastic\Elasticsearch\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Cluster/Health/Index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Cluster\Health;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Cluster/Health/Shard.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Cluster\Health;

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Cluster/Settings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Cluster;

use Elastica\Client;
Expand Down Expand Up @@ -79,7 +81,7 @@ public function getTransient(string $setting = '')
return $settings[$setting];
}

if (false !== \strpos($setting, '.')) {
if (\str_contains($setting, '.')) {
// convert dot notation to nested arrays
$keys = \explode('.', $setting);
foreach ($keys as $key) {
Expand Down
2 changes: 2 additions & 0 deletions src/Collapse/InnerHits.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Collapse;

use Elastica\Collapse;
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/Bulk/Response/ActionException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception\Bulk\Response;

use Elastica\Bulk\Action;
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/Bulk/ResponseException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception\Bulk;

use Elastica\Bulk\ResponseSet;
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/BulkException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

class BulkException extends \RuntimeException implements ExceptionInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ClientException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/DeprecatedException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/InvalidException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/NotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/NotImplementedException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/QueryBuilderException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/RequestEntityTooLargeException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

class RequestEntityTooLargeException extends \RuntimeException implements ExceptionInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Index/Recovery.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Index;

use Elastica\Index as BaseIndex;
Expand Down
8 changes: 5 additions & 3 deletions src/Index/Settings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Index;

use Elastic\Elasticsearch\Exception\ClientResponseException;
Expand Down Expand Up @@ -110,7 +112,7 @@ public function get(string $setting = '', bool $includeDefaults = false)
return $settings[$setting];
}

if (false !== \strpos($setting, '.')) {
if (\str_contains($setting, '.')) {
// translate old dot-notation settings to nested arrays
$keys = \explode('.', $setting);
foreach ($keys as $key) {
Expand Down Expand Up @@ -178,7 +180,7 @@ public function setNumberOfReplicas(int $replicas): Response
*/
public function getNumberOfReplicas(): int
{
return $this->get('number_of_replicas') ?? self::DEFAULT_NUMBER_OF_REPLICAS;
return (int) ($this->get('number_of_replicas') ?? self::DEFAULT_NUMBER_OF_REPLICAS);
}

/**
Expand All @@ -195,7 +197,7 @@ public function getNumberOfReplicas(): int
*/
public function getNumberOfShards(): int
{
return $this->get('number_of_shards') ?? self::DEFAULT_NUMBER_OF_SHARDS;
return (int) ($this->get('number_of_shards') ?? self::DEFAULT_NUMBER_OF_SHARDS);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Index/Stats.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Index;

use Elastica\Index;
Expand Down
2 changes: 2 additions & 0 deletions src/Multi/MultiBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Multi;

use Elastica\Response;
Expand Down
2 changes: 2 additions & 0 deletions src/Multi/MultiBuilderInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Multi;

use Elastica\Response;
Expand Down
2 changes: 2 additions & 0 deletions src/Multi/ResultSet.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Multi;

use Elastica\Response;
Expand Down
2 changes: 2 additions & 0 deletions src/Multi/Search.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Multi;

use Elastica\Client;
Expand Down
2 changes: 2 additions & 0 deletions src/Node/Info.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Node;

use Elastic\Elasticsearch\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Node/Stats.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Node;

use Elastic\Elasticsearch\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/AbstractProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

use Elastica\Param;
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/AppendProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/AttachmentProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/BytesProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/ConvertProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/DateIndexNameProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/DateProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/DotExpanderProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Processor/FailProcessor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Processor;

/**
Expand Down
Loading

0 comments on commit 0b40f26

Please sign in to comment.