diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8d198a1b7..0e7d0ed3a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -22,9 +22,6 @@ jobs: drupal-core: '10.2.x' phpstan: '0' # We only need to run PHPStan once on the latest PHP version. - - php-versions: '8.3' - drupal-core: '10.3.x' - phpstan: '1' - php-versions: '8.3' drupal-core: '11.0.x' phpstan: '1' diff --git a/src/Entity/Server.php b/src/Entity/Server.php index 78511c4da..3f4ffec80 100644 --- a/src/Entity/Server.php +++ b/src/Entity/Server.php @@ -518,7 +518,6 @@ protected function getPersistedQueryLoader() { protected function getValidationRules() { return function (OperationParams $params, DocumentNode $document, $operation) { // queryId is not documented properly in the library, it can be NULL. - // @phpstan-ignore-next-line if (isset($params->queryId)) { // Assume that pre-parsed documents are already validated. This allows // us to store pre-validated query documents e.g. for persisted queries @@ -528,7 +527,6 @@ protected function getValidationRules() { // PHPStan thinks this is unreachable code because of the wrongly // documented $params->queryId. - // @phpstan-ignore-next-line $rules = array_values(DocumentValidator::defaultRules()); if ($this->getDisableIntrospection()) { $rules[] = new DisableIntrospection(); diff --git a/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php b/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php index a77d32ad7..959694dad 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php @@ -97,12 +97,16 @@ public function resolve(FileInterface $entity = NULL, $style, RefinableCacheable $access = $entity->access('view', NULL, TRUE); $metadata->addCacheableDependency($access); if ($access->isAllowed() && $image_style = ImageStyle::load($style)) { - - /** @var \Drupal\Core\Image\ImageInterface $image */ - $image = \Drupal::service('image.factory')->get($entity->getFileUri()); - if ($image->isValid()) { - $width = $image->getWidth(); - $height = $image->getHeight(); + $width = $entity->width; + $height = $entity->height; + + if (!isset($width) || !isset($height)) { + /** @var \Drupal\Core\Image\ImageInterface $image */ + $image = \Drupal::service('image.factory')->get($entity->getFileUri()); + if ($image->isValid()) { + $width = $image->getWidth(); + $height = $image->getHeight(); + } } // Determine the dimensions of the styled image. diff --git a/tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageDerivativeTest.php b/tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageDerivativeTest.php index 375fff3ae..2576720eb 100644 --- a/tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageDerivativeTest.php +++ b/tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageDerivativeTest.php @@ -62,6 +62,9 @@ public function setUp(): void { $this->file->method('getFileUri')->willReturn($this->fileUri); $this->file->method('access')->willReturn((new AccessResultAllowed())->addCacheTags(['test_tag'])); + // @todo Remove hard-coded properties and only rely on image factory. + @$this->file->width = 600; + @$this->file->height = 400; $this->style = ImageStyle::create(['name' => 'test_style']); $effect = [