From b0cda2757657b526c17dc257c42f4b7af42ec5e8 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Wed, 6 Nov 2024 17:00:56 +0200 Subject: [PATCH] PHPCS fixes --- helfi_tpr.install | 2 +- src/Entity/TprEntityBase.php | 2 +- src/Entity/TranslationHandler.php | 2 +- .../Field/FieldFormatter/ErrandServicesChannelFormatter.php | 2 +- src/Plugin/migrate/source/OntologyWordDetails.php | 2 +- src/Plugin/views/filter/ProvidedLanguages.php | 2 +- tests/src/Functional/ErrandServiceListTest.php | 2 +- .../Field/FieldFormatter/CustomFieldFormatterTestBase.php | 2 +- tests/src/Functional/ServiceListTest.php | 2 +- tests/src/Functional/ServiceRevisionTest.php | 2 +- tests/src/Functional/ServiceTranslationTest.php | 2 +- tests/src/Functional/UnitListTest.php | 2 +- tests/src/Functional/UnitRevisionTest.php | 2 +- tests/src/Functional/UnitTranslationTest.php | 2 +- tests/src/Kernel/MigrationTestBase.php | 4 ++-- .../Plugin/Field/FieldType/AccessibilitySentenceItemTest.php | 2 +- .../src/Kernel/Plugin/Field/FieldType/ConnectionItemTest.php | 2 +- tests/src/Kernel/TokenTest.php | 2 +- tests/src/Unit/ChannelTypeCollectionTest.php | 2 +- tests/src/Unit/ConnectionRepositoryTest.php | 2 +- tests/src/Unit/ConnectionTest.php | 3 +-- .../Plugin/Field/FieldFormatter/ServiceMapFormatterTest.php | 2 +- .../Unit/Plugin/migrate/process/ArrayElementEqualsTest.php | 2 +- 23 files changed, 24 insertions(+), 25 deletions(-) diff --git a/helfi_tpr.install b/helfi_tpr.install index 16fd13a..19264f9 100644 --- a/helfi_tpr.install +++ b/helfi_tpr.install @@ -7,10 +7,10 @@ declare(strict_types=1); -use Drupal\content_translation\ContentTranslationHandler; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\content_translation\ContentTranslationHandler; use Drupal\helfi_tpr\Entity\ChannelTypeCollection; use Drupal\migrate\Plugin\MigrateIdMapInterface; diff --git a/src/Entity/TprEntityBase.php b/src/Entity/TprEntityBase.php index a23fc0d..e5b9aa0 100644 --- a/src/Entity/TprEntityBase.php +++ b/src/Entity/TprEntityBase.php @@ -7,9 +7,9 @@ use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\Core\Entity\EntityPublishedTrait; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Entity\RevisionLogEntityTrait; use Drupal\Core\Entity\RevisionLogInterface; +use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; diff --git a/src/Entity/TranslationHandler.php b/src/Entity/TranslationHandler.php index 6c782be..5fe0802 100644 --- a/src/Entity/TranslationHandler.php +++ b/src/Entity/TranslationHandler.php @@ -4,9 +4,9 @@ namespace Drupal\helfi_tpr\Entity; -use Drupal\content_translation\ContentTranslationHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\content_translation\ContentTranslationHandler; /** * Translation handler for TPR entities. diff --git a/src/Plugin/Field/FieldFormatter/ErrandServicesChannelFormatter.php b/src/Plugin/Field/FieldFormatter/ErrandServicesChannelFormatter.php index 1aa7c74..ccd54dc 100644 --- a/src/Plugin/Field/FieldFormatter/ErrandServicesChannelFormatter.php +++ b/src/Plugin/Field/FieldFormatter/ErrandServicesChannelFormatter.php @@ -42,7 +42,7 @@ public static function create( ContainerInterface $container, array $configuration, $plugin_id, - $plugin_definition + $plugin_definition, ) : self { $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition); diff --git a/src/Plugin/migrate/source/OntologyWordDetails.php b/src/Plugin/migrate/source/OntologyWordDetails.php index fe35eb1..5080b67 100644 --- a/src/Plugin/migrate/source/OntologyWordDetails.php +++ b/src/Plugin/migrate/source/OntologyWordDetails.php @@ -39,7 +39,7 @@ public static function create( array $configuration, $plugin_id, $plugin_definition, - MigrationInterface $migration = NULL + ?MigrationInterface $migration = NULL, ) { $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition, $migration); $instance->configFactory = $container->get('config.factory'); diff --git a/src/Plugin/views/filter/ProvidedLanguages.php b/src/Plugin/views/filter/ProvidedLanguages.php index 8259695..74f35f0 100644 --- a/src/Plugin/views/filter/ProvidedLanguages.php +++ b/src/Plugin/views/filter/ProvidedLanguages.php @@ -20,7 +20,7 @@ class ProvidedLanguages extends InOperator { /** * {@inheritdoc} */ - public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL): void { + public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL): void { parent::init($view, $display, $options); $this->valueTitle = (string) $this->t('Allowed languages'); $this->definition['options callback'] = [$this, 'generateOptions']; diff --git a/tests/src/Functional/ErrandServiceListTest.php b/tests/src/Functional/ErrandServiceListTest.php index b083ac9..facbc08 100644 --- a/tests/src/Functional/ErrandServiceListTest.php +++ b/tests/src/Functional/ErrandServiceListTest.php @@ -4,10 +4,10 @@ namespace Drupal\Tests\helfi_tpr\Functional; -use donatj\MockWebServer\Response; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\TranslatableInterface; use Drupal\helfi_tpr\Entity\ErrandService; +use donatj\MockWebServer\Response; /** * Tests Errand Service entity's list functionality. diff --git a/tests/src/Functional/Plugin/Field/FieldFormatter/CustomFieldFormatterTestBase.php b/tests/src/Functional/Plugin/Field/FieldFormatter/CustomFieldFormatterTestBase.php index 126ac90..322b689 100644 --- a/tests/src/Functional/Plugin/Field/FieldFormatter/CustomFieldFormatterTestBase.php +++ b/tests/src/Functional/Plugin/Field/FieldFormatter/CustomFieldFormatterTestBase.php @@ -4,9 +4,9 @@ namespace Drupal\Tests\helfi_tpr\Functional\Plugin\Field\FieldFormatter; +use Drupal\Tests\helfi_api_base\Functional\MigrationTestBase; use Drupal\helfi_tpr\Entity\TprEntityBase; use Drupal\helfi_tpr\Entity\Unit; -use Drupal\Tests\helfi_api_base\Functional\MigrationTestBase; /** * Base class to test TPR field formatters. diff --git a/tests/src/Functional/ServiceListTest.php b/tests/src/Functional/ServiceListTest.php index 31e8c2c..6ffd4bf 100644 --- a/tests/src/Functional/ServiceListTest.php +++ b/tests/src/Functional/ServiceListTest.php @@ -4,10 +4,10 @@ namespace Drupal\Tests\helfi_tpr\Functional; -use donatj\MockWebServer\Response; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\TranslatableInterface; use Drupal\helfi_tpr\Entity\Service; +use donatj\MockWebServer\Response; /** * Tests Service entity's list functionality. diff --git a/tests/src/Functional/ServiceRevisionTest.php b/tests/src/Functional/ServiceRevisionTest.php index f40ebdb..344febc 100644 --- a/tests/src/Functional/ServiceRevisionTest.php +++ b/tests/src/Functional/ServiceRevisionTest.php @@ -5,8 +5,8 @@ namespace Drupal\Tests\helfi_tpr\Functional; use Drupal\Core\Url; -use Drupal\helfi_tpr\Entity\Service; use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait; +use Drupal\helfi_tpr\Entity\Service; /** * Tests service revisions. diff --git a/tests/src/Functional/ServiceTranslationTest.php b/tests/src/Functional/ServiceTranslationTest.php index 607937d..011e460 100644 --- a/tests/src/Functional/ServiceTranslationTest.php +++ b/tests/src/Functional/ServiceTranslationTest.php @@ -5,8 +5,8 @@ namespace Drupal\Tests\helfi_tpr\Functional; use Drupal\Core\Url; -use Drupal\helfi_tpr\Entity\Service; use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait; +use Drupal\helfi_tpr\Entity\Service; /** * Tests Service translations. diff --git a/tests/src/Functional/UnitListTest.php b/tests/src/Functional/UnitListTest.php index f1c3746..80d0e10 100644 --- a/tests/src/Functional/UnitListTest.php +++ b/tests/src/Functional/UnitListTest.php @@ -4,10 +4,10 @@ namespace Drupal\Tests\helfi_tpr\Functional; -use donatj\MockWebServer\Response; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\TranslatableInterface; use Drupal\helfi_tpr\Entity\Unit; +use donatj\MockWebServer\Response; /** * Tests Unit entity's list functionality. diff --git a/tests/src/Functional/UnitRevisionTest.php b/tests/src/Functional/UnitRevisionTest.php index c2f4097..d380512 100644 --- a/tests/src/Functional/UnitRevisionTest.php +++ b/tests/src/Functional/UnitRevisionTest.php @@ -5,8 +5,8 @@ namespace Drupal\Tests\helfi_tpr\Functional; use Drupal\Core\Url; -use Drupal\helfi_tpr\Entity\Unit; use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait; +use Drupal\helfi_tpr\Entity\Unit; /** * Tests unit revisions. diff --git a/tests/src/Functional/UnitTranslationTest.php b/tests/src/Functional/UnitTranslationTest.php index 5e80817..aae0f10 100644 --- a/tests/src/Functional/UnitTranslationTest.php +++ b/tests/src/Functional/UnitTranslationTest.php @@ -5,8 +5,8 @@ namespace Drupal\Tests\helfi_tpr\Functional; use Drupal\Core\Url; -use Drupal\helfi_tpr\Entity\Unit; use Drupal\Tests\helfi_tpr\Traits\TprMigrateTrait; +use Drupal\helfi_tpr\Entity\Unit; /** * Tests Unit translations. diff --git a/tests/src/Kernel/MigrationTestBase.php b/tests/src/Kernel/MigrationTestBase.php index e43258f..6156a37 100644 --- a/tests/src/Kernel/MigrationTestBase.php +++ b/tests/src/Kernel/MigrationTestBase.php @@ -67,7 +67,7 @@ public function setUp() : void { protected function getMigrateMapRowHash( string $migrationId, int|string $sourceId, - string $language + string $language, ) : ? string { /** @var \Drupal\Core\Database\Connection $database */ $database = $this->container->get('database'); @@ -97,7 +97,7 @@ protected function assertMigrateMapRowHash( string $migrationId, string $expected, int|string $sourceId, - string $language + string $language, ) { $this->assertEquals($expected, $this->getMigrateMapRowHash($migrationId, $sourceId, $language)); } diff --git a/tests/src/Kernel/Plugin/Field/FieldType/AccessibilitySentenceItemTest.php b/tests/src/Kernel/Plugin/Field/FieldType/AccessibilitySentenceItemTest.php index 8053d87..109029f 100644 --- a/tests/src/Kernel/Plugin/Field/FieldType/AccessibilitySentenceItemTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldType/AccessibilitySentenceItemTest.php @@ -6,10 +6,10 @@ use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Tests\field\Kernel\FieldKernelTestBase; use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\Tests\field\Kernel\FieldKernelTestBase; /** * Tests accessibility sentence field. diff --git a/tests/src/Kernel/Plugin/Field/FieldType/ConnectionItemTest.php b/tests/src/Kernel/Plugin/Field/FieldType/ConnectionItemTest.php index 491e06b..5fa3b18 100644 --- a/tests/src/Kernel/Plugin/Field/FieldType/ConnectionItemTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldType/ConnectionItemTest.php @@ -6,11 +6,11 @@ use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Tests\field\Kernel\FieldKernelTestBase; use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\helfi_tpr\Field\Connection\OpeningHour; -use Drupal\Tests\field\Kernel\FieldKernelTestBase; /** * Tests connection item field. diff --git a/tests/src/Kernel/TokenTest.php b/tests/src/Kernel/TokenTest.php index 10871d5..ecc0a5c 100644 --- a/tests/src/Kernel/TokenTest.php +++ b/tests/src/Kernel/TokenTest.php @@ -4,10 +4,10 @@ namespace Drupal\Tests\helfi_tpr\Kernel; +use Drupal\Tests\media\Traits\MediaTypeCreationTrait; use Drupal\file\Entity\File; use Drupal\helfi_tpr\Entity\Unit; use Drupal\media\Entity\Media; -use Drupal\Tests\media\Traits\MediaTypeCreationTrait; /** * Tests custom tokens. diff --git a/tests/src/Unit/ChannelTypeCollectionTest.php b/tests/src/Unit/ChannelTypeCollectionTest.php index a99fb12..39563ea 100644 --- a/tests/src/Unit/ChannelTypeCollectionTest.php +++ b/tests/src/Unit/ChannelTypeCollectionTest.php @@ -5,9 +5,9 @@ namespace Drupal\Tests\helfi_tpr\Unit; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\Tests\UnitTestCase; use Drupal\helfi_tpr\Entity\ChannelType; use Drupal\helfi_tpr\Entity\ChannelTypeCollection; -use Drupal\Tests\UnitTestCase; /** * Tests connection value objects. diff --git a/tests/src/Unit/ConnectionRepositoryTest.php b/tests/src/Unit/ConnectionRepositoryTest.php index cd818d2..23dbe9d 100644 --- a/tests/src/Unit/ConnectionRepositoryTest.php +++ b/tests/src/Unit/ConnectionRepositoryTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\helfi_tpr\Unit; +use Drupal\Tests\UnitTestCase; use Drupal\helfi_tpr\Field\Connection\Connection; use Drupal\helfi_tpr\Field\Connection\Highlight; use Drupal\helfi_tpr\Field\Connection\Link; @@ -14,7 +15,6 @@ use Drupal\helfi_tpr\Field\Connection\Repository; use Drupal\helfi_tpr\Field\Connection\Subgroup; use Drupal\helfi_tpr\Field\Connection\Topical; -use Drupal\Tests\UnitTestCase; /** * Tests repository value objects. diff --git a/tests/src/Unit/ConnectionTest.php b/tests/src/Unit/ConnectionTest.php index 8b884ea..3e515dd 100644 --- a/tests/src/Unit/ConnectionTest.php +++ b/tests/src/Unit/ConnectionTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\helfi_tpr\Unit; +use Drupal\Tests\UnitTestCase; use Drupal\helfi_tpr\Field\Connection\Highlight; use Drupal\helfi_tpr\Field\Connection\Link; use Drupal\helfi_tpr\Field\Connection\OpeningHour; @@ -15,8 +16,6 @@ use Drupal\helfi_tpr\Field\Connection\TextWithLink; use Drupal\helfi_tpr\Field\Connection\Topical; -use Drupal\Tests\UnitTestCase; - /** * Tests connection value objects. * diff --git a/tests/src/Unit/Plugin/Field/FieldFormatter/ServiceMapFormatterTest.php b/tests/src/Unit/Plugin/Field/FieldFormatter/ServiceMapFormatterTest.php index da1d08b..de8f66f 100644 --- a/tests/src/Unit/Plugin/Field/FieldFormatter/ServiceMapFormatterTest.php +++ b/tests/src/Unit/Plugin/Field/FieldFormatter/ServiceMapFormatterTest.php @@ -10,10 +10,10 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\TypedData\TraversableTypedDataInterface; +use Drupal\Tests\UnitTestCase; use Drupal\helfi_api_base\Entity\RemoteEntityBase; use Drupal\helfi_tpr\Entity\Unit; use Drupal\helfi_tpr\Plugin\Field\FieldFormatter\ServiceMapFormatter; -use Drupal\Tests\UnitTestCase; use Prophecy\PhpUnit\ProphecyTrait; /** diff --git a/tests/src/Unit/Plugin/migrate/process/ArrayElementEqualsTest.php b/tests/src/Unit/Plugin/migrate/process/ArrayElementEqualsTest.php index 0b72c9b..d24fdc6 100644 --- a/tests/src/Unit/Plugin/migrate/process/ArrayElementEqualsTest.php +++ b/tests/src/Unit/Plugin/migrate/process/ArrayElementEqualsTest.php @@ -4,12 +4,12 @@ namespace Drupal\Tests\helfi_tpr\Unit\Plugin\migrate\process; +use Drupal\Tests\UnitTestCase; use Drupal\helfi_tpr\Field\Connection\OpeningHour; use Drupal\helfi_tpr\Field\Connection\OpeningHourObject; use Drupal\helfi_tpr\Plugin\migrate\process\ArrayElementEquals; use Drupal\migrate\MigrateExecutableInterface; use Drupal\migrate\Row; -use Drupal\Tests\UnitTestCase; use Prophecy\PhpUnit\ProphecyTrait; /**