From 00996cb163cf55d8614b5fe5cd49060d88bd2436 Mon Sep 17 00:00:00 2001 From: Gwadaking Date: Fri, 3 Apr 2026 17:08:45 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20monter=20PHPStan=20=C3=A0=20niveau=208?= =?UTF-8?q?=20=E2=80=94=20corriger=202=20bugs=20file=5Fget=5Fcontents/json?= =?UTF-8?q?=5Fencode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- backend/phpstan.neon | 2 +- backend/src/Service/Ingestion/IngestionService.php | 6 +++++- backend/src/Service/Push/PushNotificationService.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/phpstan.neon b/backend/phpstan.neon index d33a641..699f928 100644 --- a/backend/phpstan.neon +++ b/backend/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 6 + level: 8 paths: - src symfony: diff --git a/backend/src/Service/Ingestion/IngestionService.php b/backend/src/Service/Ingestion/IngestionService.php index f700e62..4bc5667 100644 --- a/backend/src/Service/Ingestion/IngestionService.php +++ b/backend/src/Service/Ingestion/IngestionService.php @@ -188,7 +188,11 @@ class IngestionService return null; } - $data = json_decode(file_get_contents($geojsonPath), true); + $contents = file_get_contents($geojsonPath); + if ($contents === false) { + return null; + } + $data = json_decode($contents, true); if (empty($data['features'])) { return null; diff --git a/backend/src/Service/Push/PushNotificationService.php b/backend/src/Service/Push/PushNotificationService.php index 92f18f3..d284cee 100644 --- a/backend/src/Service/Push/PushNotificationService.php +++ b/backend/src/Service/Push/PushNotificationService.php @@ -45,7 +45,7 @@ class PushNotificationService 'body' => sprintf('Score %d/100 — %s. Vérifiez avant de partir.', $score, ucfirst($level)), 'url' => $this->appPublicUrl, 'spotId' => (string) $spot->getId(), - ]); + ]) ?: null; $expired = [];