From 32a103d86a0b43f39974b5b9b50a75d1fd1bd906 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 9 Nov 2023 19:25:41 +0100 Subject: [PATCH] php cs fixes --- .../Controller/DashboardApiController.php | 23 ++++++++------- .../Controller/NewsItemApiController.php | 14 +++------ .../ChillMainExtension.php | 3 +- .../Entity/DashboardConfigItem.php | 12 ++++++-- .../ChillMainBundle/Entity/NewsItem.php | 1 - .../ChillMainBundle/Form/NewsItemType.php | 5 ++-- .../Repository/NewsItemRepository.php | 29 +++++++------------ .../Normalizer/NewsItemNormalizer.php | 8 +---- .../migrations/Version20231108141141.php | 9 +++++- 9 files changed, 48 insertions(+), 56 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php index 86a824d0b..e091d2f5a 100644 --- a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php @@ -1,22 +1,24 @@ [ // arbitrary data that will be store "some time" 'only_unread' => false, - ] - ] + ], + ], ]; return new JsonResponse($data, JsonResponse::HTTP_OK, []); } - } diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php index ce304c4ca..25fe7620f 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php @@ -11,17 +11,11 @@ declare(strict_types=1); namespace Chill\MainBundle\Controller; -use Chill\MainBundle\CRUD\Controller\ApiController; -use Chill\MainBundle\Entity\NewsItem; use Chill\MainBundle\Pagination\PaginatorFactory; -use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Repository\NewsItemRepository; use Chill\MainBundle\Serializer\Model\Collection; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Chill\MainBundle\Serializer\NewsItemNormalizer; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\SerializerInterface; @@ -30,14 +24,15 @@ class NewsItemApiController public function __construct( private NewsItemRepository $newsItemRepository, private SerializerInterface $serializer, - private PaginatorFactory $paginatorFactory) {} + private PaginatorFactory $paginatorFactory + ) {} /** - * Get list of news items filtered on start and end date + * Get list of news items filtered on start and end date. * * @Route("/api/1.0/main/news.json", methods={"get"}) */ - public function listCurrentNewsItems():JsonResponse + public function listCurrentNewsItems(): JsonResponse { $total = $this->newsItemRepository->countWithDateFilter(); $paginator = $this->paginatorFactory->create($total); @@ -50,6 +45,5 @@ class NewsItemApiController AbstractNormalizer::GROUPS => ['read'], ] ), JsonResponse::HTTP_OK, [], true); - } } diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 29b3a9384..7cb84b14d 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -19,7 +19,6 @@ use Chill\MainBundle\Controller\CountryController; use Chill\MainBundle\Controller\LanguageController; use Chill\MainBundle\Controller\LocationController; use Chill\MainBundle\Controller\LocationTypeController; -use Chill\MainBundle\Controller\NewsItemApiController; use Chill\MainBundle\Controller\NewsItemController; use Chill\MainBundle\Controller\RegroupmentController; use Chill\MainBundle\Controller\UserController; @@ -792,7 +791,7 @@ class ChillMainExtension extends Extension implements ], ], ], -/* [ + /* [ 'class' => \Chill\MainBundle\Entity\DashboardConfigItem::class, 'controller' => \Chill\MainBundle\Controller\DashboardApiController::class, 'name' => 'dashboard-config-item', diff --git a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php index 05ead7f07..122202f96 100644 --- a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php +++ b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php @@ -1,12 +1,20 @@ id; } - } diff --git a/src/Bundle/ChillMainBundle/Form/NewsItemType.php b/src/Bundle/ChillMainBundle/Form/NewsItemType.php index 0080acf1c..01ae63882 100644 --- a/src/Bundle/ChillMainBundle/Form/NewsItemType.php +++ b/src/Bundle/ChillMainBundle/Form/NewsItemType.php @@ -18,7 +18,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Contracts\Translation\TranslatorInterface; class NewsItemType extends AbstractType { @@ -36,12 +35,12 @@ class NewsItemType extends AbstractType ChillDateType::class, [ 'required' => true, - 'input' => 'datetime_immutable' + 'input' => 'datetime_immutable', ] ) ->add('endDate', ChillDateType::class, [ 'required' => false, - 'input' => 'datetime_immutable' + 'input' => 'datetime_immutable', ]); } diff --git a/src/Bundle/ChillMainBundle/Repository/NewsItemRepository.php b/src/Bundle/ChillMainBundle/Repository/NewsItemRepository.php index f38462d4e..bb2128b25 100644 --- a/src/Bundle/ChillMainBundle/Repository/NewsItemRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/NewsItemRepository.php @@ -1,5 +1,14 @@ repository->createQueryBuilder($alias, $indexBy); } - /** - * @inheritDoc - */ public function find($id) { return $this->repository->find($id); } - /** - * @inheritDoc - */ public function findAll() { return $this->repository->findAll(); } - /** - * @inheritDoc - */ - public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null) + public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - /** - * @inheritDoc - */ + public function findOneBy(array $criteria) { return $this->repository->findOneBy($criteria); } - /** - * @inheritDoc - */ public function getClassName() { return NewsItem::class; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php index de999a5b9..77a969752 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php @@ -11,13 +11,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Serializer\Normalizer; -use Chill\MainBundle\Entity\Center; -use Chill\MainBundle\Entity\DashboardItem; use Chill\MainBundle\Entity\NewsItem; -use Chill\MainBundle\Repository\CenterRepository; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; -use Symfony\Component\Serializer\Exception\UnexpectedValueException; -use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class NewsItemNormalizer implements NormalizerInterface @@ -30,7 +24,7 @@ class NewsItemNormalizer implements NormalizerInterface 'title' => $newsItem->getTitle(), 'content' => $newsItem->getContent(), 'startdate' => $newsItem->getStartDate(), - 'enddate' => $newsItem->getEndDate() + 'enddate' => $newsItem->getEndDate(), ]; } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20231108141141.php b/src/Bundle/ChillMainBundle/migrations/Version20231108141141.php index ffcc6130b..d081a9e94 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20231108141141.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20231108141141.php @@ -2,13 +2,20 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Create dashboard config item and news item + * Create dashboard config item and news item. */ final class Version20231108141141 extends AbstractMigration {