Skip to content

Commit

Permalink
Fixed phpstan issues after upgrading
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Dec 19, 2024
1 parent 01ce94c commit d7f7a62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php

-
message: '#^Anonymous function should return Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content but returns Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\.$#'
identifier: return.type
count: 1
path: src/lib/QueryFieldService.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:isExpression\(\) has parameter \$expression with no type specified\.$#'
identifier: missingType.parameter
Expand Down
11 changes: 7 additions & 4 deletions src/lib/ContentView/QueryResultsPagerFantaAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Ibexa\Contracts\FieldTypeQuery\QueryFieldServiceInterface;
use Pagerfanta\Adapter\AdapterInterface;

/**
* @implements AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\Content>
*/
final class QueryResultsPagerFantaAdapter implements AdapterInterface
{
/** @var \Ibexa\Contracts\FieldTypeQuery\QueryFieldServiceInterface */
Expand All @@ -32,15 +35,15 @@ public function __construct(
$this->fieldDefinitionIdentifier = $fieldDefinitionIdentifier;
}

public function getNbResults()
public function getNbResults(): int
{
return $this->queryFieldService->countContentItems(
return max($this->queryFieldService->countContentItems(
$this->content,
$this->fieldDefinitionIdentifier
);
), 0);
}

public function getSlice($offset, $length)
public function getSlice($offset, $length): iterable
{
return $this->queryFieldService->loadContentItemsSlice(
$this->content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Ibexa\Contracts\FieldTypeQuery\QueryFieldLocationService;
use Pagerfanta\Adapter\AdapterInterface;

/**
* @implements AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\Content>
*/
final class QueryResultsWithLocationPagerFantaAdapter implements AdapterInterface
{
/** @var \Ibexa\Contracts\FieldTypeQuery\QueryFieldLocationService */
Expand All @@ -32,15 +35,15 @@ public function __construct(
$this->fieldDefinitionIdentifier = $fieldDefinitionIdentifier;
}

public function getNbResults()
public function getNbResults(): int
{
return $this->queryFieldService->countContentItemsForLocation(
return max($this->queryFieldService->countContentItemsForLocation(
$this->location,
$this->fieldDefinitionIdentifier
);
), 0);
}

public function getSlice($offset, $length)
public function getSlice($offset, $length): iterable
{
return $this->queryFieldService->loadContentItemsSliceForLocation(
$this->location,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/GraphQL/QueryFieldResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function resolveQueryField(Field $field, Content $content): iterable
}

/**
* @return \GraphQL\Executor\Promise\Promise|\Overblog\GraphQLBundle\Relay\Connection\Output\Connection|null
* @return \GraphQL\Executor\Promise\Promise|\Overblog\GraphQLBundle\Relay\Connection\Output\Connection<\Ibexa\Contracts\Core\Repository\Values\Content\Content>|null
*/
public function resolveQueryFieldConnection(Argument $args, ?Field $field, Content $content)
{
Expand Down

0 comments on commit d7f7a62

Please sign in to comment.