Skip to content

Commit

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Bulk.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/ClientConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Cluster.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Collapse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

use Elastica\Bulk\Action;
Expand Down
2 changes: 2 additions & 0 deletions src/Index.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/IndexTemplate.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

use Elastica\Exception\QueryBuilderException;
Expand Down
2 changes: 2 additions & 0 deletions src/Reindex.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

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

declare(strict_types=1);

namespace Elastica;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Scroll.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Search.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/SearchableInterface.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\Exception\ClientResponseException;
Expand Down
2 changes: 2 additions & 0 deletions src/Snapshot.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\Exception\ClientResponseException;
Expand Down
6 changes: 3 additions & 3 deletions src/Status.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\Exception\ClientResponseException;
Expand Down Expand Up @@ -63,9 +65,7 @@ public function getIndexNames()
{
$data = $this->getData();

return \array_map(static function ($name): string {
return (string) $name;
}, \array_keys($data['indices']));
return \array_map(static fn ($name): string => (string) $name, \array_keys($data['indices']));
}

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

declare(strict_types=1);

namespace Elastica;

use Elastica\Exception\NotImplementedException;
Expand Down
2 changes: 2 additions & 0 deletions src/Task.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\Exception\ClientResponseException;
Expand Down
6 changes: 4 additions & 2 deletions src/Util.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica;

/**
Expand Down Expand Up @@ -28,7 +30,7 @@ class Util
public static function isDateMathEscaped($requestUri)
{
// In practice, the only symbol that really needs to be escaped in URI is '/' => '%2F'
return false !== \strpos(\strtoupper($requestUri), '%2F');
return \str_contains(\strtoupper($requestUri), '%2F');
}

/**
Expand Down Expand Up @@ -64,7 +66,7 @@ public static function escapeDateMath($requestUri)
$escapedUriSegment = \str_replace(static::$dateMathSymbols, static::$escapedDateMathSymbols, $uriSegment);

// '\\{' and '\\}' should not be escaped
if (false !== \strpos($uriSegment, '\\\\')) {
if (\str_contains($uriSegment, '\\\\')) {
$escapedUriSegment = \str_replace(['\\\\%7B', '\\\\%7D'], ['\\\\{', '\\\\}'], $escapedUriSegment);
}

Expand Down

0 comments on commit 1046d27

Please sign in to comment.