From b9614c5b53e11c2cbf6f6a16a6f2ce461d37c47e Mon Sep 17 00:00:00 2001 From: Klaus Purer Date: Fri, 22 Sep 2023 13:05:50 +0200 Subject: [PATCH] style(coder): Upgrde Coder to 8.3.21 (#1363) --- .github/workflows/testing.yml | 48 +++++++++---------- .../GraphQL/DataProducer/CreateArticle.php | 2 +- src/Entity/Server.php | 8 ++-- src/Event/OperationEvent.php | 2 +- src/EventSubscriber/ApqSubscriber.php | 2 +- src/GraphQL/Execution/ExecutionResult.php | 2 +- src/GraphQL/Resolver/Composite.php | 4 +- src/GraphQL/ResolverBuilder.php | 2 +- src/GraphQL/ResolverRegistry.php | 2 +- src/GraphQL/Utility/FileUpload.php | 4 +- .../DataProducer/DataProducerPluginBase.php | 4 +- .../DataProducer/DataProducerProxy.php | 2 +- .../DataProducer/Entity/EntityAccess.php | 2 +- .../Entity/Fields/Image/ImageUrl.php | 2 +- .../Field/EntityReferenceLayoutRevisions.php | 2 +- .../Field/EntityReferenceRevisions.php | 2 +- .../Schema/AlterableComposableSchema.php | 6 +-- .../GraphQL/Schema/ComposableSchema.php | 2 +- src/Plugin/SchemaExtensionPluginInterface.php | 2 +- src/Plugin/SchemaPluginInterface.php | 2 +- .../graphql_file_validate.module | 2 +- .../DataProducer/EntityDefinitionTest.php | 4 +- .../DataProducer/EntityMultipleTest.php | 6 +-- .../DataProducer/EntityReferenceTest.php | 6 +-- tests/src/Kernel/DataProducer/EntityTest.php | 12 ++--- tests/src/Kernel/DataProducer/MenuTest.php | 8 ++-- .../Framework/DisabledResultCacheTest.php | 2 +- .../src/Kernel/Framework/ResultCacheTest.php | 6 +-- .../Kernel/Framework/TestFrameworkTest.php | 2 +- tests/src/Kernel/GraphQLTestBase.php | 2 +- tests/src/Kernel/ResolverBuilderTest.php | 2 +- tests/src/Traits/MockingTrait.php | 4 +- 32 files changed, 78 insertions(+), 80 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b73f64bc9..f18d2eeb8 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -7,7 +7,7 @@ on: jobs: drupal: name: Drupal ${{ matrix.drupal-core }} (PHP ${{ matrix.php-versions }}) - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: extensions: mbstring, xml, pdo_sqlite, gd, opcache strategy: @@ -65,7 +65,7 @@ jobs: - name: Get composer cache directory id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache composer dependencies uses: actions/cache@v3 @@ -83,25 +83,11 @@ jobs: composer config --no-plugins allow-plugins.phpstan/extension-installer true - name: Install GraphQL dependencies - run: composer --no-interaction --no-progress require \ - webonyx/graphql-php:^14.8 \ - drupal/typed_data:^1.0 \ - drupal/redirect:^1.0 \ - phpstan/phpstan:^1.10.32 \ - mglaman/phpstan-drupal:^1.1.2 \ - phpstan/phpstan-deprecation-rules:^1.0.0 \ - jangregor/phpstan-prophecy:^1.0.0 \ - phpstan/phpstan-phpunit:^1.0.0 \ - phpstan/extension-installer:^1.0 - - # We install Coder separately because updating did not work in the local - # Drupal vendor dir. - - name: Install Coder run: | - mkdir coder - cd coder - echo '{"config": {"allow-plugins": {"dealerdirect/phpcodesniffer-composer-installer": true}}}' > composer.json - composer require drupal/coder:8.3.15 --no-interaction --no-progress + composer --no-interaction --no-progress require \ + webonyx/graphql-php:^14.8 \ + drupal/typed_data:^1.0 \ + drupal/redirect:^1.0 - name: Run PHPUnit run: | @@ -110,11 +96,23 @@ jobs: env: SIMPLETEST_DB: "sqlite://localhost/:memory:" + - name: Install PHPStan and Coder dependencies + if: ${{ matrix.phpstan == '1' }} + # Pin the exact Coder version to upgrade manually when we want to. + run: | + composer --no-interaction --no-progress require \ + phpstan/phpstan:^1.10.32 \ + mglaman/phpstan-drupal:^1.1.2 \ + phpstan/phpstan-deprecation-rules:^1.0.0 \ + jangregor/phpstan-prophecy:^1.0.0 \ + phpstan/phpstan-phpunit:^1.0.0 \ + phpstan/extension-installer:^1.0 + composer --no-interaction --no-progress --with-all-dependencies upgrade drupal/coder:8.3.21 + - name: Run PHPStan - # phpstan-drupal bug, so we remove 1 stub file - # https://github.com/mglaman/phpstan-drupal/issues/509 - run: if [[ ${{ matrix.phpstan }} == "1" ]]; then rm vendor/mglaman/phpstan-drupal/stubs/Drupal/Core/Field/FieldItemList.stub && cd modules/graphql && ../../vendor/bin/phpstan analyse; fi + if: ${{ matrix.phpstan == '1' }} + run: cd modules/graphql && ../../vendor/bin/phpstan analyse - name: Run PHPCS - run: | - cd modules/graphql && ../../coder/vendor/bin/phpcs -p + if: ${{ matrix.phpstan == '1' }} + run: cd modules/graphql && ../../vendor/bin/phpcs -p diff --git a/examples/graphql_composable/src/Plugin/GraphQL/DataProducer/CreateArticle.php b/examples/graphql_composable/src/Plugin/GraphQL/DataProducer/CreateArticle.php index 8200f5a10..1409c8b40 100644 --- a/examples/graphql_composable/src/Plugin/GraphQL/DataProducer/CreateArticle.php +++ b/examples/graphql_composable/src/Plugin/GraphQL/DataProducer/CreateArticle.php @@ -4,11 +4,11 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase; use Drupal\graphql_composable\GraphQL\Response\ArticleResponse; use Drupal\node\Entity\Node; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Creates a new article entity. diff --git a/src/Entity/Server.php b/src/Entity/Server.php index 39449bb00..78511c4da 100644 --- a/src/Entity/Server.php +++ b/src/Entity/Server.php @@ -9,20 +9,20 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\graphql\GraphQL\Execution\ExecutionResult as CacheableExecutionResult; use Drupal\graphql\GraphQL\Execution\FieldContext; -use Drupal\graphql\Plugin\PersistedQueryPluginInterface; -use GraphQL\Error\DebugFlag; -use GraphQL\Server\OperationParams; use Drupal\graphql\GraphQL\Execution\ResolveContext; -use GraphQL\Server\ServerConfig; use Drupal\graphql\GraphQL\ResolverRegistryInterface; use Drupal\graphql\GraphQL\Utility\DeferredUtility; +use Drupal\graphql\Plugin\PersistedQueryPluginInterface; use Drupal\graphql\Plugin\SchemaPluginInterface; +use GraphQL\Error\DebugFlag; use GraphQL\Error\Error; use GraphQL\Error\FormattedError; use GraphQL\Executor\Executor; use GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter; use GraphQL\Language\AST\DocumentNode; use GraphQL\Server\Helper; +use GraphQL\Server\OperationParams; +use GraphQL\Server\ServerConfig; use GraphQL\Type\Definition\ResolveInfo; use GraphQL\Validator\DocumentValidator; use GraphQL\Validator\Rules\DisableIntrospection; diff --git a/src/Event/OperationEvent.php b/src/Event/OperationEvent.php index f51164b21..dd0326809 100644 --- a/src/Event/OperationEvent.php +++ b/src/Event/OperationEvent.php @@ -2,9 +2,9 @@ namespace Drupal\graphql\Event; +use Drupal\Component\EventDispatcher\Event; use Drupal\graphql\GraphQL\Execution\ResolveContext; use GraphQL\Executor\ExecutionResult; -use Drupal\Component\EventDispatcher\Event; /** * Represents an event that is triggered before and after a GraphQL operation. diff --git a/src/EventSubscriber/ApqSubscriber.php b/src/EventSubscriber/ApqSubscriber.php index 1dd3ca5a5..3594fd49b 100644 --- a/src/EventSubscriber/ApqSubscriber.php +++ b/src/EventSubscriber/ApqSubscriber.php @@ -4,8 +4,8 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\graphql\Event\OperationEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; use GraphQL\Error\Error; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Save persisted queries to cache. diff --git a/src/GraphQL/Execution/ExecutionResult.php b/src/GraphQL/Execution/ExecutionResult.php index 127f04b01..113333d1e 100644 --- a/src/GraphQL/Execution/ExecutionResult.php +++ b/src/GraphQL/Execution/ExecutionResult.php @@ -2,9 +2,9 @@ namespace Drupal\graphql\GraphQL\Execution; -use GraphQL\Executor\ExecutionResult as LibraryExecutionResult; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\RefinableCacheableDependencyTrait; +use GraphQL\Executor\ExecutionResult as LibraryExecutionResult; /** * Expand the upstream ExecutionResult to make it Drupal cachable. diff --git a/src/GraphQL/Resolver/Composite.php b/src/GraphQL/Resolver/Composite.php index d72725812..fa9c1ac23 100644 --- a/src/GraphQL/Resolver/Composite.php +++ b/src/GraphQL/Resolver/Composite.php @@ -3,9 +3,9 @@ namespace Drupal\graphql\GraphQL\Resolver; use Drupal\graphql\GraphQL\Execution\FieldContext; -use GraphQL\Executor\Promise\Adapter\SyncPromise; -use Drupal\graphql\GraphQL\Utility\DeferredUtility; use Drupal\graphql\GraphQL\Execution\ResolveContext; +use Drupal\graphql\GraphQL\Utility\DeferredUtility; +use GraphQL\Executor\Promise\Adapter\SyncPromise; use GraphQL\Type\Definition\ResolveInfo; /** diff --git a/src/GraphQL/ResolverBuilder.php b/src/GraphQL/ResolverBuilder.php index 19b6722d9..6ebfdaf27 100644 --- a/src/GraphQL/ResolverBuilder.php +++ b/src/GraphQL/ResolverBuilder.php @@ -11,12 +11,12 @@ use Drupal\graphql\GraphQL\Resolver\DefaultValue; use Drupal\graphql\GraphQL\Resolver\Map; use Drupal\graphql\GraphQL\Resolver\ParentValue; +use Drupal\graphql\GraphQL\Resolver\ResolverInterface; use Drupal\graphql\GraphQL\Resolver\SourceContext; use Drupal\graphql\GraphQL\Resolver\Tap; use Drupal\graphql\GraphQL\Resolver\Value; use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerProxy; use Drupal\typed_data\DataFetcherTrait; -use Drupal\graphql\GraphQL\Resolver\ResolverInterface; /** * Wires and maps different resolvers together to build the GraphQL tree. diff --git a/src/GraphQL/ResolverRegistry.php b/src/GraphQL/ResolverRegistry.php index 30181e5b5..62c941476 100644 --- a/src/GraphQL/ResolverRegistry.php +++ b/src/GraphQL/ResolverRegistry.php @@ -4,11 +4,11 @@ use Drupal\graphql\GraphQL\Execution\FieldContext; use Drupal\graphql\GraphQL\Execution\ResolveContext; +use Drupal\graphql\GraphQL\Resolver\ResolverInterface; use GraphQL\Executor\Executor; use GraphQL\Type\Definition\ImplementingType; use GraphQL\Type\Definition\ResolveInfo; use GraphQL\Type\Definition\Type; -use Drupal\graphql\GraphQL\Resolver\ResolverInterface; /** * Contains all the mappings how to resolve a GraphQL request. diff --git a/src/GraphQL/Utility/FileUpload.php b/src/GraphQL/Utility/FileUpload.php index bd22f7e0a..0422f2350 100644 --- a/src/GraphQL/Utility/FileUpload.php +++ b/src/GraphQL/Utility/FileUpload.php @@ -8,6 +8,7 @@ use Drupal\Component\Utility\Environment; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\File\Event\FileUploadSanitizeNameEvent; use Drupal\Core\File\Exception\FileException; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Image\ImageFactory; @@ -20,10 +21,9 @@ use Drupal\Core\Utility\Token; use Drupal\file\FileInterface; use Drupal\graphql\GraphQL\Response\FileUploadResponse; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\File\UploadedFile; -use Drupal\Core\File\Event\FileUploadSanitizeNameEvent; use Symfony\Component\Mime\MimeTypeGuesserInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * Service to manage file uploads within GraphQL mutations. diff --git a/src/Plugin/GraphQL/DataProducer/DataProducerPluginBase.php b/src/Plugin/GraphQL/DataProducer/DataProducerPluginBase.php index ac510dcf6..8ed6a429b 100644 --- a/src/Plugin/GraphQL/DataProducer/DataProducerPluginBase.php +++ b/src/Plugin/GraphQL/DataProducer/DataProducerPluginBase.php @@ -5,11 +5,11 @@ use Drupal\Component\Plugin\Exception\ContextException; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\DependencyInjection\DependencySerializationTrait; -use Drupal\graphql\GraphQL\Execution\FieldContext; -use Drupal\graphql\Plugin\DataProducerPluginInterface; use Drupal\Core\Plugin\ContextAwarePluginTrait; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\TypedData\TypedDataTrait; +use Drupal\graphql\GraphQL\Execution\FieldContext; +use Drupal\graphql\Plugin\DataProducerPluginInterface; /** * Base class for data producers that resolve fields for queries or mutations. diff --git a/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php b/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php index 4e5747099..faf933aac 100644 --- a/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php +++ b/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php @@ -14,8 +14,8 @@ use Drupal\graphql\Plugin\DataProducerPluginCachingInterface; use Drupal\graphql\Plugin\DataProducerPluginInterface; use Drupal\graphql\Plugin\DataProducerPluginManager; -use Symfony\Component\HttpFoundation\RequestStack; use GraphQL\Type\Definition\ResolveInfo; +use Symfony\Component\HttpFoundation\RequestStack; /** * A proxy class that lazy resolves data producers and has a result cache. diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php index c672fa109..7fa645259 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php @@ -2,8 +2,8 @@ namespace Drupal\graphql\Plugin\GraphQL\DataProducer\Entity; -use Drupal\Core\Session\AccountInterface; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase; /** diff --git a/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageUrl.php b/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageUrl.php index 84b1cfbc2..001cb0aec 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageUrl.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageUrl.php @@ -3,13 +3,13 @@ namespace Drupal\graphql\Plugin\GraphQL\DataProducer\Entity\Fields\Image; use Drupal\Core\Cache\RefinableCacheableDependencyInterface; +use Drupal\Core\File\FileUrlGeneratorInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\RendererInterface; use Drupal\file\FileInterface; use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\File\FileUrlGeneratorInterface; /** * Returns the file URL of a file entity. diff --git a/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceLayoutRevisions.php b/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceLayoutRevisions.php index c09266dbc..8439eb20d 100644 --- a/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceLayoutRevisions.php +++ b/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceLayoutRevisions.php @@ -8,9 +8,9 @@ use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\graphql\GraphQL\Buffers\EntityRevisionBuffer; use Drupal\graphql\GraphQL\Execution\FieldContext; use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase; -use Drupal\graphql\GraphQL\Buffers\EntityRevisionBuffer; use GraphQL\Deferred; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceRevisions.php b/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceRevisions.php index b0f9a509a..0a2503a21 100644 --- a/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceRevisions.php +++ b/src/Plugin/GraphQL/DataProducer/Field/EntityReferenceRevisions.php @@ -8,9 +8,9 @@ use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\graphql\GraphQL\Buffers\EntityRevisionBuffer; use Drupal\graphql\GraphQL\Execution\FieldContext; use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase; -use Drupal\graphql\GraphQL\Buffers\EntityRevisionBuffer; use GraphQL\Deferred; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php b/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php index 3e8d92df5..3088322cc 100644 --- a/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php +++ b/src/Plugin/GraphQL/Schema/AlterableComposableSchema.php @@ -2,14 +2,14 @@ namespace Drupal\graphql\Plugin\GraphQL\Schema; +use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher; use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\graphql\Event\AlterSchemaDataEvent; use Drupal\graphql\Event\AlterSchemaExtensionDataEvent; use Drupal\graphql\Plugin\SchemaExtensionPluginInterface; -use GraphQL\Language\Parser; -use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher; -use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\graphql\Plugin\SchemaExtensionPluginManager; +use GraphQL\Language\Parser; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Plugin/GraphQL/Schema/ComposableSchema.php b/src/Plugin/GraphQL/Schema/ComposableSchema.php index eeb439e47..ddb820f75 100644 --- a/src/Plugin/GraphQL/Schema/ComposableSchema.php +++ b/src/Plugin/GraphQL/Schema/ComposableSchema.php @@ -6,8 +6,8 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\PluginFormInterface; -use Drupal\graphql\GraphQL\ResolverRegistry; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\graphql\GraphQL\ResolverRegistry; /** * @Schema( diff --git a/src/Plugin/SchemaExtensionPluginInterface.php b/src/Plugin/SchemaExtensionPluginInterface.php index 234aa19da..75eca1fcd 100644 --- a/src/Plugin/SchemaExtensionPluginInterface.php +++ b/src/Plugin/SchemaExtensionPluginInterface.php @@ -2,8 +2,8 @@ namespace Drupal\graphql\Plugin; -use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; +use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\graphql\GraphQL\ResolverRegistryInterface; /** diff --git a/src/Plugin/SchemaPluginInterface.php b/src/Plugin/SchemaPluginInterface.php index d13c1e71d..ab8dbc33a 100644 --- a/src/Plugin/SchemaPluginInterface.php +++ b/src/Plugin/SchemaPluginInterface.php @@ -2,8 +2,8 @@ namespace Drupal\graphql\Plugin; -use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; +use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\graphql\GraphQL\ResolverRegistryInterface; /** diff --git a/tests/modules/graphql_file_validate/graphql_file_validate.module b/tests/modules/graphql_file_validate/graphql_file_validate.module index 9e1db9dd9..ae89684be 100644 --- a/tests/modules/graphql_file_validate/graphql_file_validate.module +++ b/tests/modules/graphql_file_validate/graphql_file_validate.module @@ -10,7 +10,7 @@ use Drupal\file\FileInterface; /** * Implements hook_file_validate(). */ -function graphql_file_validate(FileInterface $file): void { +function graphql_file_validate_file_validate(FileInterface $file): void { if (!file_exists($file->getFileUri())) { throw new \Exception('File does not exist during validation: ' . $file->getFileUri()); } diff --git a/tests/src/Kernel/DataProducer/EntityDefinitionTest.php b/tests/src/Kernel/DataProducer/EntityDefinitionTest.php index beaa951cf..9dc325989 100644 --- a/tests/src/Kernel/DataProducer/EntityDefinitionTest.php +++ b/tests/src/Kernel/DataProducer/EntityDefinitionTest.php @@ -6,9 +6,9 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\Tests\graphql\Kernel\GraphQLTestBase; -use Drupal\node\Entity\NodeType; use Drupal\graphql\GraphQL\ResolverBuilder; +use Drupal\node\Entity\NodeType; +use Drupal\Tests\graphql\Kernel\GraphQLTestBase; /** * Test the entity_definition data producer and friends. diff --git a/tests/src/Kernel/DataProducer/EntityMultipleTest.php b/tests/src/Kernel/DataProducer/EntityMultipleTest.php index ef0e96c18..3d9598db0 100644 --- a/tests/src/Kernel/DataProducer/EntityMultipleTest.php +++ b/tests/src/Kernel/DataProducer/EntityMultipleTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\graphql\Kernel\DataProducer; -use Drupal\Tests\graphql\Kernel\GraphQLTestBase; -use Drupal\node\NodeInterface; -use Drupal\node\Entity\NodeType; use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\node\NodeInterface; +use Drupal\Tests\graphql\Kernel\GraphQLTestBase; /** * Data producers Entity multiple test class. diff --git a/tests/src/Kernel/DataProducer/EntityReferenceTest.php b/tests/src/Kernel/DataProducer/EntityReferenceTest.php index 081695ada..9d80fde6a 100644 --- a/tests/src/Kernel/DataProducer/EntityReferenceTest.php +++ b/tests/src/Kernel/DataProducer/EntityReferenceTest.php @@ -2,11 +2,11 @@ namespace Drupal\Tests\graphql\Kernel\DataProducer; -use Drupal\Tests\field\Traits\EntityReferenceTestTrait; -use Drupal\Tests\graphql\Kernel\GraphQLTestBase; use Drupal\Core\Field\FieldStorageDefinitionInterface; -use Drupal\node\Entity\NodeType; use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\Tests\field\Traits\EntityReferenceTestTrait; +use Drupal\Tests\graphql\Kernel\GraphQLTestBase; /** * Tests the entity_reference data producers. diff --git a/tests/src/Kernel/DataProducer/EntityTest.php b/tests/src/Kernel/DataProducer/EntityTest.php index 15a0f00e6..b214f5047 100644 --- a/tests/src/Kernel/DataProducer/EntityTest.php +++ b/tests/src/Kernel/DataProducer/EntityTest.php @@ -2,15 +2,15 @@ namespace Drupal\Tests\graphql\Kernel\DataProducer; -use Drupal\Core\Language\LanguageInterface; -use Drupal\Tests\graphql\Kernel\GraphQLTestBase; -use Drupal\node\NodeInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\user\UserInterface; -use Drupal\node\Entity\NodeType; -use Drupal\node\Entity\Node; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; use Drupal\entity_test\Entity\EntityTestBundle; +use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\node\NodeInterface; +use Drupal\Tests\graphql\Kernel\GraphQLTestBase; +use Drupal\user\UserInterface; /** * Data producers Entity test class. diff --git a/tests/src/Kernel/DataProducer/MenuTest.php b/tests/src/Kernel/DataProducer/MenuTest.php index 13daef986..f1c6c51fd 100644 --- a/tests/src/Kernel/DataProducer/MenuTest.php +++ b/tests/src/Kernel/DataProducer/MenuTest.php @@ -2,11 +2,11 @@ namespace Drupal\Tests\graphql\Kernel\DataProducer; -use Drupal\Tests\graphql\Kernel\GraphQLTestBase; -use Drupal\system\Entity\Menu; -use Drupal\menu_link_content\Entity\MenuLinkContent; -use Drupal\Core\Menu\MenuTreeParameters; use Drupal\Core\Menu\MenuLinkTreeElement; +use Drupal\Core\Menu\MenuTreeParameters; +use Drupal\menu_link_content\Entity\MenuLinkContent; +use Drupal\system\Entity\Menu; +use Drupal\Tests\graphql\Kernel\GraphQLTestBase; /** * Data producers Menu test class. diff --git a/tests/src/Kernel/Framework/DisabledResultCacheTest.php b/tests/src/Kernel/Framework/DisabledResultCacheTest.php index 4b8ba1081..31d5653cd 100644 --- a/tests/src/Kernel/Framework/DisabledResultCacheTest.php +++ b/tests/src/Kernel/Framework/DisabledResultCacheTest.php @@ -3,8 +3,8 @@ namespace Drupal\Tests\graphql\Kernel\Framework; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Tests\graphql\Kernel\GraphQLTestBase; use Drupal\graphql\Entity\Server; +use Drupal\Tests\graphql\Kernel\GraphQLTestBase; /** * Test disabled result cache. diff --git a/tests/src/Kernel/Framework/ResultCacheTest.php b/tests/src/Kernel/Framework/ResultCacheTest.php index 30ea99b98..e44e18f75 100644 --- a/tests/src/Kernel/Framework/ResultCacheTest.php +++ b/tests/src/Kernel/Framework/ResultCacheTest.php @@ -2,15 +2,15 @@ namespace Drupal\Tests\graphql\Kernel\Framework; +use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\Context\CacheContextsManager; use Drupal\Core\Cache\Context\ContextCacheKeys; use Drupal\Core\Render\RenderContext; +use Drupal\graphql\Entity\Server; use Drupal\graphql\GraphQL\Execution\FieldContext; use Drupal\Tests\graphql\Kernel\GraphQLTestBase; -use Prophecy\Argument; -use Drupal\graphql\Entity\Server; -use Drupal\Core\Cache\CacheableDependencyInterface; use GraphQL\Deferred; +use Prophecy\Argument; /** * Test query result caching. diff --git a/tests/src/Kernel/Framework/TestFrameworkTest.php b/tests/src/Kernel/Framework/TestFrameworkTest.php index 824cc1c63..51802d268 100644 --- a/tests/src/Kernel/Framework/TestFrameworkTest.php +++ b/tests/src/Kernel/Framework/TestFrameworkTest.php @@ -2,9 +2,9 @@ namespace Drupal\Tests\graphql\Kernel\Framework; +use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Tests\graphql\Kernel\GraphQLTestBase; -use Drupal\Core\Cache\CacheableDependencyInterface; /** * Test the test framework. diff --git a/tests/src/Kernel/GraphQLTestBase.php b/tests/src/Kernel/GraphQLTestBase.php index bb8416d9c..5a1a259cd 100644 --- a/tests/src/Kernel/GraphQLTestBase.php +++ b/tests/src/Kernel/GraphQLTestBase.php @@ -10,8 +10,8 @@ use Drupal\KernelTests\KernelTestBase; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Tests\graphql\Traits\DataProducerExecutionTrait; -use Drupal\Tests\graphql\Traits\MockingTrait; use Drupal\Tests\graphql\Traits\HttpRequestTrait; +use Drupal\Tests\graphql\Traits\MockingTrait; use Drupal\Tests\graphql\Traits\QueryFileTrait; use Drupal\Tests\graphql\Traits\QueryResultAssertionTrait; use Drupal\Tests\graphql\Traits\SchemaPrinterTrait; diff --git a/tests/src/Kernel/ResolverBuilderTest.php b/tests/src/Kernel/ResolverBuilderTest.php index dd4808e33..1365a7d90 100644 --- a/tests/src/Kernel/ResolverBuilderTest.php +++ b/tests/src/Kernel/ResolverBuilderTest.php @@ -2,8 +2,8 @@ namespace Drupal\Tests\graphql\Kernel; -use GraphQL\Deferred; use Drupal\graphql\GraphQL\Resolver\ResolverInterface; +use GraphQL\Deferred; /** * Tests that the resolver builder behaves correctly. diff --git a/tests/src/Traits/MockingTrait.php b/tests/src/Traits/MockingTrait.php index 1f1691db7..85f3a74a8 100644 --- a/tests/src/Traits/MockingTrait.php +++ b/tests/src/Traits/MockingTrait.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\graphql\Traits; +use Drupal\graphql\Entity\Server; use Drupal\graphql\GraphQL\Resolver\Callback; use Drupal\graphql\GraphQL\Resolver\ResolverInterface; use Drupal\graphql\GraphQL\Resolver\Value; +use Drupal\graphql\GraphQL\ResolverRegistry; use Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase; use Drupal\graphql\Plugin\SchemaExtensionPluginManager; use Drupal\graphql\Plugin\SchemaPluginManager; -use Drupal\graphql\Entity\Server; -use Drupal\graphql\GraphQL\ResolverRegistry; use Drupal\Tests\RandomGeneratorTrait; /**