From 7172d132a3cdeccfad3446bacd22ca8837806fff Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 1 Aug 2021 05:30:37 +0200 Subject: [PATCH] Tags/Return: remove redundant condition Psalm flags this condition as redundant: ``` ERROR: RedundantCondition - src/DocBlock/Tags/Return_.php:62:48 - "" can never contain non-empty-lowercase-string (see https://psalm.dev/122) return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); ``` Based on the statement in the line above - `$type = $this->type ? '' . $this->type : 'mixed';` -, Psalm is correct and the `$type` variable can never be an empty string. --- src/DocBlock/Tags/Return_.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 1795257..f021b60 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -59,6 +59,6 @@ final class Return_ extends TagWithType implements Factory\StaticMethod $type = $this->type ? '' . $this->type : 'mixed'; - return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); + return $type . ($description !== '' ? ' ' . $description : ''); } }