drupal-graphql / graphql

GraphQL integration for Drupal 9/10
286 stars 202 forks source link

feat(DataProducer): make sure Weight returns int #1330

Closed aurelianzaha closed 1 year ago

aurelianzaha commented 1 year ago

Implicit conversion fo float to int generates warning in PHP 8.1 e.g.: Deprecated function: Implicit conversion from float 2.5 to int loses precision in Drupal\graphql\Plugin\GraphQL\DataProducer\EntityDefinition\Fields\Weight->resolve() (line 52 of /var/www/html/backend/web/modules/contrib/graphql/src/Plugin/GraphQL/DataProducer/EntityDefinition/Fields/Weight.php)

klausi commented 1 year ago

This happens because we sometimes use float as weight for custom fields that need to be between 2 other predefined fields. That is only half-supported by Drupal core anyway, so I think we can use this as is without test case.