Skip to content

Commit 429b5c3

Browse files
committed
chore: PHPStan fixes for always-false instanceof and redundant nullsafe
* TypeBuilder: `$operation instanceof Query` is always false inside the `$wrapData` block since `$wrapData` requires Mutation|Subscription * PartialCollectionViewNormalizer: inside `if ($isPaginatedWithCursor)`, `$operation` is narrowed to non-nullable HttpOperation — use `->` not `?->`
1 parent 0dcd59d commit 429b5c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/GraphQl/Type/TypeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private function getResourceObjectTypeConfiguration(string $shortName, ResourceM
343343
$wrappedOperationName = $operationName;
344344

345345
if (!$useWrappedType) {
346-
$wrappedOperationName = $operation instanceof Query ? $operationName : 'item_query';
346+
$wrappedOperationName = 'item_query';
347347
}
348348

349349
$wrappedOperation = $resourceMetadataCollection->getOperation($wrappedOperationName);

src/Hydra/Serializer/PartialCollectionViewNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function normalize(mixed $object, ?string $format = null, array $context
9090
if ($isPaginatedWithCursor) {
9191
$data[$hydraPrefix.'view'] = ['@id' => null, '@type' => $hydraPrefix.'PartialCollectionView'];
9292

93-
return $this->populateDataWithCursorBasedPagination($data, $parsed, $object, $cursorPaginationAttribute, $operation?->getUrlGenerationStrategy() ?? $this->urlGenerationStrategy, $hydraPrefix);
93+
return $this->populateDataWithCursorBasedPagination($data, $parsed, $object, $cursorPaginationAttribute, $operation->getUrlGenerationStrategy() ?? $this->urlGenerationStrategy, $hydraPrefix);
9494
}
9595

9696
$partialCollectionView = $this->getPartialCollectionView($object, $context['uri'] ?? $context['request_uri'] ?? '/', $this->pageParameterName, $this->enabledParameterName, $operation?->getUrlGenerationStrategy() ?? $this->urlGenerationStrategy);

0 commit comments

Comments
 (0)