From a5d9bbf45fa9c86afb5afad8d733cd7046696d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20BAR?= Date: Thu, 30 Apr 2026 14:50:12 +0200 Subject: [PATCH] fix: fix php cs errors --- src/Controller/Product/ProductController.php | 3 +-- .../User/Product/ServiceController.php | 6 ++---- .../User/Product/UserProductsController.php | 3 +-- src/Payment/PayumManager.php | 18 +++++++++--------- src/Repository/MenuItemRepository.php | 1 + src/State/GroupGetStatsProvider.php | 2 +- src/State/GroupsProvider.php | 4 ++-- tests/Unit/Notifier/SmsNotifierTest.php | 4 ++-- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/Controller/Product/ProductController.php b/src/Controller/Product/ProductController.php index ea2b278..d526783 100644 --- a/src/Controller/Product/ProductController.php +++ b/src/Controller/Product/ProductController.php @@ -103,8 +103,7 @@ final class ProductController extends AbstractController } return $this->render('pages/product/show.html.twig', compact('slug', 'id', 'product')); - } else { - throw new GoneHttpException(); } + throw new GoneHttpException(); } } diff --git a/src/Controller/User/Product/ServiceController.php b/src/Controller/User/Product/ServiceController.php index 0316c35..1201af2 100644 --- a/src/Controller/User/Product/ServiceController.php +++ b/src/Controller/User/Product/ServiceController.php @@ -69,9 +69,8 @@ final class ServiceController extends AbstractController } return $this->render('pages/product/new_service.html.twig', compact('form', 'product')); - } else { - throw new GoneHttpException(); } + throw new GoneHttpException(); } #[Route([ @@ -96,8 +95,7 @@ final class ServiceController extends AbstractController } return $this->render('pages/product/edit_service.html.twig', compact('form', 'product')); - } else { - throw new GoneHttpException(); } + throw new GoneHttpException(); } } diff --git a/src/Controller/User/Product/UserProductsController.php b/src/Controller/User/Product/UserProductsController.php index 605c2dd..0aa0208 100644 --- a/src/Controller/User/Product/UserProductsController.php +++ b/src/Controller/User/Product/UserProductsController.php @@ -94,8 +94,7 @@ final class UserProductsController extends AbstractController if ($this->configurationRepository->getServicesParameter()) { return $this->render('pages/account/product/list.html.twig', compact('pagination', 'form')); - } else { - throw new GoneHttpException('there is no services'); } + throw new GoneHttpException('there is no services'); } } diff --git a/src/Payment/PayumManager.php b/src/Payment/PayumManager.php index e169846..e6ffe68 100644 --- a/src/Payment/PayumManager.php +++ b/src/Payment/PayumManager.php @@ -80,16 +80,16 @@ final class PayumManager 'groupOfferId' => (string) $offer->getId(), ], ]; - } else { - return [ - // method must be set as the default value is not retrieved from the gateway configuration - 'method' => PaymentMethod::CREDITCARD->value, - 'metadata' => [ - 'platformId' => (string) $offer->getConfiguration()?->getId(), - 'platformOfferId' => (string) $offer->getId(), - ], - ]; } + + return [ + // method must be set as the default value is not retrieved from the gateway configuration + 'method' => PaymentMethod::CREDITCARD->value, + 'metadata' => [ + 'platformId' => (string) $offer->getConfiguration()?->getId(), + 'platformOfferId' => (string) $offer->getId(), + ], + ]; } /** diff --git a/src/Repository/MenuItemRepository.php b/src/Repository/MenuItemRepository.php index 94d9286..d9cb8da 100644 --- a/src/Repository/MenuItemRepository.php +++ b/src/Repository/MenuItemRepository.php @@ -12,6 +12,7 @@ use Doctrine\ORM\QueryBuilder; use Gedmo\Sortable\Entity\Repository\SortableRepository; /** + * @extends SortableRepository * @method MenuItem|null find($id, $lockMode = null, $lockVersion = null) * @method MenuItem|null findOneBy(array $criteria, array $orderBy = null) * @method MenuItem[] findAll() diff --git a/src/State/GroupGetStatsProvider.php b/src/State/GroupGetStatsProvider.php index 8ce9e68..0178bf2 100644 --- a/src/State/GroupGetStatsProvider.php +++ b/src/State/GroupGetStatsProvider.php @@ -15,7 +15,7 @@ use App\Repository\GroupRepository; final class GroupGetStatsProvider implements ProviderInterface { public function __construct( - readonly private GroupRepository $groupRepository, + private readonly GroupRepository $groupRepository, ) { } diff --git a/src/State/GroupsProvider.php b/src/State/GroupsProvider.php index d52cded..861cf11 100644 --- a/src/State/GroupsProvider.php +++ b/src/State/GroupsProvider.php @@ -16,8 +16,8 @@ use App\Repository\UserRepository; class GroupsProvider implements ProviderInterface { public function __construct( - readonly private GroupRepository $groupRepository, - readonly private UserRepository $userRepository, + private readonly GroupRepository $groupRepository, + private readonly UserRepository $userRepository, ) { } diff --git a/tests/Unit/Notifier/SmsNotifierTest.php b/tests/Unit/Notifier/SmsNotifierTest.php index e2da61d..dbd352d 100644 --- a/tests/Unit/Notifier/SmsNotifierTest.php +++ b/tests/Unit/Notifier/SmsNotifierTest.php @@ -6,14 +6,14 @@ namespace App\Tests\Unit\Notifier; use App\Entity\User; use App\Notifier\SmsNotifier; -use Monolog\Test\TestCase; +use Monolog\Test\MonologTestCase; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Component\Notifier\Exception\TransportException; use Symfony\Component\Notifier\TexterInterface; -final class SmsNotifierTest extends TestCase +final class SmsNotifierTest extends MonologTestCase { public function testNotify(): void {