From 8767b9359448dc0222a19d590a75fa9654a2527b Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Fri, 8 Jan 2021 10:33:42 +0100 Subject: [PATCH] [TASK] Remove unreachable else because ternary operator condition is always true --- Classes/ViewHelpers/Link/Be/AuthorViewHelper.php | 2 +- Classes/ViewHelpers/Link/Be/CategoryViewHelper.php | 2 +- Classes/ViewHelpers/Link/Be/CommentViewHelper.php | 2 +- Classes/ViewHelpers/Link/Be/PostViewHelper.php | 2 +- Classes/ViewHelpers/Link/Be/TagViewHelper.php | 2 +- Classes/ViewHelpers/Link/PostViewHelper.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Classes/ViewHelpers/Link/Be/AuthorViewHelper.php b/Classes/ViewHelpers/Link/Be/AuthorViewHelper.php index 476b6c0b..ecb46082 100644 --- a/Classes/ViewHelpers/Link/Be/AuthorViewHelper.php +++ b/Classes/ViewHelpers/Link/Be/AuthorViewHelper.php @@ -51,7 +51,7 @@ public function render(): string { /** @var Author $author */ $author = $this->arguments['author']; - $authorUid = $author !== null ? (int)$author->getUid() : 0; + $authorUid = (int)$author->getUid(); $routingUriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $uri = $routingUriBuilder->buildUriFromRoute('record_edit', ['edit[tx_blog_domain_model_author][' . $authorUid . ']' => 'edit']); diff --git a/Classes/ViewHelpers/Link/Be/CategoryViewHelper.php b/Classes/ViewHelpers/Link/Be/CategoryViewHelper.php index b50fcbab..f7f8a5d7 100644 --- a/Classes/ViewHelpers/Link/Be/CategoryViewHelper.php +++ b/Classes/ViewHelpers/Link/Be/CategoryViewHelper.php @@ -51,7 +51,7 @@ public function render(): string { /** @var Category $category */ $category = $this->arguments['category']; - $categoryUid = $category !== null ? (int)$category->getUid() : 0; + $categoryUid = (int)$category->getUid(); $routingUriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $uri = $routingUriBuilder->buildUriFromRoute('record_edit', ['edit[sys_category][' . $categoryUid . ']' => 'edit']); diff --git a/Classes/ViewHelpers/Link/Be/CommentViewHelper.php b/Classes/ViewHelpers/Link/Be/CommentViewHelper.php index 7a19c08d..33f6a57c 100644 --- a/Classes/ViewHelpers/Link/Be/CommentViewHelper.php +++ b/Classes/ViewHelpers/Link/Be/CommentViewHelper.php @@ -51,7 +51,7 @@ public function render(): string { /** @var Comment $comment */ $comment = $this->arguments['comment']; - $commentUid = $comment !== null ? (int)$comment->getUid() : 0; + $commentUid = (int)$comment->getUid(); $routingUriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $uri = $routingUriBuilder->buildUriFromRoute('record_edit', ['edit[tx_blog_domain_model_comment][' . $commentUid . ']' => 'edit']); diff --git a/Classes/ViewHelpers/Link/Be/PostViewHelper.php b/Classes/ViewHelpers/Link/Be/PostViewHelper.php index d0368895..9cab8079 100644 --- a/Classes/ViewHelpers/Link/Be/PostViewHelper.php +++ b/Classes/ViewHelpers/Link/Be/PostViewHelper.php @@ -51,7 +51,7 @@ public function render(): string { /** @var Post $post */ $post = $this->arguments['post']; - $pageUid = $post !== null ? (int)$post->getUid() : 0; + $pageUid = (int)$post->getUid(); $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); switch ($this->arguments['action']) { diff --git a/Classes/ViewHelpers/Link/Be/TagViewHelper.php b/Classes/ViewHelpers/Link/Be/TagViewHelper.php index 91104997..15344870 100644 --- a/Classes/ViewHelpers/Link/Be/TagViewHelper.php +++ b/Classes/ViewHelpers/Link/Be/TagViewHelper.php @@ -51,7 +51,7 @@ public function render(): string { /** @var Tag $tag */ $tag = $this->arguments['tag']; - $tagUid = $tag !== null ? (int)$tag->getUid() : 0; + $tagUid = (int)$tag->getUid(); $routingUriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $uri = $routingUriBuilder->buildUriFromRoute('record_edit', ['edit[tx_blog_domain_model_tag][' . $tagUid . ']' => 'edit']); diff --git a/Classes/ViewHelpers/Link/PostViewHelper.php b/Classes/ViewHelpers/Link/PostViewHelper.php index 6d1e062e..f2b0fb2e 100644 --- a/Classes/ViewHelpers/Link/PostViewHelper.php +++ b/Classes/ViewHelpers/Link/PostViewHelper.php @@ -49,7 +49,7 @@ public function render(): string /** @var Post $post */ $post = $this->arguments['post']; $section = $this->arguments['section'] ?: ''; - $pageUid = $post !== null ? (int)$post->getUid() : 0; + $pageUid = (int) $post->getUid(); $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder(); $createAbsoluteUri = (bool)$this->arguments['createAbsoluteUri']; $uri = $uriBuilder->reset()