From 257c67b6c1b18e772271b6e3cf3c099e7a6e413c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 8 Jan 2023 18:30:41 +0100 Subject: [PATCH] Fixed static analysis issues. --- src/Controller/PartListsController.php | 2 +- src/DataTables/Column/EntityColumn.php | 3 ++- src/Entity/ProjectSystem/ProjectBOMEntry.php | 2 +- src/Services/Parts/PartsTableActionHandler.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php index 6a59f817..2d2c4b3e 100644 --- a/src/Controller/PartListsController.php +++ b/src/Controller/PartListsController.php @@ -86,7 +86,7 @@ class PartListsController extends AbstractController } //If the action handler returned a response, we use it, otherwise we redirect back to the previous page. - if ($redirectResponse){ + if (isset($redirectResponse) && $redirectResponse instanceof Response) { return $redirectResponse; } diff --git a/src/DataTables/Column/EntityColumn.php b/src/DataTables/Column/EntityColumn.php index 9fa5d422..d48d6da1 100644 --- a/src/DataTables/Column/EntityColumn.php +++ b/src/DataTables/Column/EntityColumn.php @@ -66,13 +66,14 @@ class EntityColumn extends AbstractColumn $resolver->setDefault('render', function (Options $options) { return function ($value, $context) use ($options) { - /** @var AbstractNamedDBElement|null $entity */ if ($this->accessor->isReadable($context, $options['property'])) { $entity = $this->accessor->getValue($context, $options['property']); } else { $entity = null; } + /** @var AbstractNamedDBElement|null $entity */ + if (null !== $entity) { if (null !== $entity->getID()) { return sprintf( diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index 12dde6bd..3c874a7b 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -48,7 +48,7 @@ class ProjectBOMEntry extends AbstractDBElement use TimestampTrait; /** - * @var int + * @var float * @ORM\Column(type="float", name="quantity") * @Assert\Positive() */ diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index bd57282f..2fde40b2 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -131,9 +131,9 @@ final class PartsTableActionHandler default: throw new InvalidArgumentException('The given action is unknown! ('.$action.')'); } - - return null; } + + return null; } /**