From 1d5fdef4b4f609e2eda78ff5de40c68a489f418b Mon Sep 17 00:00:00 2001 From: Raul Date: Wed, 13 Apr 2022 12:40:05 +0200 Subject: [PATCH] Remove redundant `is_array` checks on return result from `LabelMapper::findAll` Signed-off-by: Raul --- lib/Service/LabelService.php | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index b27384760..4e833d94e 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -91,14 +91,12 @@ class LabelService { $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); $boardLabels = $this->labelMapper->findAll($boardId); - if (\is_array($boardLabels)) { - foreach ($boardLabels as $boardLabel) { - if ($boardLabel->getTitle() === $title) { - throw new BadRequestException('title must be unique'); - break; - } - } - } + foreach ($boardLabels as $boardLabel) { + if ($boardLabel->getTitle() === $title) { + throw new BadRequestException('title must be unique'); + break; + } + } if ($this->boardService->isArchived(null, $boardId)) { throw new StatusException('Operation not allowed. This board is archived.'); @@ -163,17 +161,15 @@ class LabelService { $label = $this->find($id); $boardLabels = $this->labelMapper->findAll($label->getBoardId()); - if (\is_array($boardLabels)) { - foreach ($boardLabels as $boardLabel) { - if ($boardLabel->getId() === $label->getId()) { - continue; - } - if ($boardLabel->getTitle() === $title) { - throw new BadRequestException('title must be unique'); - break; - } - } - } + foreach ($boardLabels as $boardLabel) { + if ($boardLabel->getId() === $label->getId()) { + continue; + } + if ($boardLabel->getTitle() === $title) { + throw new BadRequestException('title must be unique'); + break; + } + } if ($this->boardService->isArchived($this->labelMapper, $id)) { throw new StatusException('Operation not allowed. This board is archived.');