From 8fb7236b1ddb34e685b1f5b05a3044c9b78cb2a3 Mon Sep 17 00:00:00 2001 From: catch <catch56@gmail.com> Date: Mon, 7 Nov 2022 13:02:48 +0000 Subject: [PATCH] Issue #3317758 by DieterHolvoet: The return type of TermInterface::getWeight is wrong --- .../Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php | 2 +- core/modules/taxonomy/src/Entity/Term.php | 2 +- .../Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php | 2 +- .../tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php | 2 +- .../Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php | 2 +- .../Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php index 6f4449880245..58149d4119ae 100644 --- a/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php +++ b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php @@ -84,7 +84,7 @@ protected function assertEntity(int $id, string $expected_language, string $expe $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, (int) $entity->getWeight()); + $this->assertSame($expected_weight, $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php index 87f428aba600..5b4d8dbdb952 100644 --- a/core/modules/taxonomy/src/Entity/Term.php +++ b/core/modules/taxonomy/src/Entity/Term.php @@ -267,7 +267,7 @@ public function setName($name) { * {@inheritdoc} */ public function getWeight() { - return $this->get('weight')->value; + return (int) $this->get('weight')->value; } /** diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php index c2afbe1f336c..21a35daad2a1 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php @@ -84,7 +84,7 @@ protected function assertEntity(int $id, string $expected_language, string $expe $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, (int) $entity->getWeight()); + $this->assertSame($expected_weight, $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php index 39c91d517bba..3a26b1bfca8b 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php @@ -90,7 +90,7 @@ protected function assertEntity(int $id, string $expected_language, string $expe $this->assertEquals($expected_vid, $entity->bundle()); $this->assertEquals($expected_description, $entity->getDescription()); $this->assertEquals($expected_format, $entity->getFormat()); - $this->assertEquals($expected_weight, (int) $entity->getWeight()); + $this->assertEquals($expected_weight, $entity->getWeight()); $this->assertEquals($expected_parents, $this->getParentIDs($id)); $this->assertHierarchy($expected_vid, $id, $expected_parents); if (!is_null($expected_field_integer_value)) { diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php index bd37bf6e319d..f8acceff8dd8 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php @@ -95,7 +95,7 @@ protected function assertEntity(int $id, string $expected_language, string $expe $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, (int) $entity->getWeight()); + $this->assertSame($expected_weight, $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php index fb0d80b1b5ac..16f01ab7e264 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php @@ -80,7 +80,7 @@ protected function assertEntity(int $id, string $expected_language, string $expe $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, (int) $entity->getWeight()); + $this->assertSame($expected_weight, $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } -- GitLab