Skip to content

Commit 59cbab1

Browse files
committed
Result object fixes
- i should do this in branch ✨
1 parent 8c6a88f commit 59cbab1

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
parameters:
22
ignoreErrors:
3-
- "Call to function array_key_exists\(\) with string and array\<int, mixed\> will always evaluate to false."
3+
- "#Call to function array_key_exists\\(\\) with string and array<int, mixed> will always evaluate to false#"

src/Response/Result/Hit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Hit
2727
*/
2828
private $id;
2929
/**
30-
* @var string
30+
* @var float
3131
*/
3232
private $score;
3333

@@ -38,7 +38,7 @@ public function __construct(
3838
, string $index
3939
, string $type
4040
, string $id
41-
, string $score
41+
, float $score
4242
)
4343
{
4444
$this->source = $source;
@@ -88,7 +88,7 @@ public function id() : string
8888
}
8989

9090

91-
public function score() : string
91+
public function score() : float
9292
{
9393
return $this->score;
9494
}

src/Response/ResultMapper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public function mapHits(
2424
) : \Spameri\ElasticQuery\Response\Result\HitCollection
2525
{
2626
$hits = [];
27-
foreach ($elasticSearchResponse['hits'] as $hitPosition => $hit) {
28-
$hits[] = $this->mapHit($hit, $hitPosition);
27+
foreach ($elasticSearchResponse['hits']['hits'] as $hitPosition => $hit) {
28+
$hits[] = $this->mapHit($hit, (int) $hitPosition);
2929
}
3030

3131
return new \Spameri\ElasticQuery\Response\Result\HitCollection(
@@ -66,6 +66,7 @@ public function mapAggregations(
6666
);
6767
}
6868

69+
6970
private function mapAggregation(
7071
string $name
7172
, int $position

0 commit comments

Comments
 (0)