From 3adb75d56eecd4247a1420b1de4938941b25542e Mon Sep 17 00:00:00 2001 From: mattamon Date: Wed, 22 May 2024 17:33:49 +0200 Subject: [PATCH] Add feedback from sonar --- src/Note/Controller/Element/CollectionController.php | 2 +- src/Note/Controller/Element/CreateController.php | 3 ++- src/Note/Extractor/NoteDataExtractor.php | 6 +++--- src/Note/Hydrator/NoteHydrator.php | 2 +- src/Note/Repository/NoteRepository.php | 2 +- src/Note/Request/NoteElement.php | 2 +- src/Note/Schema/CreateNote.php | 2 +- src/Note/Schema/Note.php | 2 +- src/Note/Schema/NoteUser.php | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Note/Controller/Element/CollectionController.php b/src/Note/Controller/Element/CollectionController.php index dd8e007c9..2365bef13 100644 --- a/src/Note/Controller/Element/CollectionController.php +++ b/src/Note/Controller/Element/CollectionController.php @@ -90,4 +90,4 @@ public function getNotes( $collection->getTotalItems() ); } -} \ No newline at end of file +} diff --git a/src/Note/Controller/Element/CreateController.php b/src/Note/Controller/Element/CreateController.php index 2cf840648..5cbfbdf46 100644 --- a/src/Note/Controller/Element/CreateController.php +++ b/src/Note/Controller/Element/CreateController.php @@ -69,7 +69,8 @@ public function __construct( public function createNote( string $elementType, int $id, - #[MapRequestPayload] CreateNote $createNote): JsonResponse + #[MapRequestPayload] CreateNote $createNote + ): JsonResponse { $note = $this->noteService->createNote(new NoteElement($elementType, $id), $createNote); return $this->jsonResponse(['id' => $note->getId()]); diff --git a/src/Note/Extractor/NoteDataExtractor.php b/src/Note/Extractor/NoteDataExtractor.php index a8046ebf7..253cd6f86 100644 --- a/src/Note/Extractor/NoteDataExtractor.php +++ b/src/Note/Extractor/NoteDataExtractor.php @@ -51,13 +51,13 @@ public function extractCPath(CoreNote $note) : string public function extractUserData(CoreNote $note) : NoteUser { $emptyUser = new NoteUser(); - if(!$note->getUser()) { + if (!$note->getUser()) { return $emptyUser; } $user = $this->userResolver->getById($note->getUser()); - if(!$user) { + if (!$user) { return $emptyUser; } @@ -101,4 +101,4 @@ private function extractElementData(ElementInterface $element): array 'type' => $element->getType(), ]; } -} \ No newline at end of file +} diff --git a/src/Note/Hydrator/NoteHydrator.php b/src/Note/Hydrator/NoteHydrator.php index e06ab3613..0b122a1e7 100644 --- a/src/Note/Hydrator/NoteHydrator.php +++ b/src/Note/Hydrator/NoteHydrator.php @@ -48,4 +48,4 @@ public function hydrate(CoreNote $note): Note $noteUser->getName(), ); } -} \ No newline at end of file +} diff --git a/src/Note/Repository/NoteRepository.php b/src/Note/Repository/NoteRepository.php index 1d8ce0df8..de714e854 100644 --- a/src/Note/Repository/NoteRepository.php +++ b/src/Note/Repository/NoteRepository.php @@ -105,7 +105,7 @@ public function listNotes(NoteElement $noteElement, NoteParameters $parameters): public function deleteNote(int $id): void { $note = $this->noteResolver->getById($id); - if(!$note) { + if (!$note) { throw new ElementNotFoundException($id, 'Note'); } $note->delete(); diff --git a/src/Note/Request/NoteElement.php b/src/Note/Request/NoteElement.php index 1e6f069ab..0a488132c 100644 --- a/src/Note/Request/NoteElement.php +++ b/src/Note/Request/NoteElement.php @@ -38,4 +38,4 @@ public function getId(): int { return $this->id; } -} \ No newline at end of file +} diff --git a/src/Note/Schema/CreateNote.php b/src/Note/Schema/CreateNote.php index d327955d4..86821ef20 100644 --- a/src/Note/Schema/CreateNote.php +++ b/src/Note/Schema/CreateNote.php @@ -53,4 +53,4 @@ public function getType(): string { return $this->type; } -} \ No newline at end of file +} diff --git a/src/Note/Schema/Note.php b/src/Note/Schema/Note.php index 78a15b67f..e0fc0d893 100644 --- a/src/Note/Schema/Note.php +++ b/src/Note/Schema/Note.php @@ -135,4 +135,4 @@ public function getUserName(): ?string { return $this->userName; } -} \ No newline at end of file +} diff --git a/src/Note/Schema/NoteUser.php b/src/Note/Schema/NoteUser.php index 31ec7b892..9bc684f26 100644 --- a/src/Note/Schema/NoteUser.php +++ b/src/Note/Schema/NoteUser.php @@ -38,4 +38,4 @@ public function getName(): ?string { return $this->name; } -} \ No newline at end of file +}