From e2a8437807cabcfd58959e4ac5a65153a35822ee Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 16 Nov 2021 15:14:43 +0100 Subject: [PATCH] fix: SA: Fix "...Short ternary operator..." rule. SA stands for Static Analysis. --- phpstan-baseline.neon | 5 ----- .../EntityRepository/DocumentCategoryRepository.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index cab6a5eeb..3e8d79b3d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20,11 +20,6 @@ parameters: count: 1 path: src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php - - - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" - count: 1 - path: src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php - - message: "#^Variable \\$participation might not be defined\\.$#" count: 3 diff --git a/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php b/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php index d803405e4..72c068d18 100644 --- a/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php +++ b/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php @@ -34,6 +34,6 @@ class DocumentCategoryRepository extends EntityRepository 'SELECT MAX(c.idInsideBundle) + 1 FROM ChillDocStoreBundle:DocumentCategory c') ->getSingleResult(); - return $array_res[1] ?: 0; + return reset($array_res); } }