From f9ee62d6c660ae45d8df536390820929fb1aa4cc Mon Sep 17 00:00:00 2001 From: Tatevik Date: Wed, 29 Jul 2026 21:44:56 +0400 Subject: [PATCH 1/8] Refactor: env (#170) * Update .gitignore and composer.json for environment configuration * fix test * use dev --------- Co-authored-by: Tatevik --- .github/workflows/ci.yml | 1 + .gitignore | 2 ++ composer.json | 3 ++- phpunit.xml.dist | 3 ++- tests/Integration/Common/Routing/RoutingTest.php | 2 +- tests/Integration/Composer/ScriptsTest.php | 4 +--- tests/bootstrap.php | 11 +++++++++++ 7 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 tests/bootstrap.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 170b9894..fa1d96c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,7 @@ jobs: export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} export PHPLIST_DATABASE_HOST=127.0.0.1 + export PHPLIST_DATABASE_PATH= vendor/bin/phpunit tests/Integration/ continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8] - name: Running static analysis diff --git a/.gitignore b/.gitignore index 2c98e37b..a2318880 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ /var/ /vendor/ .phpunit.result.cache +.env +.env.dist diff --git a/composer.json b/composer.json index 17764d64..29c904a8 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "require": { "php": "^8.1", - "phplist/core": "dev-main", + "phplist/core": "dev-dev", "friendsofsymfony/rest-bundle": "*", "symfony/test-pack": "^1.0", "symfony/process": "^6.4", @@ -85,6 +85,7 @@ "PhpList\\Core\\Composer\\ScriptHandler::createGeneralConfiguration", "PhpList\\Core\\Composer\\ScriptHandler::createBundleConfiguration", "PhpList\\Core\\Composer\\ScriptHandler::createRoutesConfiguration", + "PhpList\\Core\\Composer\\ScriptHandler::createDotenvConfiguration", "PhpList\\Core\\Composer\\ScriptHandler::createParametersConfiguration", "PhpList\\Core\\Composer\\ScriptHandler::clearAllCaches" ], diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 78ea4f9a..692cf4d0 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,10 +5,11 @@ xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd" backupGlobals="false" colors="true" - bootstrap="vendor/autoload.php" + bootstrap="tests/bootstrap.php" > + diff --git a/tests/Integration/Common/Routing/RoutingTest.php b/tests/Integration/Common/Routing/RoutingTest.php index cfbe3cc3..bbab5c77 100644 --- a/tests/Integration/Common/Routing/RoutingTest.php +++ b/tests/Integration/Common/Routing/RoutingTest.php @@ -16,7 +16,7 @@ class RoutingTest extends WebTestCase public function testRootUrlHasHtmlContentType() { $client = self::createClient(); - $client->request('get', '/api/v2'); + $client->request('GET', '/api/v2', server: ['HTTP_ACCEPT' => 'text/html']); $response = $client->getResponse(); diff --git a/tests/Integration/Composer/ScriptsTest.php b/tests/Integration/Composer/ScriptsTest.php index 5b0df800..2cd0691b 100644 --- a/tests/Integration/Composer/ScriptsTest.php +++ b/tests/Integration/Composer/ScriptsTest.php @@ -29,9 +29,7 @@ private function getAbsolutePublicDirectoryPath(): string public static function publicDirectoryFilesDataProvider(): array { return [ - 'production entry point' => ['app.php'], - 'development entry point' => ['app_dev.php'], - 'testing entry point' => ['app_test.php'], + 'entry point' => ['index.php'], '.htaccess' => ['.htaccess'], ]; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 00000000..8a148f7f --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,11 @@ +bootEnv(dirname(__DIR__) . '/.env'); +} From eb52ad4d82bf17c876441d35bcf22c8ef18ce75c Mon Sep 17 00:00:00 2001 From: Tatevik Date: Fri, 31 Jul 2026 12:38:48 +0400 Subject: [PATCH 2/8] Fix the order of route methods --- .../Controller/TemplateController.php | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/Messaging/Controller/TemplateController.php b/src/Messaging/Controller/TemplateController.php index 9c272566..88955ba2 100644 --- a/src/Messaging/Controller/TemplateController.php +++ b/src/Messaging/Controller/TemplateController.php @@ -116,6 +116,66 @@ className: Template::class, ); } + #[Route('', name: 'create', methods: ['POST'])] + #[OA\Post( + path: '/api/v2/templates', + description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' . + 'Returns a JSON response of created template.', + summary: 'Create a new template.', + requestBody: new OA\RequestBody( + description: 'Pass session credentials', + required: true, + content: new OA\MediaType( + mediaType: 'multipart/form-data', + schema: new OA\Schema(ref: '#/components/schemas/UpdateTemplateRequest') + ) + ), + tags: ['templates'], + parameters: [ + new OA\Parameter( + name: 'php-auth-pw', + description: 'Session key obtained from login', + in: 'header', + required: true, + schema: new OA\Schema(type: 'string') + ), + ], + responses: [ + new OA\Response( + response: 201, + description: 'Success', + content: new OA\JsonContent( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Template') + ) + ), + new OA\Response( + response: 403, + description: 'Failure', + content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') + ), + new OA\Response( + response: 422, + description: 'Failure', + content: new OA\JsonContent(ref: '#/components/schemas/ValidationErrorResponse') + ), + ] + )] + public function createTemplates(Request $request): JsonResponse + { + $this->requireAuthentication($request); + + /** @var CreateTemplateRequest $createTemplateRequest */ + $createTemplateRequest = $this->validator->validate($request, CreateTemplateRequest::class); + $template = $this->templateManager->create($createTemplateRequest->getDto()); + $this->entityManager->flush(); + + return $this->json( + $this->normalizer->normalize($template), + Response::HTTP_CREATED + ); + } + #[Route('/defaults', name: 'get_defaults', methods: ['GET'])] #[OA\Get( path: '/api/v2/templates/defaults', @@ -263,66 +323,6 @@ public function getTemplate( return $this->json($this->normalizer->normalize($template), Response::HTTP_OK); } - #[Route('', name: 'create', methods: ['POST'])] - #[OA\Post( - path: '/api/v2/templates', - description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' . - 'Returns a JSON response of created template.', - summary: 'Create a new template.', - requestBody: new OA\RequestBody( - description: 'Pass session credentials', - required: true, - content: new OA\MediaType( - mediaType: 'multipart/form-data', - schema: new OA\Schema(ref: '#/components/schemas/UpdateTemplateRequest') - ) - ), - tags: ['templates'], - parameters: [ - new OA\Parameter( - name: 'php-auth-pw', - description: 'Session key obtained from login', - in: 'header', - required: true, - schema: new OA\Schema(type: 'string') - ), - ], - responses: [ - new OA\Response( - response: 201, - description: 'Success', - content: new OA\JsonContent( - type: 'array', - items: new OA\Items(ref: '#/components/schemas/Template') - ) - ), - new OA\Response( - response: 403, - description: 'Failure', - content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') - ), - new OA\Response( - response: 422, - description: 'Failure', - content: new OA\JsonContent(ref: '#/components/schemas/ValidationErrorResponse') - ), - ] - )] - public function createTemplates(Request $request): JsonResponse - { - $this->requireAuthentication($request); - - /** @var CreateTemplateRequest $createTemplateRequest */ - $createTemplateRequest = $this->validator->validate($request, CreateTemplateRequest::class); - $template = $this->templateManager->create($createTemplateRequest->getDto()); - $this->entityManager->flush(); - - return $this->json( - $this->normalizer->normalize($template), - Response::HTTP_CREATED - ); - } - #[Route('/{templateId}', name: 'update', methods: ['PUT'])] #[OA\Put( path: '/api/v2/templates/{templateId}', From 7129cec9c00d13810db1117d229140144477ecd8 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Tue, 4 Aug 2026 16:37:05 +0400 Subject: [PATCH 3/8] Remove 'requeued' status from MessageMetadataRequest --- src/Messaging/Request/Message/MessageMetadataRequest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Messaging/Request/Message/MessageMetadataRequest.php b/src/Messaging/Request/Message/MessageMetadataRequest.php index 2ae5ba3e..3eb29249 100644 --- a/src/Messaging/Request/Message/MessageMetadataRequest.php +++ b/src/Messaging/Request/Message/MessageMetadataRequest.php @@ -17,7 +17,7 @@ new OA\Property( property: 'status', type: 'string', - enum: ['draft', 'sent', 'prepared', 'submitted', 'suspended', 'requeued'], + enum: ['draft', 'sent', 'prepared', 'submitted', 'suspended'], example: 'draft' ), ], @@ -26,7 +26,7 @@ enum: ['draft', 'sent', 'prepared', 'submitted', 'suspended', 'requeued'], class MessageMetadataRequest implements RequestDtoInterface, RequestInterface { #[Assert\NotBlank] - #[Assert\Choice(['draft', 'sent', 'prepared', 'submitted', 'suspended', 'requeued'])] + #[Assert\Choice(['draft', 'sent', 'prepared', 'submitted', 'suspended'])] public string $status; /** From ab507daab1ad18a6d99e419c4c4e8d883720b8a6 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Wed, 12 Aug 2026 18:28:24 +0400 Subject: [PATCH 4/8] Fix response schema references and add conflict response in TemplateController --- src/Common/EventListener/ExceptionListener.php | 2 +- src/Messaging/Controller/TemplateController.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Common/EventListener/ExceptionListener.php b/src/Common/EventListener/ExceptionListener.php index 184925a3..bdc183d4 100644 --- a/src/Common/EventListener/ExceptionListener.php +++ b/src/Common/EventListener/ExceptionListener.php @@ -57,7 +57,7 @@ public function onKernelException(ExceptionEvent $event): void new JsonResponse([ 'message' => 'Validation failed', 'errors' => $this->parseFlatValidationMessage($exception->getMessage()), - ], 422) + ], 422) ); return; diff --git a/src/Messaging/Controller/TemplateController.php b/src/Messaging/Controller/TemplateController.php index 88955ba2..7dff67f7 100644 --- a/src/Messaging/Controller/TemplateController.php +++ b/src/Messaging/Controller/TemplateController.php @@ -127,7 +127,7 @@ className: Template::class, required: true, content: new OA\MediaType( mediaType: 'multipart/form-data', - schema: new OA\Schema(ref: '#/components/schemas/UpdateTemplateRequest') + schema: new OA\Schema(ref: '#/components/schemas/CreateTemplateRequest') ) ), tags: ['templates'], @@ -144,16 +144,18 @@ className: Template::class, new OA\Response( response: 201, description: 'Success', - content: new OA\JsonContent( - type: 'array', - items: new OA\Items(ref: '#/components/schemas/Template') - ) + content: new OA\JsonContent(ref: '#/components/schemas/Template') ), new OA\Response( response: 403, description: 'Failure', content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') ), + new OA\Response( + response: 409, + description: 'Failure', + content: new OA\JsonContent(ref: '#/components/schemas/AlreadyExistsResponse') + ), new OA\Response( response: 422, description: 'Failure', From d40679d24a523dcc80bdd50064c049da7fbba1bd Mon Sep 17 00:00:00 2001 From: Tatevik Date: Mon, 17 Aug 2026 12:23:00 +0400 Subject: [PATCH 5/8] Refactor AnalyticsController: update dashboard routes and responses for summary, recent campaigns, and performance metrics --- .../Controller/AnalyticsController.php | 274 +++++++++++------- .../Controller/AnalyticsControllerTest.php | 65 ++++- .../Controller/AnalyticsControllerTest.php | 132 ++++++--- 3 files changed, 311 insertions(+), 160 deletions(-) diff --git a/src/Statistics/Controller/AnalyticsController.php b/src/Statistics/Controller/AnalyticsController.php index be8e9968..c649e712 100644 --- a/src/Statistics/Controller/AnalyticsController.php +++ b/src/Statistics/Controller/AnalyticsController.php @@ -358,12 +358,12 @@ public function getTopLocalParts(Request $request): JsonResponse return $this->json($normalizedData, Response::HTTP_OK); } - #[Route('/dashboard', name: 'dashboard_statistics', methods: ['GET'])] + #[Route('/dashboard/summary', name: 'dashboard_summary', methods: ['GET'])] #[OA\Get( - path: '/api/v2/analytics/dashboard', + path: '/api/v2/analytics/dashboard/summary', description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' . - 'Returns dashboard cards with aggregate analytics metrics.', - summary: 'Gets dashboard analytics statistics.', + 'Returns dashboard summary statistics.', + summary: 'Gets dashboard summary statistics.', tags: ['analytics'], parameters: [ new OA\Parameter( @@ -381,114 +381,66 @@ public function getTopLocalParts(Request $request): JsonResponse content: new OA\JsonContent( properties: [ new OA\Property( - property: 'summary_statistics', + property: 'total_subscribers', properties: [ + new OA\Property(property: 'value', type: 'integer', example: 48294), new OA\Property( - property: 'total_subscribers', - properties: [ - new OA\Property(property: 'value', type: 'integer', example: 48294), - new OA\Property( - property: 'change_vs_last_month', - type: 'number', - format: 'float', - example: 12.5 - ), - ], - type: 'object' + property: 'change_vs_last_month', + type: 'number', + format: 'float', + example: 12.5 ), + ], + type: 'object' + ), + new OA\Property( + property: 'active_campaigns', + properties: [ + new OA\Property(property: 'value', type: 'integer', example: 12), new OA\Property( - property: 'active_campaigns', - properties: [ - new OA\Property(property: 'value', type: 'integer', example: 12), - new OA\Property( - property: 'change_vs_last_month', - type: 'number', - format: 'float', - example: 0 - ), - ], - type: 'object' + property: 'change_vs_last_month', + type: 'number', + format: 'float', + example: 0 ), + ], + type: 'object' + ), + new OA\Property( + property: 'open_rate', + properties: [ new OA\Property( - property: 'open_rate', - properties: [ - new OA\Property( - property: 'value', - type: 'number', - format: 'float', - example: 12 - ), - new OA\Property( - property: 'change_vs_last_month', - type: 'number', - format: 'float', - example: 0 - ), - ], - type: 'object' + property: 'value', + type: 'number', + format: 'float', + example: 12 ), new OA\Property( - property: 'bounce_rate', - properties: [ - new OA\Property( - property: 'value', - type: 'number', - format: 'float', - example: 12 - ), - new OA\Property( - property: 'change_vs_last_month', - type: 'number', - format: 'float', - example: 0 - ), - ], - type: 'object' + property: 'change_vs_last_month', + type: 'number', + format: 'float', + example: 0 ), ], type: 'object' ), new OA\Property( - property: 'recent_campaigns', - type: 'array', - items: new OA\Items( - properties: [ - new OA\Property(property: 'name', type: 'string', example: 'March Newsletter'), - new OA\Property( - property: 'status', - type: 'string', - example: 'sent', - nullable: true - ), - new OA\Property( - property: 'date', - type: 'string', - format: 'date', - example: '2026-03-15', - nullable: true - ), - new OA\Property(property: 'open_rate', type: 'string', example: '42.50%'), - new OA\Property(property: 'click_rate', type: 'string', example: '8.10%'), - ], - type: 'object' - ) - ), - new OA\Property( - property: 'campaign_performance', - type: 'array', - items: new OA\Items( - properties: [ - new OA\Property( - property: 'date', - type: 'string', - format: 'date', - example: '2026-03-19' - ), - new OA\Property(property: 'opens', type: 'integer', example: 234), - new OA\Property(property: 'clicks', type: 'integer', example: 57), - ], - type: 'object' - ) + property: 'bounce_rate', + properties: [ + new OA\Property( + property: 'value', + type: 'number', + format: 'float', + example: 12 + ), + new OA\Property( + property: 'change_vs_last_month', + type: 'number', + format: 'float', + example: 0 + ), + ], + type: 'object' ), ], type: 'object' @@ -501,16 +453,126 @@ public function getTopLocalParts(Request $request): JsonResponse ) ] )] - public function getDashboardStatistics(Request $request): JsonResponse + public function getDashboardSummary(Request $request): JsonResponse + { + $this->requireAuthentication($request); + + $data = $this->analyticsService->getSummaryStatistics(); + + return $this->json($data, Response::HTTP_OK); + } + + #[Route('/dashboard/recent-campaigns', name: 'dashboard_recent_campaigns', methods: ['GET'])] + #[OA\Get( + path: '/api/v2/analytics/dashboard/recent-campaigns', + description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' . + 'Returns the most recent campaigns with their performance metrics.', + summary: 'Gets dashboard recent campaigns statistics.', + tags: ['analytics'], + parameters: [ + new OA\Parameter( + name: 'php-auth-pw', + description: 'Session key obtained from login', + in: 'header', + required: true, + schema: new OA\Schema(type: 'string') + ) + ], + responses: [ + new OA\Response( + response: 200, + description: 'Success', + content: new OA\JsonContent( + type: 'array', + items: new OA\Items( + properties: [ + new OA\Property(property: 'name', type: 'string', example: 'March Newsletter'), + new OA\Property( + property: 'status', + type: 'string', + example: 'sent', + nullable: true + ), + new OA\Property( + property: 'date', + type: 'string', + format: 'date', + example: '2026-03-15', + nullable: true + ), + new OA\Property(property: 'open_rate', type: 'string', example: '42.50%'), + new OA\Property(property: 'click_rate', type: 'string', example: '8.10%'), + ], + type: 'object' + ) + ) + ), + new OA\Response( + response: 401, + description: 'Not authenticated', + content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') + ) + ] + )] + public function getRecentCampaignsStatistics(Request $request): JsonResponse + { + $this->requireAuthentication($request); + + $data = $this->analyticsService->getRecentCampaigns(); + + return $this->json($data, Response::HTTP_OK); + } + + #[Route('/dashboard/performance', name: 'dashboard_performance', methods: ['GET'])] + #[OA\Get( + path: '/api/v2/analytics/dashboard/performance', + description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' . + 'Returns campaign performance metrics over time.', + summary: 'Gets dashboard campaign performance statistics.', + tags: ['analytics'], + parameters: [ + new OA\Parameter( + name: 'php-auth-pw', + description: 'Session key obtained from login', + in: 'header', + required: true, + schema: new OA\Schema(type: 'string') + ) + ], + responses: [ + new OA\Response( + response: 200, + description: 'Success', + content: new OA\JsonContent( + type: 'array', + items: new OA\Items( + properties: [ + new OA\Property( + property: 'date', + type: 'string', + format: 'date', + example: '2026-03-19' + ), + new OA\Property(property: 'opens', type: 'integer', example: 234), + new OA\Property(property: 'clicks', type: 'integer', example: 57), + ], + type: 'object' + ) + ) + ), + new OA\Response( + response: 401, + description: 'Not authenticated', + content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') + ) + ] + )] + public function getCampaignPerformanceStatistics(Request $request): JsonResponse { $this->requireAuthentication($request); - $response = [ - 'summary_statistics' => $this->analyticsService->getSummaryStatistics(), - 'recent_campaigns' => $this->analyticsService->getRecentCampaigns(), - 'campaign_performance' => $this->analyticsService->getCampaignPerformance(), - ]; + $data = $this->analyticsService->getCampaignPerformance(); - return $this->json($response, Response::HTTP_OK); + return $this->json($data, Response::HTTP_OK); } } diff --git a/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php b/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php index 18ee8c19..b0c05ebe 100644 --- a/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php +++ b/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php @@ -255,13 +255,13 @@ public function testGetTopLocalPartsWithInvalidLimitParameter(): void self::assertIsArray($response['local_parts']); } - public function testGetDashboardStatisticsWithoutSessionKeyReturnsUnauthorized(): void + public function testGetDashboardSummaryWithoutSessionKeyReturnsUnauthorized(): void { - self::getClient()->request('GET', '/api/v2/analytics/dashboard'); + self::getClient()->request('GET', '/api/v2/analytics/dashboard/summary'); $this->assertHttpUnauthorized(); } - public function testGetDashboardStatisticsWithValidSessionReturnsCardsData(): void + public function testGetDashboardSummaryWithValidSessionReturnsCardsData(): void { $this->loadFixtures([ AdministratorFixture::class, @@ -270,21 +270,62 @@ public function testGetDashboardStatisticsWithValidSessionReturnsCardsData(): vo MessageFixture::class, ]); - $this->authenticatedJsonRequest('GET', '/api/v2/analytics/dashboard'); + $this->authenticatedJsonRequest('GET', '/api/v2/analytics/dashboard/summary'); $this->assertHttpOkay(); $response = $this->getDecodedJsonResponseContent(); self::assertIsArray($response); - self::assertArrayHasKey('summary_statistics', $response); - self::assertArrayHasKey('recent_campaigns', $response); - self::assertArrayHasKey('campaign_performance', $response); foreach (['total_subscribers', 'active_campaigns', 'open_rate', 'bounce_rate'] as $metric) { - self::assertIsArray($response['summary_statistics'][$metric]); - self::assertArrayHasKey('value', $response['summary_statistics'][$metric]); - self::assertArrayHasKey('change_vs_last_month', $response['summary_statistics'][$metric]); - self::assertIsNumeric($response['summary_statistics'][$metric]['value']); - self::assertIsNumeric($response['summary_statistics'][$metric]['change_vs_last_month']); + self::assertIsArray($response[$metric]); + self::assertArrayHasKey('value', $response[$metric]); + self::assertArrayHasKey('change_vs_last_month', $response[$metric]); + self::assertIsNumeric($response[$metric]['value']); + self::assertIsNumeric($response[$metric]['change_vs_last_month']); } } + + public function testGetRecentCampaignsStatisticsWithoutSessionKeyReturnsUnauthorized(): void + { + self::getClient()->request('GET', '/api/v2/analytics/dashboard/recent-campaigns'); + $this->assertHttpUnauthorized(); + } + + public function testGetRecentCampaignsStatisticsWithValidSessionReturnsCampaignsData(): void + { + $this->loadFixtures([ + AdministratorFixture::class, + AdministratorTokenFixture::class, + SubscriberFixture::class, + MessageFixture::class, + ]); + + $this->authenticatedJsonRequest('GET', '/api/v2/analytics/dashboard/recent-campaigns'); + $this->assertHttpOkay(); + $response = $this->getDecodedJsonResponseContent(); + + self::assertIsArray($response); + } + + public function testGetCampaignPerformanceStatisticsWithoutSessionKeyReturnsUnauthorized(): void + { + self::getClient()->request('GET', '/api/v2/analytics/dashboard/performance'); + $this->assertHttpUnauthorized(); + } + + public function testGetCampaignPerformanceStatisticsWithValidSessionReturnsPerformanceData(): void + { + $this->loadFixtures([ + AdministratorFixture::class, + AdministratorTokenFixture::class, + SubscriberFixture::class, + MessageFixture::class, + ]); + + $this->authenticatedJsonRequest('GET', '/api/v2/analytics/dashboard/performance'); + $this->assertHttpOkay(); + $response = $this->getDecodedJsonResponseContent(); + + self::assertIsArray($response); + } } diff --git a/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php b/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php index 6bbdc7d2..401da045 100644 --- a/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php +++ b/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php @@ -443,7 +443,7 @@ public function testGetTopLocalPartsReturnsJsonResponse(): void ], json_decode($response->getContent(), true)); } - public function testGetDashboardStatisticsWithoutStatisticsPrivilegeDoesNotThrowException(): void + public function testGetDashboardSummaryDoesNotCheckStatisticsPrivilege(): void { $request = new Request(); @@ -456,27 +456,7 @@ public function testGetDashboardStatisticsWithoutStatisticsPrivilegeDoesNotThrow $this->privileges ->expects(self::never()) ->method('has') - ->with(PrivilegeFlag::Statistics) - ->willReturn(false); - - $this->controller->getDashboardStatistics($request); - } - - public function testGetDashboardStatisticsReturnsJsonResponse(): void - { - $request = new Request(); - - $this->authentication - ->expects(self::once()) - ->method('authenticateByApiKey') - ->with($request) - ->willReturn($this->administrator); - - $this->privileges - ->expects(self::never()) - ->method('has') - ->with(PrivilegeFlag::Statistics) - ->willReturn(true); + ->with(PrivilegeFlag::Statistics); $this->analyticsService ->expects(self::once()) @@ -500,30 +480,98 @@ public function testGetDashboardStatisticsReturnsJsonResponse(): void ], ]); - $response = $this->controller->getDashboardStatistics($request); + $response = $this->controller->getDashboardSummary($request); self::assertEquals(Response::HTTP_OK, $response->getStatusCode()); self::assertEquals([ - 'summary_statistics' => [ - 'total_subscribers' => [ - 'value' => 80, - 'change_vs_last_month' => 10.5, - ], - 'active_campaigns' => [ - 'value' => 12, - 'change_vs_last_month' => -4.25, - ], - 'open_rate' => [ - 'value' => 40.0, - 'change_vs_last_month' => 3.3, - ], - 'bounce_rate' => [ - 'value' => 6.67, - 'change_vs_last_month' => -1.1, - ], + 'total_subscribers' => [ + 'value' => 80, + 'change_vs_last_month' => 10.5, + ], + 'active_campaigns' => [ + 'value' => 12, + 'change_vs_last_month' => -4.25, + ], + 'open_rate' => [ + 'value' => 40.0, + 'change_vs_last_month' => 3.3, + ], + 'bounce_rate' => [ + 'value' => 6.67, + 'change_vs_last_month' => -1.1, ], - 'recent_campaigns' => [], - 'campaign_performance' => [], ], json_decode($response->getContent(), true)); } + + public function testGetRecentCampaignsStatisticsReturnsJsonResponse(): void + { + $request = new Request(); + + $this->authentication + ->expects(self::once()) + ->method('authenticateByApiKey') + ->with($request) + ->willReturn($this->administrator); + + $this->privileges + ->expects(self::never()) + ->method('has') + ->with(PrivilegeFlag::Statistics); + + $expectedData = [ + [ + 'name' => 'March Newsletter', + 'status' => 'sent', + 'date' => '2026-03-15', + 'open_rate' => '42.50%', + 'click_rate' => '8.10%', + ], + ]; + + $this->analyticsService + ->expects(self::once()) + ->method('getRecentCampaigns') + ->willReturn($expectedData); + + $response = $this->controller->getRecentCampaignsStatistics($request); + + self::assertInstanceOf(JsonResponse::class, $response); + self::assertEquals(Response::HTTP_OK, $response->getStatusCode()); + self::assertEquals($expectedData, json_decode($response->getContent(), true)); + } + + public function testGetCampaignPerformanceStatisticsReturnsJsonResponse(): void + { + $request = new Request(); + + $this->authentication + ->expects(self::once()) + ->method('authenticateByApiKey') + ->with($request) + ->willReturn($this->administrator); + + $this->privileges + ->expects(self::never()) + ->method('has') + ->with(PrivilegeFlag::Statistics); + + $expectedData = [ + [ + 'date' => '2026-03-19', + 'opens' => 234, + 'clicks' => 57, + ], + ]; + + $this->analyticsService + ->expects(self::once()) + ->method('getCampaignPerformance') + ->willReturn($expectedData); + + $response = $this->controller->getCampaignPerformanceStatistics($request); + + self::assertInstanceOf(JsonResponse::class, $response); + self::assertEquals(Response::HTTP_OK, $response->getStatusCode()); + self::assertEquals($expectedData, json_decode($response->getContent(), true)); + } } From 316b3a9b8cd89978daef3666f5b9a71b6239fc5b Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 20 Aug 2026 15:03:38 +0400 Subject: [PATCH 6/8] Add status and sort query parameters to CampaignController and implement filtering and sorting in CampaignService --- .../Controller/CampaignController.php | 15 ++++++ src/Messaging/Service/CampaignService.php | 8 +++- .../Controller/CampaignControllerTest.php | 44 ++++++++++++++++++ .../Messaging/Service/CampaignServiceTest.php | 46 +++++++++++++++++++ 4 files changed, 112 insertions(+), 1 deletion(-) diff --git a/src/Messaging/Controller/CampaignController.php b/src/Messaging/Controller/CampaignController.php index 1769aa7f..c4ff688a 100644 --- a/src/Messaging/Controller/CampaignController.php +++ b/src/Messaging/Controller/CampaignController.php @@ -74,6 +74,21 @@ public function __construct( required: false, schema: new OA\Schema(type: 'string', maxLength: 50) ), + new OA\Parameter( + name: 'status', + description: 'Filter by one or more comma-separated statuses: ' . + 'draft, prepared, submitted, inprocess, sent, suspended', + in: 'query', + required: false, + schema: new OA\Schema(type: 'string') + ), + new OA\Parameter( + name: 'sort', + description: 'Sort direction by campaign id - desc returns newest campaigns first', + in: 'query', + required: false, + schema: new OA\Schema(type: 'string', default: 'asc', enum: ['asc', 'desc']) + ), ], responses: [ new OA\Response( diff --git a/src/Messaging/Service/CampaignService.php b/src/Messaging/Service/CampaignService.php index 5f50124b..e2ea8e78 100644 --- a/src/Messaging/Service/CampaignService.php +++ b/src/Messaging/Service/CampaignService.php @@ -32,7 +32,13 @@ public function getMessages(Request $request, Administrator $administrator): arr { $filter = (new MessageFilter()) ->setOwner($administrator) - ->setSubject($request->query->get('subject')); + ->setSubject($request->query->get('subject')) + ->setStatus($request->query->get('status')); + + $sort = $request->query->get('sort'); + if (in_array($sort, ['asc', 'desc'], true)) { + $filter->setSortOrder($sort); + } return $this->paginatedProvider->getPaginatedList( request: $request, diff --git a/tests/Integration/Messaging/Controller/CampaignControllerTest.php b/tests/Integration/Messaging/Controller/CampaignControllerTest.php index 0cadb2d6..6cfd8cfc 100644 --- a/tests/Integration/Messaging/Controller/CampaignControllerTest.php +++ b/tests/Integration/Messaging/Controller/CampaignControllerTest.php @@ -87,4 +87,48 @@ public function testDeleteCampaignReturnsNoContent(): void $this->authenticatedJsonRequest('DELETE', '/api/v2/campaigns/1'); $this->assertHttpNoContent(); } + + public function testGetCampaignsFiltersBySingleStatus(): void + { + $this->loadFixtures([AdministratorFixture::class, MessageFixture::class]); + + $this->authenticatedJsonRequest('GET', '/api/v2/campaigns?status=sent'); + $response = $this->getDecodedJsonResponseContent(); + + self::assertCount(1, $response['items']); + self::assertSame(1, $response['items'][0]['id']); + } + + public function testGetCampaignsFiltersByCommaSeparatedStatuses(): void + { + $this->loadFixtures([AdministratorFixture::class, MessageFixture::class]); + + $this->authenticatedJsonRequest('GET', '/api/v2/campaigns?status=submitted,draft'); + $response = $this->getDecodedJsonResponseContent(); + + self::assertCount(1, $response['items']); + self::assertSame(2, $response['items'][0]['id']); + } + + public function testGetCampaignsSortsDescendingWhenRequested(): void + { + $this->loadFixtures([AdministratorFixture::class, MessageFixture::class]); + + $this->authenticatedJsonRequest('GET', '/api/v2/campaigns?sort=desc'); + $response = $this->getDecodedJsonResponseContent(); + + self::assertSame(2, $response['items'][0]['id']); + self::assertSame(1, $response['items'][1]['id']); + } + + public function testGetCampaignsDefaultsToAscendingOrder(): void + { + $this->loadFixtures([AdministratorFixture::class, MessageFixture::class]); + + $this->authenticatedJsonRequest('GET', '/api/v2/campaigns'); + $response = $this->getDecodedJsonResponseContent(); + + self::assertSame(1, $response['items'][0]['id']); + self::assertSame(2, $response['items'][1]['id']); + } } diff --git a/tests/Unit/Messaging/Service/CampaignServiceTest.php b/tests/Unit/Messaging/Service/CampaignServiceTest.php index e328fe97..44a83441 100644 --- a/tests/Unit/Messaging/Service/CampaignServiceTest.php +++ b/tests/Unit/Messaging/Service/CampaignServiceTest.php @@ -68,6 +68,52 @@ public function testGetMessagesReturnsExpectedResult(): void $this->assertSame($expectedResult, $result); } + public function testGetMessagesAppliesStatusAndSortFromQuery(): void + { + $request = new Request(query: ['status' => 'submitted,prepared', 'sort' => 'desc']); + $administrator = $this->createMock(Administrator::class); + $expectedResult = ['items' => [], 'pagination' => []]; + + $this->paginatedProvider->expects($this->once()) + ->method('getPaginatedList') + ->with( + $this->identicalTo($request), + $this->identicalTo($this->normalizer), + Message::class, + $this->callback(function (MessageFilter $filter) { + return $filter->getStatus() === 'submitted,prepared' && $filter->getSortOrder() === 'desc'; + }) + ) + ->willReturn($expectedResult); + + $result = $this->campaignService->getMessages($request, $administrator); + + $this->assertSame($expectedResult, $result); + } + + public function testGetMessagesIgnoresInvalidSortValue(): void + { + $request = new Request(query: ['sort' => 'bogus']); + $administrator = $this->createMock(Administrator::class); + $expectedResult = ['items' => [], 'pagination' => []]; + + $this->paginatedProvider->expects($this->once()) + ->method('getPaginatedList') + ->with( + $this->identicalTo($request), + $this->identicalTo($this->normalizer), + Message::class, + $this->callback(function (MessageFilter $filter) { + return $filter->getSortOrder() === 'asc'; + }) + ) + ->willReturn($expectedResult); + + $result = $this->campaignService->getMessages($request, $administrator); + + $this->assertSame($expectedResult, $result); + } + public function testGetMessageThrowsExceptionWhenMessageIsNull(): void { $this->expectException(NotFoundHttpException::class); From a36aaa4a496b91ddbbd10ac89392638939630a54 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Tue, 25 Aug 2026 10:41:39 +0400 Subject: [PATCH 7/8] Add getSupportedTypes method to normalizers for type support --- src/Common/Serializer/CursorPaginationNormalizer.php | 10 ++++++++++ src/Configuration/Serializer/ConfigNormalizer.php | 10 ++++++++++ .../Serializer/AdminAttributeDefinitionNormalizer.php | 10 ++++++++++ .../Serializer/AdminAttributeValueNormalizer.php | 10 ++++++++++ src/Identity/Serializer/AdministratorNormalizer.php | 10 ++++++++++ .../Serializer/AdministratorTokenNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/BounceNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/BounceRegexNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/EditorUploadNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/FileListingNormalizer.php | 10 ++++++++++ .../Serializer/ForwardingResultNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/ListMessageNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/MessageNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/TemplateImageNormalizer.php | 10 ++++++++++ src/Messaging/Serializer/TemplateNormalizer.php | 10 ++++++++++ .../Serializer/AttributeDefinitionNormalizer.php | 10 ++++++++++ .../Serializer/SubscribePageDataNormalizer.php | 10 ++++++++++ .../Serializer/SubscribePageNormalizer.php | 10 ++++++++++ .../Serializer/SubscribePagePublicNormalizer.php | 10 ++++++++++ .../Serializer/SubscriberAttributeValueNormalizer.php | 10 ++++++++++ .../Serializer/SubscriberHistoryNormalizer.php | 10 ++++++++++ .../Serializer/SubscriberListNormalizer.php | 10 ++++++++++ src/Subscription/Serializer/SubscriberNormalizer.php | 10 ++++++++++ .../Serializer/SubscriberOnlyNormalizer.php | 10 ++++++++++ .../Serializer/SubscribersExportRequestNormalizer.php | 10 ++++++++++ src/Subscription/Serializer/SubscriptionNormalizer.php | 10 ++++++++++ .../Serializer/UserBlacklistNormalizer.php | 10 ++++++++++ 27 files changed, 270 insertions(+) diff --git a/src/Common/Serializer/CursorPaginationNormalizer.php b/src/Common/Serializer/CursorPaginationNormalizer.php index 8aad046d..c3408600 100644 --- a/src/Common/Serializer/CursorPaginationNormalizer.php +++ b/src/Common/Serializer/CursorPaginationNormalizer.php @@ -38,4 +38,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof CursorPaginationResult; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + CursorPaginationResult::class => true, + ]; + } } diff --git a/src/Configuration/Serializer/ConfigNormalizer.php b/src/Configuration/Serializer/ConfigNormalizer.php index 7ffa6975..c0deea35 100644 --- a/src/Configuration/Serializer/ConfigNormalizer.php +++ b/src/Configuration/Serializer/ConfigNormalizer.php @@ -48,4 +48,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Config; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Config::class => true, + ]; + } } diff --git a/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php b/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php index 68be95a4..2b0690b9 100644 --- a/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php +++ b/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php @@ -48,4 +48,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof AdminAttributeDefinition; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + AdminAttributeDefinition::class => true, + ]; + } } diff --git a/src/Identity/Serializer/AdminAttributeValueNormalizer.php b/src/Identity/Serializer/AdminAttributeValueNormalizer.php index d6a0fd72..368631f9 100644 --- a/src/Identity/Serializer/AdminAttributeValueNormalizer.php +++ b/src/Identity/Serializer/AdminAttributeValueNormalizer.php @@ -48,4 +48,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof AdminAttributeValue; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + AdminAttributeValue::class => true, + ]; + } } diff --git a/src/Identity/Serializer/AdministratorNormalizer.php b/src/Identity/Serializer/AdministratorNormalizer.php index 751bfe20..41ef1343 100644 --- a/src/Identity/Serializer/AdministratorNormalizer.php +++ b/src/Identity/Serializer/AdministratorNormalizer.php @@ -56,4 +56,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Administrator; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Administrator::class => true, + ]; + } } diff --git a/src/Identity/Serializer/AdministratorTokenNormalizer.php b/src/Identity/Serializer/AdministratorTokenNormalizer.php index a04e8a7f..e8321584 100644 --- a/src/Identity/Serializer/AdministratorTokenNormalizer.php +++ b/src/Identity/Serializer/AdministratorTokenNormalizer.php @@ -33,4 +33,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof AdministratorToken; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + AdministratorToken::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/BounceNormalizer.php b/src/Messaging/Serializer/BounceNormalizer.php index 09193d94..bee82fc8 100644 --- a/src/Messaging/Serializer/BounceNormalizer.php +++ b/src/Messaging/Serializer/BounceNormalizer.php @@ -52,4 +52,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof BounceView; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + BounceView::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/BounceRegexNormalizer.php b/src/Messaging/Serializer/BounceRegexNormalizer.php index 47d285fa..07ea1ca0 100644 --- a/src/Messaging/Serializer/BounceRegexNormalizer.php +++ b/src/Messaging/Serializer/BounceRegexNormalizer.php @@ -54,4 +54,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof BounceRegex; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + BounceRegex::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/EditorUploadNormalizer.php b/src/Messaging/Serializer/EditorUploadNormalizer.php index 4b1a4a36..72af0310 100644 --- a/src/Messaging/Serializer/EditorUploadNormalizer.php +++ b/src/Messaging/Serializer/EditorUploadNormalizer.php @@ -51,4 +51,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof UploadResult; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + UploadResult::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/FileListingNormalizer.php b/src/Messaging/Serializer/FileListingNormalizer.php index cc7a2e52..b0a6561d 100644 --- a/src/Messaging/Serializer/FileListingNormalizer.php +++ b/src/Messaging/Serializer/FileListingNormalizer.php @@ -57,4 +57,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof DirectoryEntryDto; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + DirectoryEntryDto::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/ForwardingResultNormalizer.php b/src/Messaging/Serializer/ForwardingResultNormalizer.php index 61b85cf7..f97a9a91 100644 --- a/src/Messaging/Serializer/ForwardingResultNormalizer.php +++ b/src/Messaging/Serializer/ForwardingResultNormalizer.php @@ -68,4 +68,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof ForwardingResult; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + ForwardingResult::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/ListMessageNormalizer.php b/src/Messaging/Serializer/ListMessageNormalizer.php index 5b9d1c2f..22ef420d 100644 --- a/src/Messaging/Serializer/ListMessageNormalizer.php +++ b/src/Messaging/Serializer/ListMessageNormalizer.php @@ -63,4 +63,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof ListMessage; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + ListMessage::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/MessageNormalizer.php b/src/Messaging/Serializer/MessageNormalizer.php index e636bb60..7038cbc5 100644 --- a/src/Messaging/Serializer/MessageNormalizer.php +++ b/src/Messaging/Serializer/MessageNormalizer.php @@ -151,4 +151,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Message; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Message::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/TemplateImageNormalizer.php b/src/Messaging/Serializer/TemplateImageNormalizer.php index 88206aa8..3e816b72 100644 --- a/src/Messaging/Serializer/TemplateImageNormalizer.php +++ b/src/Messaging/Serializer/TemplateImageNormalizer.php @@ -58,4 +58,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof TemplateImage; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + TemplateImage::class => true, + ]; + } } diff --git a/src/Messaging/Serializer/TemplateNormalizer.php b/src/Messaging/Serializer/TemplateNormalizer.php index 3c75baa4..6f920b50 100644 --- a/src/Messaging/Serializer/TemplateNormalizer.php +++ b/src/Messaging/Serializer/TemplateNormalizer.php @@ -61,4 +61,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Template; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Template::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/AttributeDefinitionNormalizer.php b/src/Subscription/Serializer/AttributeDefinitionNormalizer.php index 0dae549a..9753c0cf 100644 --- a/src/Subscription/Serializer/AttributeDefinitionNormalizer.php +++ b/src/Subscription/Serializer/AttributeDefinitionNormalizer.php @@ -75,4 +75,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscriberAttributeDefinition; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscriberAttributeDefinition::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscribePageDataNormalizer.php b/src/Subscription/Serializer/SubscribePageDataNormalizer.php index eeef9f8f..adc1ab5e 100644 --- a/src/Subscription/Serializer/SubscribePageDataNormalizer.php +++ b/src/Subscription/Serializer/SubscribePageDataNormalizer.php @@ -43,4 +43,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscribePageData; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscribePageData::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscribePageNormalizer.php b/src/Subscription/Serializer/SubscribePageNormalizer.php index 702b6484..1d355ff7 100644 --- a/src/Subscription/Serializer/SubscribePageNormalizer.php +++ b/src/Subscription/Serializer/SubscribePageNormalizer.php @@ -58,4 +58,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscribePage; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscribePage::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscribePagePublicNormalizer.php b/src/Subscription/Serializer/SubscribePagePublicNormalizer.php index 25ab7c24..c7777427 100644 --- a/src/Subscription/Serializer/SubscribePagePublicNormalizer.php +++ b/src/Subscription/Serializer/SubscribePagePublicNormalizer.php @@ -158,4 +158,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscribePage; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscribePage::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php b/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php index 04a88e1c..0988213b 100644 --- a/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php +++ b/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php @@ -47,4 +47,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscriberAttributeValue; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscriberAttributeValue::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscriberHistoryNormalizer.php b/src/Subscription/Serializer/SubscriberHistoryNormalizer.php index 9189a5e7..22abba1a 100644 --- a/src/Subscription/Serializer/SubscriberHistoryNormalizer.php +++ b/src/Subscription/Serializer/SubscriberHistoryNormalizer.php @@ -53,4 +53,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscriberHistory; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscriberHistory::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscriberListNormalizer.php b/src/Subscription/Serializer/SubscriberListNormalizer.php index 976fcf2a..34d7a28e 100644 --- a/src/Subscription/Serializer/SubscriberListNormalizer.php +++ b/src/Subscription/Serializer/SubscriberListNormalizer.php @@ -59,4 +59,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscriberList; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscriberList::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscriberNormalizer.php b/src/Subscription/Serializer/SubscriberNormalizer.php index 9ce81556..3cbdd69c 100644 --- a/src/Subscription/Serializer/SubscriberNormalizer.php +++ b/src/Subscription/Serializer/SubscriberNormalizer.php @@ -92,4 +92,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Subscriber; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Subscriber::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscriberOnlyNormalizer.php b/src/Subscription/Serializer/SubscriberOnlyNormalizer.php index 0b93d8af..4fb719ea 100644 --- a/src/Subscription/Serializer/SubscriberOnlyNormalizer.php +++ b/src/Subscription/Serializer/SubscriberOnlyNormalizer.php @@ -59,4 +59,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Subscriber; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Subscriber::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php b/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php index 122ee800..78fbab27 100644 --- a/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php +++ b/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php @@ -34,4 +34,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof SubscribersExportRequest; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + SubscribersExportRequest::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/SubscriptionNormalizer.php b/src/Subscription/Serializer/SubscriptionNormalizer.php index eac2fef8..98bae23b 100644 --- a/src/Subscription/Serializer/SubscriptionNormalizer.php +++ b/src/Subscription/Serializer/SubscriptionNormalizer.php @@ -59,4 +59,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof Subscription; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + Subscription::class => true, + ]; + } } diff --git a/src/Subscription/Serializer/UserBlacklistNormalizer.php b/src/Subscription/Serializer/UserBlacklistNormalizer.php index 466debe7..bcd32857 100644 --- a/src/Subscription/Serializer/UserBlacklistNormalizer.php +++ b/src/Subscription/Serializer/UserBlacklistNormalizer.php @@ -39,4 +39,14 @@ public function supportsNormalization($data, string $format = null): bool { return $data instanceof UserBlacklist; } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getSupportedTypes(?string $format): array + { + return [ + UserBlacklist::class => true, + ]; + } } From 3279971e686bd8848f51640043c5c59e348929d7 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Wed, 26 Aug 2026 10:14:07 +0400 Subject: [PATCH 8/8] update phpstan --- composer.json | 2 +- config/services.yml | 2 +- src/Common/Controller/BaseController.php | 4 ++-- .../EventListener/ExceptionListener.php | 2 +- .../Serializer/CursorPaginationNormalizer.php | 6 +++--- .../Controller/ConfigController.php | 2 +- .../Serializer/ConfigNormalizer.php | 6 +++--- .../AdminAttributeDefinitionController.php | 2 +- .../AdminAttributeValueController.php | 2 +- .../Controller/AdministratorController.php | 2 +- .../Controller/PasswordResetController.php | 2 +- src/Identity/Controller/SessionController.php | 2 +- .../AdminAttributeDefinitionNormalizer.php | 6 +++--- .../AdminAttributeValueNormalizer.php | 6 +++--- .../Serializer/AdministratorNormalizer.php | 8 ++++---- .../AdministratorTokenNormalizer.php | 6 +++--- .../Controller/AttachmentController.php | 2 +- src/Messaging/Controller/BounceController.php | 2 +- .../Controller/BounceRegexController.php | 2 +- .../Controller/CampaignActionController.php | 2 +- .../Controller/CampaignController.php | 2 +- .../Controller/EditorUploadController.php | 2 +- .../Controller/EmailForwardController.php | 2 +- .../Controller/ListMessageController.php | 2 +- .../Controller/TemplateController.php | 2 +- .../Message/MessageMetadataRequest.php | 2 +- src/Messaging/Serializer/BounceNormalizer.php | 6 +++--- .../Serializer/BounceRegexNormalizer.php | 6 +++--- .../Serializer/EditorUploadNormalizer.php | 6 +++--- .../Serializer/FileListingNormalizer.php | 6 +++--- .../Serializer/ForwardingResultNormalizer.php | 6 +++--- .../Serializer/ListMessageNormalizer.php | 6 +++--- .../Serializer/MessageNormalizer.php | 6 +++--- .../Serializer/TemplateImageNormalizer.php | 6 +++--- .../Serializer/TemplateNormalizer.php | 6 +++--- .../Controller/AnalyticsController.php | 2 +- .../Controller/MessageOpenTrackController.php | 2 +- .../CampaignStatisticsNormalizer.php | 4 ++-- .../Serializer/TopDomainsNormalizer.php | 4 ++-- .../Serializer/TopLocalPartsNormalizer.php | 4 ++-- .../ViewOpensStatisticsNormalizer.php | 4 ++-- .../Controller/BlacklistController.php | 2 +- .../Controller/ListMembersController.php | 2 +- .../Controller/SubscribePageController.php | 2 +- .../SubscribePagePublicController.php | 6 +++--- ...ubscriberAttributeDefinitionController.php | 2 +- .../SubscriberAttributeValueController.php | 2 +- .../Controller/SubscriberController.php | 2 +- .../Controller/SubscriberExportController.php | 2 +- .../Controller/SubscriberImportController.php | 2 +- .../Controller/SubscriberListController.php | 2 +- .../Controller/SubscriptionController.php | 2 +- .../AttributeDefinitionNormalizer.php | 6 +++--- .../SubscribePageDataNormalizer.php | 6 +++--- .../Serializer/SubscribePageNormalizer.php | 6 +++--- .../SubscribePagePublicNormalizer.php | 6 +++--- .../SubscriberAttributeValueNormalizer.php | 6 +++--- .../SubscriberHistoryNormalizer.php | 6 +++--- .../Serializer/SubscriberListNormalizer.php | 6 +++--- .../Serializer/SubscriberNormalizer.php | 11 ++++++----- .../Serializer/SubscriberOnlyNormalizer.php | 6 +++--- .../SubscribersExportRequestNormalizer.php | 6 +++--- .../Serializer/SubscriptionNormalizer.php | 6 +++--- .../Serializer/UserBlacklistNormalizer.php | 6 +++--- .../Controller/ConfigControllerTest.php | 1 - .../Controller/SessionControllerTest.php | 2 +- .../Controller/BounceControllerTest.php | 1 - .../Controller/BounceRegexControllerTest.php | 1 - .../Controller/CampaignControllerTest.php | 1 - .../Controller/EditorUploadControllerTest.php | 1 - .../Controller/EmailForwardControllerTest.php | 1 - .../Controller/TemplateControllerTest.php | 2 -- .../Controller/AnalyticsControllerTest.php | 19 +------------------ .../CursorPaginationNormalizerTest.php | 1 - .../Provider/PaginatedDataProviderTest.php | 1 - .../UniqueConfigKeyValidatorTest.php | 6 ------ ...AdminAttributeDefinitionNormalizerTest.php | 2 -- .../AdminAttributeValueNormalizerTest.php | 3 --- .../AdministratorNormalizerTest.php | 1 - .../UniqueLoginNameValidatorTest.php | 4 ---- .../Controller/EditorUploadControllerTest.php | 2 +- .../Request/CreateBounceRegexRequestTest.php | 3 --- .../Request/ForwardMessageRequestTest.php | 2 -- .../ForwardingResultNormalizerTest.php | 1 - .../TemplateImageNormalizerTest.php | 2 -- .../Serializer/TemplateNormalizerTest.php | 3 --- .../ContainsPlaceholderValidatorTest.php | 2 -- .../MaxForwardCountValidatorTest.php | 3 --- .../MaxPersonalNoteSizeValidatorTest.php | 6 ------ .../TemplateExistsValidatorTest.php | 3 --- .../UniqueTemplateTitleValidatorTest.php | 4 ---- .../Controller/AnalyticsControllerTest.php | 2 +- .../Serializer/TopDomainsNormalizerTest.php | 5 ----- .../TopLocalPartsNormalizerTest.php | 5 ----- ...bscriberAttributeDefinitionRequestTest.php | 2 -- .../AttributeDefinitionNormalizerTest.php | 3 --- .../Serializer/SubscriberNormalizerTest.php | 3 ++- .../Constraint/EmailExistsValidatorTest.php | 3 --- .../ListExistsPublicValidatorTest.php | 3 --- .../Constraint/ListExistsValidatorTest.php | 3 --- .../ValidPublicSubscriptionValidatorTest.php | 1 - tests/bootstrap.php | 4 +--- 102 files changed, 136 insertions(+), 233 deletions(-) diff --git a/composer.json b/composer.json index 29c904a8..11174c51 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,7 @@ "phpunit/phpunit": "^10.0", "guzzlehttp/guzzle": "^7.2.0", "squizlabs/php_codesniffer": "^3.2.0", - "phpstan/phpstan": "^1.10", + "phpstan/phpstan": "^2.2", "nette/caching": "^3.0.0", "nikic/php-parser": "^4.19.1", "phpmd/phpmd": "^2.6.0", diff --git a/config/services.yml b/config/services.yml index 086d199b..9471764e 100644 --- a/config/services.yml +++ b/config/services.yml @@ -12,7 +12,7 @@ services: calls: - ['registerHandler', [ 'json', ['@my.secure_handler', 'createResponse'] ] ] - PhpList\Core\Security\Authentication: + PhpList\Core\Domain\Identity\Service\Authentication: autowire: true autoconfigure: true diff --git a/src/Common/Controller/BaseController.php b/src/Common/Controller/BaseController.php index 136216b4..a723ebe1 100644 --- a/src/Common/Controller/BaseController.php +++ b/src/Common/Controller/BaseController.php @@ -5,13 +5,13 @@ namespace PhpList\RestBundle\Common\Controller; use PhpList\Core\Domain\Identity\Model\Administrator; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Validator\RequestValidator; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -/** @SuppressWarnings(PHPMD.NumberOfChildren) */ +/** @SuppressWarnings("PHPMD.NumberOfChildren") */ abstract class BaseController extends AbstractController { protected Authentication $authentication; diff --git a/src/Common/EventListener/ExceptionListener.php b/src/Common/EventListener/ExceptionListener.php index bdc183d4..fb8f75c9 100644 --- a/src/Common/EventListener/ExceptionListener.php +++ b/src/Common/EventListener/ExceptionListener.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Messaging\Exception\AttachmentFileNotFoundException; use PhpList\Core\Domain\Messaging\Exception\MessageNotReceivedException; use PhpList\Core\Domain\Messaging\Exception\SubscriberNotFoundException; -use PhpList\Core\Domain\Subscription\Exception\AttributeDefinitionCreationException; +use PhpList\Core\Domain\Common\Exception\AttributeDefinitionCreationException; use PhpList\Core\Domain\Subscription\Exception\SubscriptionCreationException; use PhpList\Core\Domain\Common\Exception\InvalidUploadException; use PhpList\Core\Domain\Common\Exception\MissingUploadException; diff --git a/src/Common/Serializer/CursorPaginationNormalizer.php b/src/Common/Serializer/CursorPaginationNormalizer.php index c3408600..d0a12836 100644 --- a/src/Common/Serializer/CursorPaginationNormalizer.php +++ b/src/Common/Serializer/CursorPaginationNormalizer.php @@ -11,7 +11,7 @@ class CursorPaginationNormalizer implements NormalizerInterface { /** * @param CursorPaginationResult $object - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -32,7 +32,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -40,7 +40,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Configuration/Controller/ConfigController.php b/src/Configuration/Controller/ConfigController.php index 52b5afe1..79d6cc29 100644 --- a/src/Configuration/Controller/ConfigController.php +++ b/src/Configuration/Controller/ConfigController.php @@ -10,7 +10,7 @@ use PhpList\Core\Domain\Configuration\Model\Config; use PhpList\Core\Domain\Configuration\Service\Manager\ConfigManager; use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Configuration\Request\CreateConfigRequest; diff --git a/src/Configuration/Serializer/ConfigNormalizer.php b/src/Configuration/Serializer/ConfigNormalizer.php index c0deea35..03f1f01d 100644 --- a/src/Configuration/Serializer/ConfigNormalizer.php +++ b/src/Configuration/Serializer/ConfigNormalizer.php @@ -23,7 +23,7 @@ class ConfigNormalizer implements NormalizerInterface /** * Normalizes a configuration item. * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -42,7 +42,7 @@ public function normalize($object, string $format = null, array $context = []): /** * Checks whether the value can be normalized. * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -50,7 +50,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Identity/Controller/AdminAttributeDefinitionController.php b/src/Identity/Controller/AdminAttributeDefinitionController.php index f02d9590..c28a22a8 100644 --- a/src/Identity/Controller/AdminAttributeDefinitionController.php +++ b/src/Identity/Controller/AdminAttributeDefinitionController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Common\Model\Filter\PaginatedFilter; use PhpList\Core\Domain\Identity\Model\AdminAttributeDefinition; use PhpList\Core\Domain\Identity\Service\Manager\AdminAttributeDefinitionManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Identity/Controller/AdminAttributeValueController.php b/src/Identity/Controller/AdminAttributeValueController.php index c20cfe0c..ae9b1977 100644 --- a/src/Identity/Controller/AdminAttributeValueController.php +++ b/src/Identity/Controller/AdminAttributeValueController.php @@ -11,7 +11,7 @@ use PhpList\Core\Domain\Identity\Model\AdminAttributeDefinition; use PhpList\Core\Domain\Identity\Model\AdminAttributeValue; use PhpList\Core\Domain\Identity\Service\Manager\AdminAttributeManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Identity/Controller/AdministratorController.php b/src/Identity/Controller/AdministratorController.php index 799cfd6f..ed0bd133 100644 --- a/src/Identity/Controller/AdministratorController.php +++ b/src/Identity/Controller/AdministratorController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Common\Model\Filter\PaginatedFilter; use PhpList\Core\Domain\Identity\Model\Administrator; use PhpList\Core\Domain\Identity\Service\Manager\AdministratorManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Identity/Controller/PasswordResetController.php b/src/Identity/Controller/PasswordResetController.php index ded9ac7b..ed8b6fbd 100644 --- a/src/Identity/Controller/PasswordResetController.php +++ b/src/Identity/Controller/PasswordResetController.php @@ -7,7 +7,7 @@ use Doctrine\ORM\EntityManagerInterface; use OpenApi\Attributes as OA; use PhpList\Core\Domain\Identity\Service\Manager\PasswordManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Identity\Request\RequestPasswordResetRequest; diff --git a/src/Identity/Controller/SessionController.php b/src/Identity/Controller/SessionController.php index 78d0e51f..7fb5f2c3 100644 --- a/src/Identity/Controller/SessionController.php +++ b/src/Identity/Controller/SessionController.php @@ -8,7 +8,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Identity\Model\AdministratorToken; use PhpList\Core\Domain\Identity\Service\Manager\SessionManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Identity\Request\CreateSessionRequest; diff --git a/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php b/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php index 2b0690b9..22e03c85 100644 --- a/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php +++ b/src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php @@ -23,7 +23,7 @@ class AdminAttributeDefinitionNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -42,7 +42,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -50,7 +50,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Identity/Serializer/AdminAttributeValueNormalizer.php b/src/Identity/Serializer/AdminAttributeValueNormalizer.php index 368631f9..cc403c3c 100644 --- a/src/Identity/Serializer/AdminAttributeValueNormalizer.php +++ b/src/Identity/Serializer/AdminAttributeValueNormalizer.php @@ -26,7 +26,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -42,7 +42,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -50,7 +50,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Identity/Serializer/AdministratorNormalizer.php b/src/Identity/Serializer/AdministratorNormalizer.php index 41ef1343..d8ff29ea 100644 --- a/src/Identity/Serializer/AdministratorNormalizer.php +++ b/src/Identity/Serializer/AdministratorNormalizer.php @@ -30,7 +30,7 @@ class AdministratorNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") * @throws InvalidArgumentException */ public function normalize($object, string $format = null, array $context = []): array @@ -45,12 +45,12 @@ public function normalize($object, string $format = null, array $context = []): 'email' => $object->getEmail(), 'super_user' => $object->isSuperUser(), 'privileges' => $object->getPrivileges()->all(), - 'created_at' => $object->getCreatedAt()?->format(DateTimeInterface::ATOM), + 'created_at' => $object->getCreatedAt()->format(DateTimeInterface::ATOM), ]; } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -58,7 +58,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Identity/Serializer/AdministratorTokenNormalizer.php b/src/Identity/Serializer/AdministratorTokenNormalizer.php index e8321584..2ab5d1de 100644 --- a/src/Identity/Serializer/AdministratorTokenNormalizer.php +++ b/src/Identity/Serializer/AdministratorTokenNormalizer.php @@ -11,7 +11,7 @@ class AdministratorTokenNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -27,7 +27,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -35,7 +35,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Controller/AttachmentController.php b/src/Messaging/Controller/AttachmentController.php index b7e90fe2..c9754bbb 100644 --- a/src/Messaging/Controller/AttachmentController.php +++ b/src/Messaging/Controller/AttachmentController.php @@ -7,7 +7,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Messaging\Model\Attachment; use PhpList\Core\Domain\Messaging\Service\AttachmentDownloadService; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use Symfony\Bridge\Doctrine\Attribute\MapEntity; diff --git a/src/Messaging/Controller/BounceController.php b/src/Messaging/Controller/BounceController.php index 30587aa1..216e2373 100644 --- a/src/Messaging/Controller/BounceController.php +++ b/src/Messaging/Controller/BounceController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Messaging\Model\Bounce; use PhpList\Core\Domain\Messaging\Repository\BounceRepository; use PhpList\Core\Domain\Messaging\Repository\UserMessageBounceRepository; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Messaging/Controller/BounceRegexController.php b/src/Messaging/Controller/BounceRegexController.php index 7cb09dba..f9e83ee3 100644 --- a/src/Messaging/Controller/BounceRegexController.php +++ b/src/Messaging/Controller/BounceRegexController.php @@ -8,7 +8,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Messaging\Model\BounceRegex; use PhpList\Core\Domain\Messaging\Service\Manager\BounceRegexManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Messaging\Request\BounceRegexRequest; diff --git a/src/Messaging/Controller/CampaignActionController.php b/src/Messaging/Controller/CampaignActionController.php index 326f832d..8646dbe2 100644 --- a/src/Messaging/Controller/CampaignActionController.php +++ b/src/Messaging/Controller/CampaignActionController.php @@ -11,7 +11,7 @@ use PhpList\Core\Domain\Messaging\Model\Message; use PhpList\Core\Domain\Messaging\Model\Message\MessageStatus; use PhpList\Core\Domain\Messaging\Service\Manager\MessageManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Messaging\Request\Message\MessageMetadataRequest; diff --git a/src/Messaging/Controller/CampaignController.php b/src/Messaging/Controller/CampaignController.php index c4ff688a..5ea647ab 100644 --- a/src/Messaging/Controller/CampaignController.php +++ b/src/Messaging/Controller/CampaignController.php @@ -7,7 +7,7 @@ use Doctrine\ORM\EntityManagerInterface; use OpenApi\Attributes as OA; use PhpList\Core\Domain\Messaging\Model\Message; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Messaging\Request\CreateMessageRequest; diff --git a/src/Messaging/Controller/EditorUploadController.php b/src/Messaging/Controller/EditorUploadController.php index adf70ab4..21b240e5 100644 --- a/src/Messaging/Controller/EditorUploadController.php +++ b/src/Messaging/Controller/EditorUploadController.php @@ -6,7 +6,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Common\Validator\UploadDirectoryValidator; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\Core\Domain\Common\Service\UploadService; use PhpList\Core\Domain\Common\Service\DirectoryListingService; diff --git a/src/Messaging/Controller/EmailForwardController.php b/src/Messaging/Controller/EmailForwardController.php index c7e1210d..5147f04c 100644 --- a/src/Messaging/Controller/EmailForwardController.php +++ b/src/Messaging/Controller/EmailForwardController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Messaging\Model\Dto\MessageForwardDto; use PhpList\Core\Domain\Messaging\Model\Message; use PhpList\Core\Domain\Messaging\Service\MessageForwardService; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Messaging\Request\ForwardMessageRequest; diff --git a/src/Messaging/Controller/ListMessageController.php b/src/Messaging/Controller/ListMessageController.php index fe0e80a7..191281b5 100644 --- a/src/Messaging/Controller/ListMessageController.php +++ b/src/Messaging/Controller/ListMessageController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Messaging\Model\Message; use PhpList\Core\Domain\Messaging\Service\Manager\ListMessageManager; use PhpList\Core\Domain\Subscription\Model\SubscriberList; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Messaging\Serializer\ListMessageNormalizer; diff --git a/src/Messaging/Controller/TemplateController.php b/src/Messaging/Controller/TemplateController.php index 7dff67f7..9800cc45 100644 --- a/src/Messaging/Controller/TemplateController.php +++ b/src/Messaging/Controller/TemplateController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Common\Model\Filter\PaginatedFilter; use PhpList\Core\Domain\Messaging\Model\Template; use PhpList\Core\Domain\Messaging\Service\Manager\TemplateManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Messaging/Request/Message/MessageMetadataRequest.php b/src/Messaging/Request/Message/MessageMetadataRequest.php index 3eb29249..5e04fda5 100644 --- a/src/Messaging/Request/Message/MessageMetadataRequest.php +++ b/src/Messaging/Request/Message/MessageMetadataRequest.php @@ -30,7 +30,7 @@ class MessageMetadataRequest implements RequestDtoInterface, RequestInterface public string $status; /** - * @SuppressWarnings(PHPMD.StaticAccess) + * @SuppressWarnings("PHPMD.StaticAccess") */ public function getDto(): MessageMetadataDto { diff --git a/src/Messaging/Serializer/BounceNormalizer.php b/src/Messaging/Serializer/BounceNormalizer.php index bee82fc8..616c5514 100644 --- a/src/Messaging/Serializer/BounceNormalizer.php +++ b/src/Messaging/Serializer/BounceNormalizer.php @@ -26,7 +26,7 @@ class BounceNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -46,7 +46,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -54,7 +54,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/BounceRegexNormalizer.php b/src/Messaging/Serializer/BounceRegexNormalizer.php index 07ea1ca0..76b20dd1 100644 --- a/src/Messaging/Serializer/BounceRegexNormalizer.php +++ b/src/Messaging/Serializer/BounceRegexNormalizer.php @@ -26,7 +26,7 @@ class BounceRegexNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -48,7 +48,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -56,7 +56,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/EditorUploadNormalizer.php b/src/Messaging/Serializer/EditorUploadNormalizer.php index 72af0310..8d744962 100644 --- a/src/Messaging/Serializer/EditorUploadNormalizer.php +++ b/src/Messaging/Serializer/EditorUploadNormalizer.php @@ -25,7 +25,7 @@ class EditorUploadNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -45,7 +45,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -53,7 +53,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/FileListingNormalizer.php b/src/Messaging/Serializer/FileListingNormalizer.php index b0a6561d..d5319cdb 100644 --- a/src/Messaging/Serializer/FileListingNormalizer.php +++ b/src/Messaging/Serializer/FileListingNormalizer.php @@ -29,7 +29,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -51,7 +51,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -59,7 +59,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/ForwardingResultNormalizer.php b/src/Messaging/Serializer/ForwardingResultNormalizer.php index f97a9a91..bdc7edc3 100644 --- a/src/Messaging/Serializer/ForwardingResultNormalizer.php +++ b/src/Messaging/Serializer/ForwardingResultNormalizer.php @@ -36,7 +36,7 @@ class ForwardingResultNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -62,7 +62,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -70,7 +70,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/ListMessageNormalizer.php b/src/Messaging/Serializer/ListMessageNormalizer.php index 22ef420d..2c10d864 100644 --- a/src/Messaging/Serializer/ListMessageNormalizer.php +++ b/src/Messaging/Serializer/ListMessageNormalizer.php @@ -39,7 +39,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -57,7 +57,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -65,7 +65,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/MessageNormalizer.php b/src/Messaging/Serializer/MessageNormalizer.php index 7038cbc5..87e5f63e 100644 --- a/src/Messaging/Serializer/MessageNormalizer.php +++ b/src/Messaging/Serializer/MessageNormalizer.php @@ -91,7 +91,7 @@ public function __construct(private readonly TemplateNormalizer $templateNormali } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -145,7 +145,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -153,7 +153,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/TemplateImageNormalizer.php b/src/Messaging/Serializer/TemplateImageNormalizer.php index 3e816b72..9b122579 100644 --- a/src/Messaging/Serializer/TemplateImageNormalizer.php +++ b/src/Messaging/Serializer/TemplateImageNormalizer.php @@ -32,7 +32,7 @@ class TemplateImageNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -52,7 +52,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -60,7 +60,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Messaging/Serializer/TemplateNormalizer.php b/src/Messaging/Serializer/TemplateNormalizer.php index 6f920b50..c9613d20 100644 --- a/src/Messaging/Serializer/TemplateNormalizer.php +++ b/src/Messaging/Serializer/TemplateNormalizer.php @@ -34,7 +34,7 @@ public function __construct(private readonly TemplateImageNormalizer $templateIm } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -55,7 +55,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -63,7 +63,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Statistics/Controller/AnalyticsController.php b/src/Statistics/Controller/AnalyticsController.php index c649e712..e51d2452 100644 --- a/src/Statistics/Controller/AnalyticsController.php +++ b/src/Statistics/Controller/AnalyticsController.php @@ -7,7 +7,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Analytics\Service\AnalyticsService; use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Statistics\Serializer\CampaignStatisticsNormalizer; diff --git a/src/Statistics/Controller/MessageOpenTrackController.php b/src/Statistics/Controller/MessageOpenTrackController.php index ccd3a675..3873a864 100644 --- a/src/Statistics/Controller/MessageOpenTrackController.php +++ b/src/Statistics/Controller/MessageOpenTrackController.php @@ -8,7 +8,7 @@ use OpenApi\Attributes as OA; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\Core\Domain\Analytics\Service\UserMessageService; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Validator\RequestValidator; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Statistics/Serializer/CampaignStatisticsNormalizer.php b/src/Statistics/Serializer/CampaignStatisticsNormalizer.php index b9f7e3d6..58454a18 100644 --- a/src/Statistics/Serializer/CampaignStatisticsNormalizer.php +++ b/src/Statistics/Serializer/CampaignStatisticsNormalizer.php @@ -27,7 +27,7 @@ class CampaignStatisticsNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize(mixed $object, string $format = null, array $context = []): array { @@ -71,7 +71,7 @@ private function normalizePagination(array $object, array $context): array } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool { diff --git a/src/Statistics/Serializer/TopDomainsNormalizer.php b/src/Statistics/Serializer/TopDomainsNormalizer.php index 06cde77f..0782d473 100644 --- a/src/Statistics/Serializer/TopDomainsNormalizer.php +++ b/src/Statistics/Serializer/TopDomainsNormalizer.php @@ -29,7 +29,7 @@ class TopDomainsNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize(mixed $object, string $format = null, array $context = []): array { @@ -52,7 +52,7 @@ public function normalize(mixed $object, string $format = null, array $context = } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool { diff --git a/src/Statistics/Serializer/TopLocalPartsNormalizer.php b/src/Statistics/Serializer/TopLocalPartsNormalizer.php index 6394a713..f19acc35 100644 --- a/src/Statistics/Serializer/TopLocalPartsNormalizer.php +++ b/src/Statistics/Serializer/TopLocalPartsNormalizer.php @@ -30,7 +30,7 @@ class TopLocalPartsNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize(mixed $object, string $format = null, array $context = []): array { @@ -54,7 +54,7 @@ public function normalize(mixed $object, string $format = null, array $context = } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool { diff --git a/src/Statistics/Serializer/ViewOpensStatisticsNormalizer.php b/src/Statistics/Serializer/ViewOpensStatisticsNormalizer.php index 11cac28c..8db27575 100644 --- a/src/Statistics/Serializer/ViewOpensStatisticsNormalizer.php +++ b/src/Statistics/Serializer/ViewOpensStatisticsNormalizer.php @@ -23,7 +23,7 @@ class ViewOpensStatisticsNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize(mixed $object, string $format = null, array $context = []): array { @@ -64,7 +64,7 @@ private function normalizePagination(array $object, array $context): array } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool { diff --git a/src/Subscription/Controller/BlacklistController.php b/src/Subscription/Controller/BlacklistController.php index 9b4e9580..723724f3 100644 --- a/src/Subscription/Controller/BlacklistController.php +++ b/src/Subscription/Controller/BlacklistController.php @@ -8,7 +8,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberBlacklistManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Subscription\Request\AddToBlacklistRequest; diff --git a/src/Subscription/Controller/ListMembersController.php b/src/Subscription/Controller/ListMembersController.php index 2677da8c..c3eca51e 100644 --- a/src/Subscription/Controller/ListMembersController.php +++ b/src/Subscription/Controller/ListMembersController.php @@ -8,7 +8,7 @@ use PhpList\Core\Domain\Subscription\Model\Filter\SubscriberFilter; use PhpList\Core\Domain\Subscription\Model\Subscriber; use PhpList\Core\Domain\Subscription\Model\SubscriberList; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Subscription/Controller/SubscribePageController.php b/src/Subscription/Controller/SubscribePageController.php index edfcac56..21ab9ffb 100644 --- a/src/Subscription/Controller/SubscribePageController.php +++ b/src/Subscription/Controller/SubscribePageController.php @@ -10,7 +10,7 @@ use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; use PhpList\Core\Domain\Subscription\Model\SubscribePage; use PhpList\Core\Domain\Subscription\Service\Manager\SubscribePageManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Subscription/Controller/SubscribePagePublicController.php b/src/Subscription/Controller/SubscribePagePublicController.php index 44b3284b..b851d87f 100644 --- a/src/Subscription/Controller/SubscribePagePublicController.php +++ b/src/Subscription/Controller/SubscribePagePublicController.php @@ -11,7 +11,7 @@ use PhpList\Core\Domain\Subscription\Service\Manager\SubscribePageManager; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberAttributeManager; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriptionManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Subscription\Request\PublicSubscriptionRequest; @@ -217,8 +217,8 @@ public function unsubscribe(Request $request, int $pageId): JsonResponse return $this->json(null, Response::HTTP_NO_CONTENT); } - $listsIds = explode(',', $listsField->getData() ?? ''); - if ($listsIds == []) { + $listsIds = array_filter(explode(',', $listsField->getData() ?? '')); + if (count($listsIds) === 0) { return $this->json(null, Response::HTTP_NO_CONTENT); } diff --git a/src/Subscription/Controller/SubscriberAttributeDefinitionController.php b/src/Subscription/Controller/SubscriberAttributeDefinitionController.php index 0851466a..92aa1d3b 100644 --- a/src/Subscription/Controller/SubscriberAttributeDefinitionController.php +++ b/src/Subscription/Controller/SubscriberAttributeDefinitionController.php @@ -10,7 +10,7 @@ use PhpList\Core\Domain\Subscription\Model\SubscriberAttributeDefinition; use PhpList\Core\Domain\Subscription\Repository\SubscriberAttributeDefinitionRepository; use PhpList\Core\Domain\Subscription\Service\Manager\AttributeDefinitionManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Subscription/Controller/SubscriberAttributeValueController.php b/src/Subscription/Controller/SubscriberAttributeValueController.php index 463a7569..86f7123a 100644 --- a/src/Subscription/Controller/SubscriberAttributeValueController.php +++ b/src/Subscription/Controller/SubscriberAttributeValueController.php @@ -11,7 +11,7 @@ use PhpList\Core\Domain\Subscription\Model\SubscriberAttributeDefinition; use PhpList\Core\Domain\Subscription\Model\SubscriberAttributeValue; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberAttributeManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Subscription/Controller/SubscriberController.php b/src/Subscription/Controller/SubscriberController.php index e1acbe88..8b894600 100644 --- a/src/Subscription/Controller/SubscriberController.php +++ b/src/Subscription/Controller/SubscriberController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; use PhpList\Core\Domain\Subscription\Model\Subscriber; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; diff --git a/src/Subscription/Controller/SubscriberExportController.php b/src/Subscription/Controller/SubscriberExportController.php index 223b7b32..f3f720ea 100644 --- a/src/Subscription/Controller/SubscriberExportController.php +++ b/src/Subscription/Controller/SubscriberExportController.php @@ -6,7 +6,7 @@ use OpenApi\Attributes as OA; use PhpList\Core\Domain\Subscription\Service\SubscriberCsvExporter; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Subscription\Request\SubscribersExportRequest; diff --git a/src/Subscription/Controller/SubscriberImportController.php b/src/Subscription/Controller/SubscriberImportController.php index 1e4983fc..7d248f82 100644 --- a/src/Subscription/Controller/SubscriberImportController.php +++ b/src/Subscription/Controller/SubscriberImportController.php @@ -10,7 +10,7 @@ use PhpList\Core\Domain\Subscription\Exception\CouldNotReadUploadedFileException; use PhpList\Core\Domain\Subscription\Model\Dto\SubscriberImportOptions; use PhpList\Core\Domain\Subscription\Service\SubscriberCsvImporter; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use Symfony\Component\HttpFoundation\File\UploadedFile; diff --git a/src/Subscription/Controller/SubscriberListController.php b/src/Subscription/Controller/SubscriberListController.php index 44b6e5cf..46366df2 100644 --- a/src/Subscription/Controller/SubscriberListController.php +++ b/src/Subscription/Controller/SubscriberListController.php @@ -10,7 +10,7 @@ use PhpList\Core\Domain\Messaging\Model\Filter\SubscriberListFilter; use PhpList\Core\Domain\Subscription\Model\SubscriberList; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberListManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/src/Subscription/Controller/SubscriptionController.php b/src/Subscription/Controller/SubscriptionController.php index b67db97d..f3cdc602 100644 --- a/src/Subscription/Controller/SubscriptionController.php +++ b/src/Subscription/Controller/SubscriptionController.php @@ -9,7 +9,7 @@ use PhpList\Core\Domain\Identity\Model\Administrator; use PhpList\Core\Domain\Subscription\Model\SubscriberList; use PhpList\Core\Domain\Subscription\Service\Manager\SubscriptionManager; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Controller\BaseController; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Subscription\Request\SubscriptionRequest; diff --git a/src/Subscription/Serializer/AttributeDefinitionNormalizer.php b/src/Subscription/Serializer/AttributeDefinitionNormalizer.php index 9753c0cf..bf2cf6ec 100644 --- a/src/Subscription/Serializer/AttributeDefinitionNormalizer.php +++ b/src/Subscription/Serializer/AttributeDefinitionNormalizer.php @@ -38,7 +38,7 @@ class AttributeDefinitionNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -69,7 +69,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -77,7 +77,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscribePageDataNormalizer.php b/src/Subscription/Serializer/SubscribePageDataNormalizer.php index adc1ab5e..9394105e 100644 --- a/src/Subscription/Serializer/SubscribePageDataNormalizer.php +++ b/src/Subscription/Serializer/SubscribePageDataNormalizer.php @@ -18,7 +18,7 @@ class SubscribePageDataNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -37,7 +37,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -45,7 +45,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscribePageNormalizer.php b/src/Subscription/Serializer/SubscribePageNormalizer.php index 1d355ff7..e3edf716 100644 --- a/src/Subscription/Serializer/SubscribePageNormalizer.php +++ b/src/Subscription/Serializer/SubscribePageNormalizer.php @@ -32,7 +32,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -52,7 +52,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -60,7 +60,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscribePagePublicNormalizer.php b/src/Subscription/Serializer/SubscribePagePublicNormalizer.php index c7777427..f48ff7bb 100644 --- a/src/Subscription/Serializer/SubscribePagePublicNormalizer.php +++ b/src/Subscription/Serializer/SubscribePagePublicNormalizer.php @@ -83,7 +83,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -152,7 +152,7 @@ private function getLists(array $ids): array } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -160,7 +160,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php b/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php index 0988213b..12519d5e 100644 --- a/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php +++ b/src/Subscription/Serializer/SubscriberAttributeValueNormalizer.php @@ -25,7 +25,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -41,7 +41,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -49,7 +49,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscriberHistoryNormalizer.php b/src/Subscription/Serializer/SubscriberHistoryNormalizer.php index 22abba1a..760207ca 100644 --- a/src/Subscription/Serializer/SubscriberHistoryNormalizer.php +++ b/src/Subscription/Serializer/SubscriberHistoryNormalizer.php @@ -28,7 +28,7 @@ class SubscriberHistoryNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -47,7 +47,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -55,7 +55,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscriberListNormalizer.php b/src/Subscription/Serializer/SubscriberListNormalizer.php index 34d7a28e..394d484f 100644 --- a/src/Subscription/Serializer/SubscriberListNormalizer.php +++ b/src/Subscription/Serializer/SubscriberListNormalizer.php @@ -31,7 +31,7 @@ class SubscriberListNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -53,7 +53,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -61,7 +61,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscriberNormalizer.php b/src/Subscription/Serializer/SubscriberNormalizer.php index 3cbdd69c..0909b643 100644 --- a/src/Subscription/Serializer/SubscriberNormalizer.php +++ b/src/Subscription/Serializer/SubscriberNormalizer.php @@ -4,6 +4,7 @@ namespace PhpList\RestBundle\Subscription\Serializer; +use DateTimeInterface; use OpenApi\Attributes as OA; use PhpList\Core\Domain\Subscription\Model\Subscriber; use PhpList\Core\Domain\Subscription\Model\SubscriberHistory; @@ -56,7 +57,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -67,8 +68,8 @@ public function normalize($object, string $format = null, array $context = []): return [ 'id' => $object->getId(), 'email' => $object->getEmail(), - 'created_at' => $object->getCreatedAt()?->format(\DateTimeInterface::ATOM), - 'updated_at' => $object->getUpdatedAt()?->format(\DateTimeInterface::ATOM), + 'created_at' => $object->getCreatedAt()->format(DateTimeInterface::ATOM), + 'updated_at' => $object->getUpdatedAt()->format(DateTimeInterface::ATOM), 'confirmed' => $object->isConfirmed(), 'blacklisted' => $object->isBlacklisted(), 'bounce_count' => $object->getBounceCount(), @@ -86,7 +87,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -94,7 +95,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscriberOnlyNormalizer.php b/src/Subscription/Serializer/SubscriberOnlyNormalizer.php index 4fb719ea..752384c8 100644 --- a/src/Subscription/Serializer/SubscriberOnlyNormalizer.php +++ b/src/Subscription/Serializer/SubscriberOnlyNormalizer.php @@ -31,7 +31,7 @@ class SubscriberOnlyNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -53,7 +53,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -61,7 +61,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php b/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php index 78fbab27..e3875e32 100644 --- a/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php +++ b/src/Subscription/Serializer/SubscribersExportRequestNormalizer.php @@ -10,7 +10,7 @@ class SubscribersExportRequestNormalizer implements NormalizerInterface { /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -28,7 +28,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -36,7 +36,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/SubscriptionNormalizer.php b/src/Subscription/Serializer/SubscriptionNormalizer.php index 98bae23b..b7ed3d01 100644 --- a/src/Subscription/Serializer/SubscriptionNormalizer.php +++ b/src/Subscription/Serializer/SubscriptionNormalizer.php @@ -37,7 +37,7 @@ public function __construct( } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -53,7 +53,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -61,7 +61,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/src/Subscription/Serializer/UserBlacklistNormalizer.php b/src/Subscription/Serializer/UserBlacklistNormalizer.php index bcd32857..14e839b1 100644 --- a/src/Subscription/Serializer/UserBlacklistNormalizer.php +++ b/src/Subscription/Serializer/UserBlacklistNormalizer.php @@ -15,7 +15,7 @@ public function __construct(private readonly SubscriberBlacklistManager $blackli } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function normalize($object, string $format = null, array $context = []): array { @@ -33,7 +33,7 @@ public function normalize($object, string $format = null, array $context = []): } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function supportsNormalization($data, string $format = null): bool { @@ -41,7 +41,7 @@ public function supportsNormalization($data, string $format = null): bool } /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function getSupportedTypes(?string $format): array { diff --git a/tests/Integration/Configuration/Controller/ConfigControllerTest.php b/tests/Integration/Configuration/Controller/ConfigControllerTest.php index 4fe00e72..55829098 100644 --- a/tests/Integration/Configuration/Controller/ConfigControllerTest.php +++ b/tests/Integration/Configuration/Controller/ConfigControllerTest.php @@ -44,7 +44,6 @@ public function testListWithValidSessionKeyReturnsOkayWithPaginationStructure(): $this->assertHttpOkay(); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('items', $response); self::assertArrayHasKey('pagination', $response); } diff --git a/tests/Integration/Identity/Controller/SessionControllerTest.php b/tests/Integration/Identity/Controller/SessionControllerTest.php index 89479e0f..42d58cbe 100644 --- a/tests/Integration/Identity/Controller/SessionControllerTest.php +++ b/tests/Integration/Identity/Controller/SessionControllerTest.php @@ -149,7 +149,7 @@ public function testPostSessionsActionWithValidCredentialsCreatesToken() $key = $responseContent['key']; $expiry = $responseContent['expiry_date']; - /** @var AdministratorToken $token */ + /** @var ?AdministratorToken $token */ $token = $this->administratorTokenRepository->find($tokenId); self::assertNotNull($token); diff --git a/tests/Integration/Messaging/Controller/BounceControllerTest.php b/tests/Integration/Messaging/Controller/BounceControllerTest.php index 62fd9632..680c6ad6 100644 --- a/tests/Integration/Messaging/Controller/BounceControllerTest.php +++ b/tests/Integration/Messaging/Controller/BounceControllerTest.php @@ -45,7 +45,6 @@ public function testListWithValidSessionKeyReturnsOkayWithPaginationStructure(): $this->assertHttpOkay(); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('items', $response); self::assertArrayHasKey('pagination', $response); self::assertIsArray($response['items']); diff --git a/tests/Integration/Messaging/Controller/BounceRegexControllerTest.php b/tests/Integration/Messaging/Controller/BounceRegexControllerTest.php index 61c8f61c..4860554f 100644 --- a/tests/Integration/Messaging/Controller/BounceRegexControllerTest.php +++ b/tests/Integration/Messaging/Controller/BounceRegexControllerTest.php @@ -69,7 +69,6 @@ public function testCreateGetDeleteFlow(): void $this->authenticatedJsonRequest('GET', '/api/v2/bounces/regex'); $this->assertHttpOkay(); $list = $this->getDecodedJsonResponseContent(); - $this->assertIsArray($list); $this->assertIsArray($list[0] ?? []); $this->authenticatedJsonRequest('DELETE', '/api/v2/bounces/regex/' . $id); diff --git a/tests/Integration/Messaging/Controller/CampaignControllerTest.php b/tests/Integration/Messaging/Controller/CampaignControllerTest.php index 6cfd8cfc..ea176e25 100644 --- a/tests/Integration/Messaging/Controller/CampaignControllerTest.php +++ b/tests/Integration/Messaging/Controller/CampaignControllerTest.php @@ -51,7 +51,6 @@ public function testGetCampaignsReturnsCampaignData(): void $this->authenticatedJsonRequest('GET', '/api/v2/campaigns'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('id', $response['items'][0]); self::assertArrayHasKey('message_content', $response['items'][0]); } diff --git a/tests/Integration/Messaging/Controller/EditorUploadControllerTest.php b/tests/Integration/Messaging/Controller/EditorUploadControllerTest.php index 94bdfd86..6bebb690 100644 --- a/tests/Integration/Messaging/Controller/EditorUploadControllerTest.php +++ b/tests/Integration/Messaging/Controller/EditorUploadControllerTest.php @@ -38,7 +38,6 @@ public function testListFilesReturnsCorrectStructure(): void $this->assertHttpOkay(); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('files', $response); self::assertArrayHasKey('directory', $response); self::assertArrayHasKey('total', $response); diff --git a/tests/Integration/Messaging/Controller/EmailForwardControllerTest.php b/tests/Integration/Messaging/Controller/EmailForwardControllerTest.php index e3f1ac51..920448e2 100644 --- a/tests/Integration/Messaging/Controller/EmailForwardControllerTest.php +++ b/tests/Integration/Messaging/Controller/EmailForwardControllerTest.php @@ -50,7 +50,6 @@ public function testForwardWithValidDataButNotReceivedEmail(): void self::assertStringContainsString('application/json', (string)$response->headers); $data = $this->getDecodedJsonResponseContent(); - self::assertIsArray($data); self::assertArrayHasKey('message', $data); self::assertStringContainsString('Cannot forward: user has not received this message', $data['message']); } diff --git a/tests/Integration/Messaging/Controller/TemplateControllerTest.php b/tests/Integration/Messaging/Controller/TemplateControllerTest.php index 69e6d401..81b6fe1c 100644 --- a/tests/Integration/Messaging/Controller/TemplateControllerTest.php +++ b/tests/Integration/Messaging/Controller/TemplateControllerTest.php @@ -52,7 +52,6 @@ public function testGetTemplatesReturnsTemplateData(): void $this->authenticatedJsonRequest('GET', '/api/v2/templates'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('id', $response['items'][0]); self::assertArrayHasKey('title', $response['items'][0]); } @@ -68,7 +67,6 @@ public function testCreateTemplateFromDefaultWithValidSessionKeyReturnsCreated() $this->authenticatedJsonRequest('GET', '/api/v2/templates/defaults'); $defaults = $this->getDecodedJsonResponseContent(); - self::assertIsArray($defaults); self::assertNotEmpty($defaults); self::assertArrayHasKey('key', $defaults[0]); diff --git a/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php b/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php index b0c05ebe..4530dea4 100644 --- a/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php +++ b/tests/Integration/Statistics/Controller/AnalyticsControllerTest.php @@ -54,7 +54,6 @@ public function testGetCampaignStatisticsReturnsCampaignData(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/campaigns'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('items', $response); self::assertArrayHasKey('pagination', $response); } @@ -80,7 +79,6 @@ public function testGetViewOpensStatisticsReturnsViewData(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/view-opens'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('items', $response); self::assertArrayHasKey('pagination', $response); self::assertIsArray($response['items']); @@ -108,7 +106,6 @@ public function testGetTopDomainsReturnsDomainsData(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/domains/top'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('domains', $response); self::assertArrayHasKey('total', $response); self::assertIsArray($response['domains']); @@ -122,7 +119,6 @@ public function testGetTopDomainsWithLimitParameter(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/domains/top?limit=5'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('domains', $response); self::assertIsArray($response['domains']); self::assertLessThanOrEqual(5, count($response['domains'])); @@ -135,7 +131,6 @@ public function testGetTopDomainsWithMinSubscribersParameter(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/domains/top?min_subscribers=10'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('domains', $response); self::assertIsArray($response['domains']); @@ -153,7 +148,6 @@ public function testGetTopDomainsWithBothParameters(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/domains/top?limit=3&min_subscribers=10'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('domains', $response); self::assertIsArray($response['domains']); self::assertLessThanOrEqual(3, count($response['domains'])); @@ -171,7 +165,6 @@ public function testGetTopDomainsWithInvalidLimitParameter(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/domains/top?limit=invalid'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('domains', $response); self::assertIsArray($response['domains']); } @@ -197,7 +190,6 @@ public function testGetDomainConfirmationStatisticsReturnsConfirmationData(): vo $this->authenticatedJsonRequest('GET', '/api/v2/analytics/domains/confirmation'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('domains', $response); self::assertArrayHasKey('total', $response); } @@ -223,7 +215,6 @@ public function testGetTopLocalPartsReturnsLocalPartsData(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/local-parts/top'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('local_parts', $response); self::assertArrayHasKey('total', $response); self::assertIsArray($response['local_parts']); @@ -237,7 +228,6 @@ public function testGetTopLocalPartsWithLimitParameter(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/local-parts/top?limit=5'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('local_parts', $response); self::assertIsArray($response['local_parts']); self::assertLessThanOrEqual(5, count($response['local_parts'])); @@ -250,7 +240,6 @@ public function testGetTopLocalPartsWithInvalidLimitParameter(): void $this->authenticatedJsonRequest('GET', '/api/v2/analytics/local-parts/top?limit=invalid'); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); self::assertArrayHasKey('local_parts', $response); self::assertIsArray($response['local_parts']); } @@ -274,8 +263,6 @@ public function testGetDashboardSummaryWithValidSessionReturnsCardsData(): void $this->assertHttpOkay(); $response = $this->getDecodedJsonResponseContent(); - self::assertIsArray($response); - foreach (['total_subscribers', 'active_campaigns', 'open_rate', 'bounce_rate'] as $metric) { self::assertIsArray($response[$metric]); self::assertArrayHasKey('value', $response[$metric]); @@ -303,8 +290,6 @@ public function testGetRecentCampaignsStatisticsWithValidSessionReturnsCampaigns $this->authenticatedJsonRequest('GET', '/api/v2/analytics/dashboard/recent-campaigns'); $this->assertHttpOkay(); $response = $this->getDecodedJsonResponseContent(); - - self::assertIsArray($response); } public function testGetCampaignPerformanceStatisticsWithoutSessionKeyReturnsUnauthorized(): void @@ -324,8 +309,6 @@ public function testGetCampaignPerformanceStatisticsWithValidSessionReturnsPerfo $this->authenticatedJsonRequest('GET', '/api/v2/analytics/dashboard/performance'); $this->assertHttpOkay(); - $response = $this->getDecodedJsonResponseContent(); - - self::assertIsArray($response); + $this->getDecodedJsonResponseContent(); } } diff --git a/tests/Unit/Common/Serializer/CursorPaginationNormalizerTest.php b/tests/Unit/Common/Serializer/CursorPaginationNormalizerTest.php index 61495c61..e2a5b2a1 100644 --- a/tests/Unit/Common/Serializer/CursorPaginationNormalizerTest.php +++ b/tests/Unit/Common/Serializer/CursorPaginationNormalizerTest.php @@ -22,7 +22,6 @@ public function testNormalizeWithItems(): void $result = $normalizer->normalize($paginationResult); - $this->assertIsArray($result); $this->assertEquals($items, $result['items']); $this->assertEquals([ 'total' => 10, diff --git a/tests/Unit/Common/Service/Provider/PaginatedDataProviderTest.php b/tests/Unit/Common/Service/Provider/PaginatedDataProviderTest.php index c2f065cf..6c11f434 100644 --- a/tests/Unit/Common/Service/Provider/PaginatedDataProviderTest.php +++ b/tests/Unit/Common/Service/Provider/PaginatedDataProviderTest.php @@ -61,7 +61,6 @@ className: 'Some\\Entity\\Class', filter: new PaginatedFilter(), ); - $this->assertIsArray($result); $this->assertArrayHasKey('items', $result); $this->assertArrayHasKey('pagination', $result); } diff --git a/tests/Unit/Configuration/Validator/Constraint/UniqueConfigKeyValidatorTest.php b/tests/Unit/Configuration/Validator/Constraint/UniqueConfigKeyValidatorTest.php index ae9cb6a3..15b5a986 100644 --- a/tests/Unit/Configuration/Validator/Constraint/UniqueConfigKeyValidatorTest.php +++ b/tests/Unit/Configuration/Validator/Constraint/UniqueConfigKeyValidatorTest.php @@ -31,8 +31,6 @@ public function testValidateSkipsNull(): void $this->entityManager->expects(self::never())->method('find'); $this->validator->validate(null, new UniqueConfigKey()); - - self::assertTrue(true); } public function testValidateSkipsEmptyString(): void @@ -40,8 +38,6 @@ public function testValidateSkipsEmptyString(): void $this->entityManager->expects(self::never())->method('find'); $this->validator->validate('', new UniqueConfigKey()); - - self::assertTrue(true); } public function testValidateThrowsUnexpectedTypeException(): void @@ -81,7 +77,5 @@ public function testValidatePassesIfConfigKeyIsUnique(): void ->willReturn(null); $this->validator->validate('new_config_key', new UniqueConfigKey()); - - self::assertTrue(true); } } diff --git a/tests/Unit/Identity/Serializer/AdminAttributeDefinitionNormalizerTest.php b/tests/Unit/Identity/Serializer/AdminAttributeDefinitionNormalizerTest.php index 8bc4396b..f7df8ce5 100644 --- a/tests/Unit/Identity/Serializer/AdminAttributeDefinitionNormalizerTest.php +++ b/tests/Unit/Identity/Serializer/AdminAttributeDefinitionNormalizerTest.php @@ -24,7 +24,6 @@ public function testNormalizeReturnsExpectedArray(): void $normalizer = new AdminAttributeDefinitionNormalizer(); $data = $normalizer->normalize($definition); - $this->assertIsArray($data); $this->assertEquals([ 'id' => 123, 'name' => 'test_attribute', @@ -40,7 +39,6 @@ public function testNormalizeWithInvalidObjectReturnsEmptyArray(): void $normalizer = new AdminAttributeDefinitionNormalizer(); $data = $normalizer->normalize(new \stdClass()); - $this->assertIsArray($data); $this->assertEmpty($data); } diff --git a/tests/Unit/Identity/Serializer/AdminAttributeValueNormalizerTest.php b/tests/Unit/Identity/Serializer/AdminAttributeValueNormalizerTest.php index 3299cd73..fcb371dc 100644 --- a/tests/Unit/Identity/Serializer/AdminAttributeValueNormalizerTest.php +++ b/tests/Unit/Identity/Serializer/AdminAttributeValueNormalizerTest.php @@ -54,7 +54,6 @@ public function testNormalizeReturnsExpectedArray(): void $data = $this->normalizer->normalize($attributeValue); - $this->assertIsArray($data); $this->assertEquals([ 'administrator' => ['id' => 1, 'login_name' => 'admin'], 'definition' => ['id' => 2, 'name' => 'test_attribute'], @@ -78,7 +77,6 @@ public function testNormalizeUsesDefaultValueWhenValueIsNull(): void $data = $this->normalizer->normalize($attributeValue); - $this->assertIsArray($data); $this->assertEquals([ 'administrator' => ['id' => 1, 'login_name' => 'admin'], 'definition' => ['id' => 2, 'name' => 'test_attribute'], @@ -90,7 +88,6 @@ public function testNormalizeWithInvalidObjectReturnsEmptyArray(): void { $data = $this->normalizer->normalize(new \stdClass()); - $this->assertIsArray($data); $this->assertEmpty($data); } diff --git a/tests/Unit/Identity/Serializer/AdministratorNormalizerTest.php b/tests/Unit/Identity/Serializer/AdministratorNormalizerTest.php index 68ee51c8..d9a51bd3 100644 --- a/tests/Unit/Identity/Serializer/AdministratorNormalizerTest.php +++ b/tests/Unit/Identity/Serializer/AdministratorNormalizerTest.php @@ -31,7 +31,6 @@ public function testNormalizeValidAdministrator(): void $normalizer = new AdministratorNormalizer(); $data = $normalizer->normalize($admin); - $this->assertIsArray($data); $this->assertEquals([ 'id' => 123, 'login_name' => 'admin', diff --git a/tests/Unit/Identity/Vallidator/Constraint/UniqueLoginNameValidatorTest.php b/tests/Unit/Identity/Vallidator/Constraint/UniqueLoginNameValidatorTest.php index f96c63f7..3fda8c73 100644 --- a/tests/Unit/Identity/Vallidator/Constraint/UniqueLoginNameValidatorTest.php +++ b/tests/Unit/Identity/Vallidator/Constraint/UniqueLoginNameValidatorTest.php @@ -27,8 +27,6 @@ public function testValidateWithUniqueLoginName(): void $constraint = new UniqueLoginName(); $validator->validate('new_login', $constraint); - - $this->assertTrue(true); } public function testValidateThrowsConflictForExistingLoginName(): void @@ -75,7 +73,5 @@ public function testValidateSkipsConflictIfSameAdministrator(): void $constraint = new UniqueLoginName(); $validator->validate('same_login', $constraint); - - $this->assertTrue(true); } } diff --git a/tests/Unit/Messaging/Controller/EditorUploadControllerTest.php b/tests/Unit/Messaging/Controller/EditorUploadControllerTest.php index 3987f3d7..5974ae97 100644 --- a/tests/Unit/Messaging/Controller/EditorUploadControllerTest.php +++ b/tests/Unit/Messaging/Controller/EditorUploadControllerTest.php @@ -8,7 +8,7 @@ use PhpList\Core\Domain\Common\Service\DirectoryListingService; use PhpList\Core\Domain\Common\Validator\UploadDirectoryValidator; use PhpList\Core\Domain\Identity\Model\Administrator; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\Core\Domain\Common\Model\UploadResult; use PhpList\Core\Domain\Common\Service\UploadService; use PhpList\RestBundle\Common\Validator\RequestValidator; diff --git a/tests/Unit/Messaging/Request/CreateBounceRegexRequestTest.php b/tests/Unit/Messaging/Request/CreateBounceRegexRequestTest.php index 5e2d213c..a7047f45 100644 --- a/tests/Unit/Messaging/Request/CreateBounceRegexRequestTest.php +++ b/tests/Unit/Messaging/Request/CreateBounceRegexRequestTest.php @@ -54,9 +54,6 @@ public function testValidateRegexPatternWithValidRegexDoesNotAddViolation(): voi $context->expects($this->never())->method('buildViolation'); $req->validateRegexPattern($context); - - // if no exception and no violation calls, the test passes - $this->assertTrue(true); } public function testValidateRegexPatternWithInvalidRegexAddsViolation(): void diff --git a/tests/Unit/Messaging/Request/ForwardMessageRequestTest.php b/tests/Unit/Messaging/Request/ForwardMessageRequestTest.php index aeb66366..81e547bb 100644 --- a/tests/Unit/Messaging/Request/ForwardMessageRequestTest.php +++ b/tests/Unit/Messaging/Request/ForwardMessageRequestTest.php @@ -21,7 +21,6 @@ public function testGetDtoReturnsCorrectArray(): void $dto = $request->getDto(); - $this->assertIsArray($dto); $this->assertSame(['friend1@example.com', 'friend2@example.com'], $dto['recipients']); $this->assertSame('fwd-123e4567-e89b-12d3-a456-426614174000', $dto['uid']); $this->assertSame('Thought you might like this.', $dto['note']); @@ -41,7 +40,6 @@ public function testGetDtoHandlesNullables(): void $dto = $request->getDto(); - $this->assertIsArray($dto); $this->assertSame(['friend@example.com'], $dto['recipients']); $this->assertSame('fwd-uid-1', $dto['uid']); $this->assertNull($dto['note']); diff --git a/tests/Unit/Messaging/Serializer/ForwardingResultNormalizerTest.php b/tests/Unit/Messaging/Serializer/ForwardingResultNormalizerTest.php index 45e65527..e452487a 100644 --- a/tests/Unit/Messaging/Serializer/ForwardingResultNormalizerTest.php +++ b/tests/Unit/Messaging/Serializer/ForwardingResultNormalizerTest.php @@ -48,7 +48,6 @@ public function testNormalizeMapsAllTopLevelCounts(): void $data = $this->normalizer->normalize($result); - $this->assertIsArray($data); $this->assertSame(5, $data['total_requested']); $this->assertSame(3, $data['total_sent']); $this->assertSame(1, $data['total_failed']); diff --git a/tests/Unit/Messaging/Serializer/TemplateImageNormalizerTest.php b/tests/Unit/Messaging/Serializer/TemplateImageNormalizerTest.php index 7db54275..8e507cf5 100644 --- a/tests/Unit/Messaging/Serializer/TemplateImageNormalizerTest.php +++ b/tests/Unit/Messaging/Serializer/TemplateImageNormalizerTest.php @@ -40,7 +40,6 @@ public function testNormalizeTemplateImage(): void $normalized = $this->normalizer->normalize($templateImage); - $this->assertIsArray($normalized); $this->assertEquals([ 'id' => 10, 'template_id' => 42, @@ -56,7 +55,6 @@ public function testNormalizeReturnsEmptyArrayForInvalidObject(): void { $normalized = $this->normalizer->normalize(new \stdClass()); - $this->assertIsArray($normalized); $this->assertEmpty($normalized); } } diff --git a/tests/Unit/Messaging/Serializer/TemplateNormalizerTest.php b/tests/Unit/Messaging/Serializer/TemplateNormalizerTest.php index acb70cff..cc46bf3b 100644 --- a/tests/Unit/Messaging/Serializer/TemplateNormalizerTest.php +++ b/tests/Unit/Messaging/Serializer/TemplateNormalizerTest.php @@ -52,7 +52,6 @@ public function testNormalizeTemplateWithImages(): void $normalized = $this->normalizer->normalize($template); - $this->assertIsArray($normalized); $this->assertEquals([ 'id' => 1, 'title' => 'Test Template', @@ -81,7 +80,6 @@ public function testNormalizeTemplateWithoutImages(): void $normalized = $this->normalizer->normalize($template); - $this->assertIsArray($normalized); $this->assertEquals([ 'id' => 2, 'title' => 'Empty Template', @@ -96,7 +94,6 @@ public function testNormalizeReturnsEmptyArrayForInvalidObject(): void { $normalized = $this->normalizer->normalize(new \stdClass()); - $this->assertIsArray($normalized); $this->assertEmpty($normalized); } } diff --git a/tests/Unit/Messaging/Validator/Constraint/ContainsPlaceholderValidatorTest.php b/tests/Unit/Messaging/Validator/Constraint/ContainsPlaceholderValidatorTest.php index bdd2105f..d0c24f01 100644 --- a/tests/Unit/Messaging/Validator/Constraint/ContainsPlaceholderValidatorTest.php +++ b/tests/Unit/Messaging/Validator/Constraint/ContainsPlaceholderValidatorTest.php @@ -22,8 +22,6 @@ public function testValidateWithValidPlaceholder(): void $constraint = new ContainsPlaceholder(['placeholder' => '[CONTENT]']); $validator->validate('[CONTENT]', $constraint); - - $this->assertTrue(true); } public function testValidateWithMissingPlaceholder(): void diff --git a/tests/Unit/Messaging/Validator/Constraint/MaxForwardCountValidatorTest.php b/tests/Unit/Messaging/Validator/Constraint/MaxForwardCountValidatorTest.php index 3360749d..3729e54b 100644 --- a/tests/Unit/Messaging/Validator/Constraint/MaxForwardCountValidatorTest.php +++ b/tests/Unit/Messaging/Validator/Constraint/MaxForwardCountValidatorTest.php @@ -22,8 +22,6 @@ public function testSkipsWhenValueIsNotArray(): void $constraint = new MaxForwardCount(); $validator->validate('not-an-array', $constraint); - - $this->assertTrue(true); } public function testTriggersViolationWhenUniqueCountExceedsLimit(): void @@ -73,6 +71,5 @@ public function testNoViolationWhenWithinLimit(): void $emails = ['a@example.com', 'b@example.com', 'a@example.com']; $validator->validate($emails, $constraint); - $this->assertTrue(true); } } diff --git a/tests/Unit/Messaging/Validator/Constraint/MaxPersonalNoteSizeValidatorTest.php b/tests/Unit/Messaging/Validator/Constraint/MaxPersonalNoteSizeValidatorTest.php index dc38dcf1..594c7293 100644 --- a/tests/Unit/Messaging/Validator/Constraint/MaxPersonalNoteSizeValidatorTest.php +++ b/tests/Unit/Messaging/Validator/Constraint/MaxPersonalNoteSizeValidatorTest.php @@ -23,8 +23,6 @@ public function testSkipsWhenValueIsNullOrEmpty(): void $constraint = new MaxPersonalNoteSize(); $validator->validate(null, $constraint); $validator->validate('', $constraint); - - $this->assertTrue(true); } public function testSkipsWhenMaxSizeIsNullOrNegative(): void @@ -39,8 +37,6 @@ public function testSkipsWhenMaxSizeIsNullOrNegative(): void $validatorNeg = new MaxPersonalNoteSizeValidator(-1); $validatorNeg->initialize($context); $validatorNeg->validate('anything', new MaxPersonalNoteSize()); - - $this->assertTrue(true); } public function testNoViolationWhenWithinOrAtLimit(): void @@ -59,8 +55,6 @@ public function testNoViolationWhenWithinOrAtLimit(): void // below limit $short = str_repeat('b', 5); $validator->validate($short, $constraint); - - $this->assertTrue(true); } public function testViolationWhenExceedsLimit(): void diff --git a/tests/Unit/Messaging/Validator/Constraint/TemplateExistsValidatorTest.php b/tests/Unit/Messaging/Validator/Constraint/TemplateExistsValidatorTest.php index 8d6ca8f0..b3bc52de 100644 --- a/tests/Unit/Messaging/Validator/Constraint/TemplateExistsValidatorTest.php +++ b/tests/Unit/Messaging/Validator/Constraint/TemplateExistsValidatorTest.php @@ -34,14 +34,12 @@ public function testValidateSkipsNull(): void { $this->templateRepository->expects($this->never())->method('find'); $this->validator->validate(null, new TemplateExists()); - $this->assertTrue(true); } public function testValidateSkipsEmptyString(): void { $this->templateRepository->expects($this->never())->method('find'); $this->validator->validate('', new TemplateExists()); - $this->assertTrue(true); } public function testValidateThrowsUnexpectedTypeException(): void @@ -81,6 +79,5 @@ public function testValidatePassesIfTemplateExists(): void ->willReturn($template); $this->validator->validate(1, new TemplateExists()); - $this->assertTrue(true); } } diff --git a/tests/Unit/Messaging/Validator/Constraint/UniqueTemplateTitleValidatorTest.php b/tests/Unit/Messaging/Validator/Constraint/UniqueTemplateTitleValidatorTest.php index 5c29ebbd..e82d1cc4 100644 --- a/tests/Unit/Messaging/Validator/Constraint/UniqueTemplateTitleValidatorTest.php +++ b/tests/Unit/Messaging/Validator/Constraint/UniqueTemplateTitleValidatorTest.php @@ -35,14 +35,12 @@ public function testValidateSkipsNull(): void { $this->templateRepository->expects($this->never())->method('findOneBy'); $this->validator->validate(null, new UniqueTemplateTitle()); - $this->assertTrue(true); } public function testValidateSkipsEmptyString(): void { $this->templateRepository->expects($this->never())->method('findOneBy'); $this->validator->validate('', new UniqueTemplateTitle()); - $this->assertTrue(true); } public function testValidateThrowsUnexpectedTypeException(): void @@ -82,7 +80,6 @@ public function testValidatePassesIfTemplateTitleIsUnique(): void ->willReturn(null); $this->validator->validate('Unique Template', new UniqueTemplateTitle()); - $this->assertTrue(true); } public function testValidateSkipsConflictForSameTemplateOnUpdate(): void @@ -104,6 +101,5 @@ public function testValidateSkipsConflictForSameTemplateOnUpdate(): void ->willReturn($dto); $this->validator->validate('Existing Title', new UniqueTemplateTitle()); - $this->assertTrue(true); } } diff --git a/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php b/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php index 401da045..332189c4 100644 --- a/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php +++ b/tests/Unit/Statistics/Controller/AnalyticsControllerTest.php @@ -8,7 +8,7 @@ use PhpList\Core\Domain\Identity\Model\Administrator; use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; use PhpList\Core\Domain\Identity\Model\Privileges; -use PhpList\Core\Security\Authentication; +use PhpList\Core\Domain\Identity\Service\Authentication; use PhpList\RestBundle\Common\Validator\RequestValidator; use PhpList\RestBundle\Statistics\Controller\AnalyticsController; use PhpList\RestBundle\Statistics\Serializer\CampaignStatisticsNormalizer; diff --git a/tests/Unit/Statistics/Serializer/TopDomainsNormalizerTest.php b/tests/Unit/Statistics/Serializer/TopDomainsNormalizerTest.php index 486e27b7..9fcab1ed 100644 --- a/tests/Unit/Statistics/Serializer/TopDomainsNormalizerTest.php +++ b/tests/Unit/Statistics/Serializer/TopDomainsNormalizerTest.php @@ -22,7 +22,6 @@ public function testNormalizeWithValidData(): void $normalizer = new TopDomainsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('domains', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(150, $result['total']); @@ -46,7 +45,6 @@ public function testNormalizeWithMissingFields(): void $normalizer = new TopDomainsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('domains', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(0, $result['total']); @@ -69,7 +67,6 @@ public function testNormalizeWithEmptyDomains(): void $normalizer = new TopDomainsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('domains', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(0, $result['total']); @@ -85,7 +82,6 @@ public function testNormalizeWithNoDomains(): void $normalizer = new TopDomainsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('domains', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(100, $result['total']); @@ -97,7 +93,6 @@ public function testNormalizeWithInvalidObject(): void $normalizer = new TopDomainsNormalizer(); $result = $normalizer->normalize('not an array'); - $this->assertIsArray($result); $this->assertEmpty($result); } diff --git a/tests/Unit/Statistics/Serializer/TopLocalPartsNormalizerTest.php b/tests/Unit/Statistics/Serializer/TopLocalPartsNormalizerTest.php index a08f80fd..1f9a743f 100644 --- a/tests/Unit/Statistics/Serializer/TopLocalPartsNormalizerTest.php +++ b/tests/Unit/Statistics/Serializer/TopLocalPartsNormalizerTest.php @@ -22,7 +22,6 @@ public function testNormalizeWithValidData(): void $normalizer = new TopLocalPartsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('local_parts', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(250, $result['total']); @@ -49,7 +48,6 @@ public function testNormalizeWithMissingFields(): void $normalizer = new TopLocalPartsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('local_parts', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(0, $result['total']); @@ -78,7 +76,6 @@ public function testNormalizeWithEmptyLocalParts(): void $normalizer = new TopLocalPartsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('local_parts', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(0, $result['total']); @@ -94,7 +91,6 @@ public function testNormalizeWithNoLocalParts(): void $normalizer = new TopLocalPartsNormalizer(); $result = $normalizer->normalize($data); - $this->assertIsArray($result); $this->assertArrayHasKey('local_parts', $result); $this->assertArrayHasKey('total', $result); $this->assertEquals(100, $result['total']); @@ -106,7 +102,6 @@ public function testNormalizeWithInvalidObject(): void $normalizer = new TopLocalPartsNormalizer(); $result = $normalizer->normalize('not an array'); - $this->assertIsArray($result); $this->assertEmpty($result); } diff --git a/tests/Unit/Subscription/Request/SubscriberAttributeDefinitionRequestTest.php b/tests/Unit/Subscription/Request/SubscriberAttributeDefinitionRequestTest.php index d96c0585..e5f6b226 100644 --- a/tests/Unit/Subscription/Request/SubscriberAttributeDefinitionRequestTest.php +++ b/tests/Unit/Subscription/Request/SubscriberAttributeDefinitionRequestTest.php @@ -31,7 +31,6 @@ public function testGetDtoReturnsCorrectDto(): void $this->assertEquals(5, $dto->listOrder); $this->assertEquals('default', $dto->defaultValue); $this->assertTrue($dto->required); - $this->assertIsArray($dto->options); } public function testGetDtoWithDefaultValues(): void @@ -47,7 +46,6 @@ public function testGetDtoWithDefaultValues(): void $this->assertNull($dto->listOrder); $this->assertNull($dto->defaultValue); $this->assertFalse($dto->required); - $this->assertIsArray($dto->options); $this->assertSame([], $dto->options); } diff --git a/tests/Unit/Subscription/Serializer/AttributeDefinitionNormalizerTest.php b/tests/Unit/Subscription/Serializer/AttributeDefinitionNormalizerTest.php index 3821a8f0..fd56f35b 100644 --- a/tests/Unit/Subscription/Serializer/AttributeDefinitionNormalizerTest.php +++ b/tests/Unit/Subscription/Serializer/AttributeDefinitionNormalizerTest.php @@ -36,7 +36,6 @@ public function testNormalize(): void $normalizer = new AttributeDefinitionNormalizer(); $result = $normalizer->normalize($definition); - self::assertIsArray($result); self::assertSame([ 'id' => 1, 'name' => 'Country', @@ -83,8 +82,6 @@ public function testNormalizeWithOptions(): void $normalizer = new AttributeDefinitionNormalizer(); $result = $normalizer->normalize($definition); - self::assertIsArray($result); - self::assertSame([ 'id' => 5, 'name' => 'Country', diff --git a/tests/Unit/Subscription/Serializer/SubscriberNormalizerTest.php b/tests/Unit/Subscription/Serializer/SubscriberNormalizerTest.php index 11bcd0d3..ebb1bbc2 100644 --- a/tests/Unit/Subscription/Serializer/SubscriberNormalizerTest.php +++ b/tests/Unit/Subscription/Serializer/SubscriberNormalizerTest.php @@ -43,6 +43,7 @@ public function testNormalize(): void $subscriber->method('getId')->willReturn(101); $subscriber->method('getEmail')->willReturn('test@example.com'); $subscriber->method('getCreatedAt')->willReturn(new DateTime('2024-12-31T12:00:00+00:00')); + $subscriber->method('getUpdatedAt')->willReturn(new DateTime('2024-12-31T12:00:00+00:00')); $subscriber->method('isConfirmed')->willReturn(true); $subscriber->method('isBlacklisted')->willReturn(false); $subscriber->method('getBounceCount')->willReturn(0); @@ -58,7 +59,7 @@ public function testNormalize(): void 'id' => 101, 'email' => 'test@example.com', 'created_at' => '2024-12-31T12:00:00+00:00', - 'updated_at' => null, + 'updated_at' => '2024-12-31T12:00:00+00:00', 'confirmed' => true, 'blacklisted' => false, 'bounce_count' => 0, diff --git a/tests/Unit/Subscription/Validator/Constraint/EmailExistsValidatorTest.php b/tests/Unit/Subscription/Validator/Constraint/EmailExistsValidatorTest.php index 9dccd7b2..6ec816af 100644 --- a/tests/Unit/Subscription/Validator/Constraint/EmailExistsValidatorTest.php +++ b/tests/Unit/Subscription/Validator/Constraint/EmailExistsValidatorTest.php @@ -34,14 +34,12 @@ public function testValidateSkipsNull(): void { $this->subscriberRepository->expects($this->never())->method('findOneBy'); $this->validator->validate(null, new EmailExists()); - $this->assertTrue(true); } public function testValidateSkipsEmptyString(): void { $this->subscriberRepository->expects($this->never())->method('findOneBy'); $this->validator->validate('', new EmailExists()); - $this->assertTrue(true); } public function testValidateThrowsUnexpectedTypeException(): void @@ -81,6 +79,5 @@ public function testValidatePassesIfEmailExists(): void ->willReturn($subscriber); $this->validator->validate('found@example.com', new EmailExists()); - $this->assertTrue(true); } } diff --git a/tests/Unit/Subscription/Validator/Constraint/ListExistsPublicValidatorTest.php b/tests/Unit/Subscription/Validator/Constraint/ListExistsPublicValidatorTest.php index 3c0c6652..4814d153 100644 --- a/tests/Unit/Subscription/Validator/Constraint/ListExistsPublicValidatorTest.php +++ b/tests/Unit/Subscription/Validator/Constraint/ListExistsPublicValidatorTest.php @@ -33,14 +33,12 @@ public function testValidateSkipsNull(): void { $this->subscriberListRepository->expects($this->never())->method('findBy'); $this->validator->validate(null, new ListExistsPublic()); - $this->assertTrue(true); } public function testValidateSkipsEmptyString(): void { $this->subscriberListRepository->expects($this->never())->method('findBy'); $this->validator->validate('', new ListExistsPublic()); - $this->assertTrue(true); } public function testValidateThrowsUnexpectedTypeException(): void @@ -74,6 +72,5 @@ public function testValidatePassesIfPublicListExists(): void ->willReturn([$subscriberList]); $this->validator->validate('123', new ListExistsPublic()); - $this->assertTrue(true); } } diff --git a/tests/Unit/Subscription/Validator/Constraint/ListExistsValidatorTest.php b/tests/Unit/Subscription/Validator/Constraint/ListExistsValidatorTest.php index f8c42a77..febaf39b 100644 --- a/tests/Unit/Subscription/Validator/Constraint/ListExistsValidatorTest.php +++ b/tests/Unit/Subscription/Validator/Constraint/ListExistsValidatorTest.php @@ -34,14 +34,12 @@ public function testValidateSkipsNull(): void { $this->subscriberListRepository->expects($this->never())->method('find'); $this->validator->validate(null, new ListExists()); - $this->assertTrue(true); } public function testValidateSkipsEmptyString(): void { $this->subscriberListRepository->expects($this->never())->method('find'); $this->validator->validate('', new ListExists()); - $this->assertTrue(true); } public function testValidateThrowsUnexpectedTypeException(): void @@ -75,6 +73,5 @@ public function testValidatePassesIfListExists(): void ->willReturn($subscriberList); $this->validator->validate('123', new ListExists()); - $this->assertTrue(true); } } diff --git a/tests/Unit/Subscription/Validator/Constraint/ValidPublicSubscriptionValidatorTest.php b/tests/Unit/Subscription/Validator/Constraint/ValidPublicSubscriptionValidatorTest.php index 57a9b619..8e40a3c5 100644 --- a/tests/Unit/Subscription/Validator/Constraint/ValidPublicSubscriptionValidatorTest.php +++ b/tests/Unit/Subscription/Validator/Constraint/ValidPublicSubscriptionValidatorTest.php @@ -40,7 +40,6 @@ public function testSkipsWhenSubscribePageIsMissing(): void $this->context->expects($this->never())->method('buildViolation'); $this->validator->validate($request, new ValidPublicSubscription()); - $this->assertTrue(true); } public function testAddsViolationsForUnknownAndRequiredAttributes(): void diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8a148f7f..ec555589 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,6 +6,4 @@ require dirname(__DIR__) . '/vendor/autoload.php'; -if (method_exists(Dotenv::class, 'bootEnv')) { - (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); -} +(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');