diff --git a/modules/thunder_article/src/Twig/FilterExtension.php b/modules/thunder_article/src/Twig/FilterExtension.php index 357c0102b..368cc8f42 100644 --- a/modules/thunder_article/src/Twig/FilterExtension.php +++ b/modules/thunder_article/src/Twig/FilterExtension.php @@ -44,7 +44,7 @@ public function getName(): string { */ public static function plainText($value): string { $element = self::render($value); - $element = strip_tags($element); + $element = strip_tags((string) $element); return html_entity_decode($element, ENT_QUOTES); } @@ -59,7 +59,7 @@ public static function plainText($value): string { */ public static function basicFormat($value): string { $element = self::render($value); - return strip_tags($element, ''); + return strip_tags((string) $element, ''); } /** diff --git a/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php b/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php index c2b62e4c2..4e60545e0 100644 --- a/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php +++ b/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php @@ -27,8 +27,8 @@ public function testSchema(): void { $query = $this->getQueryFromFile($schema); $variables = $this->getVariablesFromFile($schema); - $responseData = $this->jsonDecode(strip_tags($this->getResponseData($query, $variables)['jsonld'])); - $expectedData = $this->jsonDecode(strip_tags($this->jsonDecode($this->getExpectedResponseFromFile($schema))['data']['jsonld'])); + $responseData = $this->jsonDecode(strip_tags((string) $this->getResponseData($query, $variables)['jsonld'])); + $expectedData = $this->jsonDecode(strip_tags((string) $this->jsonDecode($this->getExpectedResponseFromFile($schema))['data']['jsonld'])); $this->assertEqualsCanonicalizing($expectedData, $responseData); diff --git a/tests/src/Traits/ThunderTestTrait.php b/tests/src/Traits/ThunderTestTrait.php index b244072ee..3c215d7c2 100644 --- a/tests/src/Traits/ThunderTestTrait.php +++ b/tests/src/Traits/ThunderTestTrait.php @@ -171,7 +171,7 @@ protected function tearDown(): void { // Output all errors for modules tested. $errors = []; foreach ($query->execute()->fetchAll() as $row) { - $errors[] = Unicode::truncate(Html::decodeEntities(strip_tags($controller->formatMessage($row))), 256, TRUE, TRUE); + $errors[] = Unicode::truncate(Html::decodeEntities(strip_tags((string) $controller->formatMessage($row))), 256, TRUE, TRUE); } throw new \Exception(print_r($errors, TRUE)); } @@ -185,12 +185,12 @@ protected function tearDown(): void { * @param string $uuid * The uuid. * - * @return \Drupal\media\MediaInterface|false|null + * @return \Drupal\media\MediaInterface * The media entity. * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function loadMediaByUuid(string $uuid) { + protected function loadMediaByUuid(string $uuid): MediaInterface { $media = \Drupal::getContainer()->get('entity.repository')->loadEntityByUuid('media', $uuid); assert($media instanceof MediaInterface); return $media; @@ -202,12 +202,12 @@ protected function loadMediaByUuid(string $uuid) { * @param string $uuid * The uuid. * - * @return \Drupal\node\NodeInterface|false|null + * @return \Drupal\node\NodeInterface * The node entity. * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function loadNodeByUuid(string $uuid) { + protected function loadNodeByUuid(string $uuid): NodeInterface { $node = \Drupal::getContainer()->get('entity.repository')->loadEntityByUuid('node', $uuid); assert($node instanceof NodeInterface); return $node; @@ -219,12 +219,12 @@ protected function loadNodeByUuid(string $uuid) { * @param string $uuid * The uuid. * - * @return \Drupal\taxonomy\TermInterface|false|null + * @return \Drupal\taxonomy\TermInterface * The term entity. * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function loadTermByUuid(string $uuid) { + protected function loadTermByUuid(string $uuid): TermInterface { $term = \Drupal::getContainer()->get('entity.repository')->loadEntityByUuid('taxonomy_term', $uuid); assert($term instanceof TermInterface); return $term;