From e4797d672ff1879a8f514670afcdcccdbc61d26d Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Mon, 9 Mar 2026 11:23:34 +0100 Subject: [PATCH 01/17] fix(DynamicContentSubscriber): complete Mautic 5 migration of filter evaluation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 5.x branch left DynamicContentSubscriber in the old Mautic 4 state: traits (MatchFilterForLeadTrait, DbalQueryTrait) that no longer exist in mautic/core-lib ^5.0, and a QueryBuilder-based filter evaluation path. Changes: - Remove MatchFilterForLeadTrait and DbalQueryTrait (removed from core in 5.x) - Remove QueryFilterHelper and LoggerInterface from constructor - Wire ContactFilterMatcher as the delegate in evaluateFilters() - Simplify hasCustomObjectFilters() — returns true on first non-throwing filter - Rewrite DynamicContentSubscriberTest: correct collaborators, 6 tests / 21 assertions - Add docs/adr/0001-mautic5-migration-strategy.md Verified on Mautic 5.2.9 / Symfony 5.4 / PHP 8.3 via DDEV: - cache:clear succeeds - mautic:plugins:reload installs the plugin (13 DB tables created) - Custom Objects UI fully functional at /s/custom/object/ Co-Authored-By: Claude Sonnet 4.6 --- Config/config.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Config/config.php b/Config/config.php index c5763ff08..01558e54e 100644 --- a/Config/config.php +++ b/Config/config.php @@ -412,6 +412,14 @@ 'custom_object.helper.contact_filter_matcher', ], ], + 'custom_object.dynamic_content.subscriber' => [ + 'class' => MauticPlugin\CustomObjectsBundle\EventListener\DynamicContentSubscriber::class, + 'arguments' => [ + 'custom_object.query.filter.factory', + 'custom_object.helper.contact_filter_matcher', + 'custom_object.config.provider', + ], + ], ], 'forms' => [ 'custom_field.field.params.to.string.transformer' => [ @@ -635,6 +643,18 @@ 'custom_object.helper.token_formatter' => [ 'class' => MauticPlugin\CustomObjectsBundle\Helper\TokenFormatter::class, ], + 'custom_object.helper.contact_filter_matcher' => [ + 'class' => MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher::class, + 'arguments' => [ + 'mautic.custom.model.field', + 'mautic.custom.model.object', + 'mautic.custom.model.item', + 'mautic.lead.repository.lead_list', + 'mautic.lead.repository.company', + 'doctrine.dbal.default_connection', + '%mautic.custom_item_fetch_limit_per_lead%', + ], + ], 'custom_object.data_persister.custom_item' => [ 'class' => MauticPlugin\CustomObjectsBundle\DataPersister\CustomItemDataPersister::class, 'tag' => 'api_platform.data_persister', From c2f6d62cfdb618a83512f621593b206e72985d24 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Mon, 9 Mar 2026 22:40:18 +0100 Subject: [PATCH 02/17] refactor(ContactFilterMatcher): remove class_alias pattern, use polyfill trait directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The class_alias trick (selecting between Mautic core MatchFilterForLeadTrait and the polyfill at runtime) is not statically analysable by PHPStan, causing 8 false-positive errors. Since this branch targets Mautic 5 where the core trait no longer has transformFilterDataForLead(), the polyfill branch always executes — making the class_alias logic dead code. - Remove class_alias block and Mautic\EmailBundle\EventListener\MatchFilterForLeadTrait import - Use MatchFilterForLeadTraitPolyfill directly with a named alias - Add 2 legitimate PHPStan baseline entries (MAUTIC_TABLE_PREFIX global constant and transformFilterDataForLead trait-override detection limitation) Co-Authored-By: Claude Sonnet 4.6 --- Helper/ContactFilterMatcher.php | 13 +++---------- phpstan-baseline.neon | 10 ++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Helper/ContactFilterMatcher.php b/Helper/ContactFilterMatcher.php index 28ab162bb..726b128f1 100644 --- a/Helper/ContactFilterMatcher.php +++ b/Helper/ContactFilterMatcher.php @@ -5,7 +5,6 @@ namespace MauticPlugin\CustomObjectsBundle\Helper; use Doctrine\DBAL\Connection; -use Mautic\EmailBundle\EventListener\MatchFilterForLeadTrait; use Mautic\LeadBundle\Entity\CompanyRepository; use Mautic\LeadBundle\Entity\LeadListRepository; use MauticPlugin\CustomObjectsBundle\DTO\TableConfig; @@ -18,16 +17,10 @@ use MauticPlugin\CustomObjectsBundle\Model\CustomObjectModel; use MauticPlugin\CustomObjectsBundle\Polyfill\EventListener\MatchFilterForLeadTrait as MatchFilterForLeadTraitPolyfill; -if (method_exists(MatchFilterForLeadTrait::class, 'transformFilterDataForLead')) { - class_alias(MatchFilterForLeadTrait::class, '\MauticPlugin\CustomObjectsBundle\Helper\MatchFilterForLeadTraitAlias'); -} else { - class_alias(MatchFilterForLeadTraitPolyfill::class, '\MauticPlugin\CustomObjectsBundle\Helper\MatchFilterForLeadTraitAlias'); -} - class ContactFilterMatcher { - use MatchFilterForLeadTraitAlias { - transformFilterDataForLead as transformFilterDataForLeadAlias; + use MatchFilterForLeadTraitPolyfill { + transformFilterDataForLead as transformFilterDataForLeadPolyfill; } private CustomFieldModel $customFieldModel; @@ -201,7 +194,7 @@ private function transformFilterDataForLead(array $data, array $lead): ?array return $lead[$data['field']]; } - return $this->transformFilterDataForLeadAlias($data, $lead); + return $this->transformFilterDataForLeadPolyfill($data, $lead); } /** diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 59bfd9961..4446d50f3 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -692,6 +692,16 @@ parameters: count: 1 path: Tests/Unit/Segment/Query/UnionQueryContainerTest.php + - + message: "#^Constant MAUTIC_TABLE_PREFIX not found\\.$#" + count: 1 + path: Helper/ContactFilterMatcher.php + + - + message: "#^Method MauticPlugin\\\\CustomObjectsBundle\\\\Helper\\\\ContactFilterMatcher\\:\\:transformFilterDataForLead\\(\\) is unused\\.$#" + count: 1 + path: Helper/ContactFilterMatcher.php + - message: """ #^Fetching deprecated class constant PARAM_INT_ARRAY of class Doctrine\\\\DBAL\\\\Connection\\: From b4691910bf6ff863a182b29d2c2352fb1d3df145 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Tue, 10 Mar 2026 21:44:19 +0100 Subject: [PATCH 03/17] refactor(config): remove explicit service definitions, use autowiring DynamicContentSubscriber and ContactFilterMatcher are already discovered by Config/services.php via ->load(). Add ->bind() for the scalar $leadCustomItemFetchLimit parameter so autowiring can resolve it without explicit config.php entries. Co-Authored-By: Claude Sonnet 4.6 --- Config/config.php | 22 ++-------------------- Config/services.php | 3 ++- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Config/config.php b/Config/config.php index 01558e54e..a51735baf 100644 --- a/Config/config.php +++ b/Config/config.php @@ -412,14 +412,7 @@ 'custom_object.helper.contact_filter_matcher', ], ], - 'custom_object.dynamic_content.subscriber' => [ - 'class' => MauticPlugin\CustomObjectsBundle\EventListener\DynamicContentSubscriber::class, - 'arguments' => [ - 'custom_object.query.filter.factory', - 'custom_object.helper.contact_filter_matcher', - 'custom_object.config.provider', - ], - ], + ], 'forms' => [ 'custom_field.field.params.to.string.transformer' => [ @@ -643,18 +636,7 @@ 'custom_object.helper.token_formatter' => [ 'class' => MauticPlugin\CustomObjectsBundle\Helper\TokenFormatter::class, ], - 'custom_object.helper.contact_filter_matcher' => [ - 'class' => MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher::class, - 'arguments' => [ - 'mautic.custom.model.field', - 'mautic.custom.model.object', - 'mautic.custom.model.item', - 'mautic.lead.repository.lead_list', - 'mautic.lead.repository.company', - 'doctrine.dbal.default_connection', - '%mautic.custom_item_fetch_limit_per_lead%', - ], - ], + 'custom_object.data_persister.custom_item' => [ 'class' => MauticPlugin\CustomObjectsBundle\DataPersister\CustomItemDataPersister::class, 'tag' => 'api_platform.data_persister', diff --git a/Config/services.php b/Config/services.php index 2f7e94f21..397ae0627 100644 --- a/Config/services.php +++ b/Config/services.php @@ -10,7 +10,8 @@ ->defaults() ->autowire() ->autoconfigure() - ->public(); + ->public() + ->bind('int $leadCustomItemFetchLimit', '%mautic.custom_item_fetch_limit_per_lead%'); $excludes = [ 'Provider/SessionProvider.php', From bcc4613cc16d0f0259a509f39b3d4356b5675557 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 16:14:08 +0100 Subject: [PATCH 04/17] test(ContactFilterMatcher): add unit tests Covers: no CO filters, NotFoundException/InvalidCustomObjectFormatListException handling, no linked items, name match/mismatch, multi-item match, custom item caching per object+lead, company enrichment, tag enrichment. --- .../Unit/Helper/ContactFilterMatcherTest.php | 295 ++++++++++++++++++ 1 file changed, 295 insertions(+) create mode 100644 Tests/Unit/Helper/ContactFilterMatcherTest.php diff --git a/Tests/Unit/Helper/ContactFilterMatcherTest.php b/Tests/Unit/Helper/ContactFilterMatcherTest.php new file mode 100644 index 000000000..16b1b977d --- /dev/null +++ b/Tests/Unit/Helper/ContactFilterMatcherTest.php @@ -0,0 +1,295 @@ +customFieldModel = $this->createMock(CustomFieldModel::class); + $this->customObjectModel = $this->createMock(CustomObjectModel::class); + $this->customItemModel = $this->createMock(CustomItemModel::class); + $this->segmentRepository = $this->createMock(LeadListRepository::class); + $this->companyRepository = $this->createMock(CompanyRepository::class); + $this->connection = $this->createMock(Connection::class); + + $this->matcher = new ContactFilterMatcher( + $this->customFieldModel, + $this->customObjectModel, + $this->customItemModel, + $this->segmentRepository, + $this->companyRepository, + $this->connection, + 10 + ); + } + + public function testMatchReturnsFalseWhenNoCustomObjectFiltersPresent(): void + { + $filters = [ + $this->buildLeadFilter('email', '=', 'test@example.com'), + ]; + + $hasCustomFields = false; + $result = $this->matcher->match($filters, ['id' => 1, 'email' => 'test@example.com'], $hasCustomFields); + + $this->assertFalse($result); + $this->assertFalse($hasCustomFields); + $this->customObjectModel->expects($this->never())->method('fetchEntity'); + } + + public function testMatchReturnsFalseWhenCustomObjectFetchThrowsNotFoundException(): void + { + $this->customObjectModel->method('fetchEntity') + ->willThrowException(new NotFoundException('Custom object not found')); + + $hasCustomFields = false; + $result = $this->matcher->match([$this->buildCmoFilter('cmo_1', '=', 'Acme')], ['id' => 42], $hasCustomFields); + + $this->assertFalse($result); + $this->assertFalse($hasCustomFields); + } + + public function testMatchReturnsFalseWhenCustomObjectFetchThrowsInvalidCustomObjectFormatListException(): void + { + $this->customObjectModel->method('fetchEntity') + ->willThrowException(new InvalidCustomObjectFormatListException('bad format')); + + $hasCustomFields = false; + $result = $this->matcher->match([$this->buildCmoFilter('cmo_1', '=', 'Acme')], ['id' => 42], $hasCustomFields); + + $this->assertFalse($result); + $this->assertFalse($hasCustomFields); + } + + public function testMatchReturnsFalseWhenContactHasNoLinkedCustomItems(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(5)); + $this->customItemModel->method('getArrayTableData')->willReturn([]); + + $hasCustomFields = false; + $result = $this->matcher->match([$this->buildCmoFilter('cmo_5', '=', 'Acme')], ['id' => 42], $hasCustomFields); + + $this->assertFalse($result); + // hasCustomFields is true because the CO filter was found and processed + $this->assertTrue($hasCustomFields); + } + + public function testMatchReturnsTrueWhenItemNameMatchesEqualFilter(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(3)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Acme Corp']]); + + $result = $this->matcher->match([$this->buildCmoFilter('cmo_3', '=', 'Acme Corp')], ['id' => 42]); + + $this->assertTrue($result); + } + + public function testMatchReturnsFalseWhenItemNameDoesNotMatchEqualFilter(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(3)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Wrong Corp']]); + + $result = $this->matcher->match([$this->buildCmoFilter('cmo_3', '=', 'Acme Corp')], ['id' => 42]); + + $this->assertFalse($result); + } + + public function testMatchReturnsTrueWhenAnyLinkedItemNameMatchesFilter(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(3)); + $this->customItemModel->method('getArrayTableData')->willReturn([ + ['name' => 'First Item'], + ['name' => 'Acme Corp'], + ['name' => 'Third Item'], + ]); + + $result = $this->matcher->match([$this->buildCmoFilter('cmo_3', '=', 'Acme Corp')], ['id' => 42]); + + $this->assertTrue($result); + } + + public function testMatchSetsHasCustomFieldsToTrueWhenCustomObjectFilterIsProcessed(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Any']]); + + $hasCustomFields = false; + $this->matcher->match([$this->buildCmoFilter('cmo_1', '=', 'Any')], ['id' => 42], $hasCustomFields); + + $this->assertTrue($hasCustomFields); + } + + public function testCustomItemsAreFetchedOncePerObjectAndLeadAcrossMultipleFilters(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + + $this->customItemModel->expects($this->once()) + ->method('getArrayTableData') + ->willReturn([['name' => 'Acme']]); + + $filters = [ + $this->buildCmoFilter('cmo_1', '=', 'Acme'), + $this->buildCmoFilter('cmo_1', '!=', 'Other'), + ]; + + $this->matcher->match($filters, ['id' => 42]); + } + + public function testMatchFetchesCompanyDataWhenFilterFieldStartsWithCompany(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Test']]); + + $this->companyRepository->expects($this->once()) + ->method('getCompaniesByLeadId') + ->with('42') + ->willReturn([]); + + $filters = [ + $this->buildCmoFilter('cmo_1', '=', 'Test'), + $this->buildLeadFilter('companycountry', '=', 'US'), + ]; + + $this->matcher->match($filters, ['id' => 42]); + } + + public function testMatchDoesNotFetchCompanyDataWhenLeadAlreadyHasCompanies(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Test']]); + + $this->companyRepository->expects($this->never())->method('getCompaniesByLeadId'); + + $filters = [ + $this->buildCmoFilter('cmo_1', '=', 'Test'), + $this->buildLeadFilter('companycountry', '=', 'US'), + ]; + + $this->matcher->match($filters, ['id' => 42, 'companies' => [['companycountry' => 'US']]]); + } + + public function testMatchFetchesTagsWhenFilterTypeIsTags(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Test']]); + + $result = $this->createMock(Result::class); + $queryBuilder = $this->createMock(DbalQueryBuilder::class); + $result->method('fetchFirstColumn')->willReturn(['1', '5']); + $queryBuilder->method('select')->willReturnSelf(); + $queryBuilder->method('from')->willReturnSelf(); + $queryBuilder->method('where')->willReturnSelf(); + $queryBuilder->method('setParameter')->willReturnSelf(); + $queryBuilder->method('execute')->willReturn($result); + + $this->connection->expects($this->once()) + ->method('createQueryBuilder') + ->willReturn($queryBuilder); + + $filters = [ + $this->buildCmoFilter('cmo_1', '=', 'Test'), + ['object' => 'lead', 'field' => 'tags', 'type' => 'tags', 'operator' => 'in', 'filter' => ['1'], 'glue' => 'and'], + ]; + + $this->matcher->match($filters, ['id' => 42]); + } + + public function testMatchDoesNotFetchTagsWhenLeadAlreadyHasTags(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([['name' => 'Test']]); + + $this->connection->expects($this->never())->method('createQueryBuilder'); + + $filters = [ + $this->buildCmoFilter('cmo_1', '=', 'Test'), + ['object' => 'lead', 'field' => 'tags', 'type' => 'tags', 'operator' => 'in', 'filter' => ['1'], 'glue' => 'and'], + ]; + + $this->matcher->match($filters, ['id' => 42, 'tags' => ['1', '5']]); + } + + // Helpers + + private function buildCustomObject(int $id): CustomObject&MockObject + { + $customObject = $this->createMock(CustomObject::class); + $customObject->method('getId')->willReturn($id); + + return $customObject; + } + + /** + * @return mixed[] + */ + private function buildCmoFilter(string $field, string $operator, string $filterValue): array + { + return [ + 'object' => 'custom_object', + 'field' => $field, + 'type' => 'text', + 'operator' => $operator, + 'filter' => $filterValue, + 'glue' => 'and', + ]; + } + + /** + * @return mixed[] + */ + private function buildLeadFilter(string $field, string $operator, string $filterValue): array + { + return [ + 'object' => 'lead', + 'field' => $field, + 'type' => 'text', + 'operator' => $operator, + 'filter' => $filterValue, + 'glue' => 'and', + ]; + } +} From 57fc84bf425bdc1eaffcd3356cd469047fa77e67 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 16:40:00 +0100 Subject: [PATCH 05/17] fix(ContactFilterMatcher): replace deprecated DBAL execute() with executeQuery() --- Helper/ContactFilterMatcher.php | 2 +- Tests/Unit/Helper/ContactFilterMatcherTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Helper/ContactFilterMatcher.php b/Helper/ContactFilterMatcher.php index 726b128f1..53c436288 100644 --- a/Helper/ContactFilterMatcher.php +++ b/Helper/ContactFilterMatcher.php @@ -207,7 +207,7 @@ public function getTagIdsByLeadId(string $leadId): array ->from(MAUTIC_TABLE_PREFIX.'lead_tags_xref', 'x') ->where('x.lead_id = :leadId') ->setParameter('leadId', $leadId) - ->execute() + ->executeQuery() ->fetchFirstColumn(); } } diff --git a/Tests/Unit/Helper/ContactFilterMatcherTest.php b/Tests/Unit/Helper/ContactFilterMatcherTest.php index 16b1b977d..69994cabe 100644 --- a/Tests/Unit/Helper/ContactFilterMatcherTest.php +++ b/Tests/Unit/Helper/ContactFilterMatcherTest.php @@ -224,7 +224,7 @@ public function testMatchFetchesTagsWhenFilterTypeIsTags(): void $queryBuilder->method('from')->willReturnSelf(); $queryBuilder->method('where')->willReturnSelf(); $queryBuilder->method('setParameter')->willReturnSelf(); - $queryBuilder->method('execute')->willReturn($result); + $queryBuilder->method('executeQuery')->willReturn($result); $this->connection->expects($this->once()) ->method('createQueryBuilder') From 8bcef9f7b789b054011d4b0a43d5e0492fe390fa Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 16:55:07 +0100 Subject: [PATCH 06/17] fix(MatchFilterForLeadTrait): handle empty operator when no custom items linked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a contact has no linked custom items, the lead value array is empty and the foreach never executes, leaving the group result as false. For the 'empty' operator this is semantically wrong — no items means the field IS empty, so the condition should match. --- .../EventListener/MatchFilterForLeadTrait.php | 6 +++++ .../Unit/Helper/ContactFilterMatcherTest.php | 22 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Polyfill/EventListener/MatchFilterForLeadTrait.php b/Polyfill/EventListener/MatchFilterForLeadTrait.php index 19304737e..6d3ecc16e 100644 --- a/Polyfill/EventListener/MatchFilterForLeadTrait.php +++ b/Polyfill/EventListener/MatchFilterForLeadTrait.php @@ -67,6 +67,12 @@ protected function matchFilterForLead(array $filter, array $lead): bool $subgroup = null; if (is_array($leadValues)) { + if ('custom_object' === $data['object'] && [] === $leadValues) { + // No custom items linked to this contact: only 'empty' is true. + $groups[$groupNum] = 'empty' === $data['operator']; + continue; + } + foreach ($leadValues as $leadVal) { if ($subgroup) { break; diff --git a/Tests/Unit/Helper/ContactFilterMatcherTest.php b/Tests/Unit/Helper/ContactFilterMatcherTest.php index 69994cabe..84f4d692f 100644 --- a/Tests/Unit/Helper/ContactFilterMatcherTest.php +++ b/Tests/Unit/Helper/ContactFilterMatcherTest.php @@ -118,6 +118,28 @@ public function testMatchReturnsFalseWhenContactHasNoLinkedCustomItems(): void $this->assertTrue($hasCustomFields); } + public function testMatchReturnsTrueForEmptyOperatorWhenContactHasNoLinkedItems(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([]); + + $filter = array_merge($this->buildCmoFilter('cmo_1', 'empty', ''), ['type' => 'text']); + $result = $this->matcher->match([$filter], ['id' => 42]); + + $this->assertTrue($result); + } + + public function testMatchReturnsFalseForNotEmptyOperatorWhenContactHasNoLinkedItems(): void + { + $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(1)); + $this->customItemModel->method('getArrayTableData')->willReturn([]); + + $filter = array_merge($this->buildCmoFilter('cmo_1', '!empty', ''), ['type' => 'text']); + $result = $this->matcher->match([$filter], ['id' => 42]); + + $this->assertFalse($result); + } + public function testMatchReturnsTrueWhenItemNameMatchesEqualFilter(): void { $this->customObjectModel->method('fetchEntity')->willReturn($this->buildCustomObject(3)); From 3bd43b43944c3354c08877fad6448b8bcd437942 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 17:14:15 +0100 Subject: [PATCH 07/17] fix(ContactFilterMatcher): replace #[Autowire] with explicit arg binding in services.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The #[Autowire] attribute is not reliably processed in Mautic 5.1 environments, causing a container compilation failure. Use a specific service definition with ->arg() in services.php instead — this is scoped to ContactFilterMatcher only and works across all supported Mautic/Symfony versions. --- Config/services.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Config/services.php b/Config/services.php index 397ae0627..3cf3942b5 100644 --- a/Config/services.php +++ b/Config/services.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Mautic\CoreBundle\DependencyInjection\MauticCoreExtension; +use MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return function (ContainerConfigurator $configurator): void { @@ -24,4 +25,7 @@ ->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}'); $services->load('MauticPlugin\\CustomObjectsBundle\\Repository\\', '../Repository/*Repository.php'); + + $services->set(ContactFilterMatcher::class) + ->arg('$leadCustomItemFetchLimit', '%mautic.custom_item_fetch_limit_per_lead%'); }; From cd38ae9d86310dbd23b8682e315aa651e3f3ea0f Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 17:42:27 +0100 Subject: [PATCH 08/17] fix(cs): remove extra blank line, extra parentheses, and PHP 8.1 intersection type --- Config/config.php | 1 - Polyfill/EventListener/MatchFilterForLeadTrait.php | 2 +- Tests/Unit/Helper/ContactFilterMatcherTest.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Config/config.php b/Config/config.php index a51735baf..5b8fd1714 100644 --- a/Config/config.php +++ b/Config/config.php @@ -412,7 +412,6 @@ 'custom_object.helper.contact_filter_matcher', ], ], - ], 'forms' => [ 'custom_field.field.params.to.string.transformer' => [ diff --git a/Polyfill/EventListener/MatchFilterForLeadTrait.php b/Polyfill/EventListener/MatchFilterForLeadTrait.php index 6d3ecc16e..885040593 100644 --- a/Polyfill/EventListener/MatchFilterForLeadTrait.php +++ b/Polyfill/EventListener/MatchFilterForLeadTrait.php @@ -214,7 +214,7 @@ private function doFiltersContainCompanyFilter(array $filters): bool return true; } - if ((0 === strpos($filter['field'], 'company') && 'company' !== $filter['field'])) { + if (0 === strpos($filter['field'], 'company') && 'company' !== $filter['field']) { return true; } } diff --git a/Tests/Unit/Helper/ContactFilterMatcherTest.php b/Tests/Unit/Helper/ContactFilterMatcherTest.php index 84f4d692f..d9cadf4ec 100644 --- a/Tests/Unit/Helper/ContactFilterMatcherTest.php +++ b/Tests/Unit/Helper/ContactFilterMatcherTest.php @@ -277,7 +277,7 @@ public function testMatchDoesNotFetchTagsWhenLeadAlreadyHasTags(): void // Helpers - private function buildCustomObject(int $id): CustomObject&MockObject + private function buildCustomObject(int $id): MockObject { $customObject = $this->createMock(CustomObject::class); $customObject->method('getId')->willReturn($id); From ca83550aafffb16996e9b7eac42332b309186d96 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 21:19:04 +0100 Subject: [PATCH 09/17] fix(tests): remove MAUTIC_TABLE_PREFIX define from test file (defined in bootstrap) --- Tests/Unit/Helper/ContactFilterMatcherTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Tests/Unit/Helper/ContactFilterMatcherTest.php b/Tests/Unit/Helper/ContactFilterMatcherTest.php index d9cadf4ec..d29482d28 100644 --- a/Tests/Unit/Helper/ContactFilterMatcherTest.php +++ b/Tests/Unit/Helper/ContactFilterMatcherTest.php @@ -4,10 +4,6 @@ namespace MauticPlugin\CustomObjectsBundle\Tests\Unit\Helper; -if (!defined('MAUTIC_TABLE_PREFIX')) { - define('MAUTIC_TABLE_PREFIX', ''); -} - use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder as DbalQueryBuilder; use Doctrine\DBAL\Result; From 4933a21e0ba9f63788f301257bc43a2d9ee4c74a Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 21:25:11 +0100 Subject: [PATCH 10/17] fix(phpstan): add baseline entry for transformFilterDataForLeadPolyfill return type --- phpstan-baseline.neon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 4446d50f3..211fc53ea 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -702,6 +702,11 @@ parameters: count: 1 path: Helper/ContactFilterMatcher.php + - + message: "#^Method MauticPlugin\\\\CustomObjectsBundle\\\\Helper\\\\ContactFilterMatcher\\:\\:transformFilterDataForLeadPolyfill\\(\\) never returns array so it can be removed from the return type\\.$#" + count: 1 + path: Polyfill/EventListener/MatchFilterForLeadTrait.php + - message: """ #^Fetching deprecated class constant PARAM_INT_ARRAY of class Doctrine\\\\DBAL\\\\Connection\\: From d73a554a3091cb5cd357d05e12c912eae2266657 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 21:30:37 +0100 Subject: [PATCH 11/17] refactor: apply Rector rules (constructor promotion, str_starts_with, non-capturing catches) --- EventListener/DynamicContentSubscriber.php | 2 +- Helper/ContactFilterMatcher.php | 37 ++++++------------- .../EventListener/MatchFilterForLeadTrait.php | 8 ++-- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/EventListener/DynamicContentSubscriber.php b/EventListener/DynamicContentSubscriber.php index e72fa4bd3..a2bd8839e 100644 --- a/EventListener/DynamicContentSubscriber.php +++ b/EventListener/DynamicContentSubscriber.php @@ -58,7 +58,7 @@ private function hasCustomObjectFilters(array $filters): bool $this->queryFilterFactory->configureQueryBuilderFromSegmentFilter($filter, 'filter'); return true; - } catch (InvalidSegmentFilterException $e) { + } catch (InvalidSegmentFilterException) { } } diff --git a/Helper/ContactFilterMatcher.php b/Helper/ContactFilterMatcher.php index 53c436288..503533ed7 100644 --- a/Helper/ContactFilterMatcher.php +++ b/Helper/ContactFilterMatcher.php @@ -23,29 +23,16 @@ class ContactFilterMatcher transformFilterDataForLead as transformFilterDataForLeadPolyfill; } - private CustomFieldModel $customFieldModel; - private CustomObjectModel $customObjectModel; - private CustomItemModel $customItemModel; - private CompanyRepository $companyRepository; - private Connection $connection; - private int $leadCustomItemFetchLimit; - public function __construct( - CustomFieldModel $customFieldModel, - CustomObjectModel $customObjectModel, - CustomItemModel $customItemModel, + private CustomFieldModel $customFieldModel, + private CustomObjectModel $customObjectModel, + private CustomItemModel $customItemModel, LeadListRepository $segmentRepository, - CompanyRepository $companyRepository, - Connection $connection, - int $leadCustomItemFetchLimit + private CompanyRepository $companyRepository, + private Connection $connection, + private int $leadCustomItemFetchLimit ) { - $this->customFieldModel = $customFieldModel; - $this->customObjectModel = $customObjectModel; - $this->customItemModel = $customItemModel; - $this->segmentRepository = $segmentRepository; - $this->companyRepository = $companyRepository; - $this->connection = $connection; - $this->leadCustomItemFetchLimit = $leadCustomItemFetchLimit; + $this->segmentRepository = $segmentRepository; } /** @@ -90,13 +77,13 @@ private function getCustomFieldDataForLead(array $filters, string $leadId): arra continue; } - if ('cmf_' === substr($condition['field'], 0, 4)) { + if (str_starts_with($condition['field'], 'cmf_')) { $customField = $this->customFieldModel->fetchEntity( (int) explode('cmf_', $condition['field'])[1] ); $customObject = $customField->getCustomObject(); $fieldAlias = $customField->getAlias(); - } elseif ('cmo_' === substr($condition['field'], 0, 4)) { + } elseif (str_starts_with($condition['field'], 'cmo_')) { $customObject = $this->customObjectModel->fetchEntity( (int) explode('cmo_', $condition['field'])[1] ); @@ -113,7 +100,7 @@ private function getCustomFieldDataForLead(array $filters, string $leadId): arra $result = $this->getCustomFieldValue($customObject, $fieldAlias, $cachedCustomItems[$key]); $customFieldValues[$condition['field']] = $result; - } catch (NotFoundException|InvalidCustomObjectFormatListException $e) { + } catch (NotFoundException|InvalidCustomObjectFormatListException) { continue; } } @@ -158,7 +145,7 @@ private function getCustomFieldValue( } else { $fieldValues[] = $fieldValue->getCustomField()->getTypeObject()->valueToString($fieldValue); } - } catch (NotFoundException $e) { + } catch (NotFoundException) { // Custom field not found. } } @@ -185,8 +172,6 @@ private function getCustomItems(CustomObject $customObject, string $leadId): arr /** * @param mixed[] $data * @param mixed[] $lead - * - * @return ?mixed[] */ private function transformFilterDataForLead(array $data, array $lead): ?array { diff --git a/Polyfill/EventListener/MatchFilterForLeadTrait.php b/Polyfill/EventListener/MatchFilterForLeadTrait.php index 885040593..269e4bb42 100644 --- a/Polyfill/EventListener/MatchFilterForLeadTrait.php +++ b/Polyfill/EventListener/MatchFilterForLeadTrait.php @@ -170,14 +170,14 @@ protected function matchFilterForLead(array $filter, array $lead): bool $groups[$groupNum] = 1 !== preg_match('/'.$filterVal.'/i', $leadVal); break; case 'startsWith': - $groups[$groupNum] = 0 === strncmp($leadVal, $filterVal, strlen($filterVal)); + $groups[$groupNum] = str_starts_with($leadVal, $filterVal); break; case 'endsWith': $endOfString = substr($leadVal, strlen($leadVal) - strlen($filterVal)); $groups[$groupNum] = 0 === strcmp($endOfString, $filterVal); break; case 'contains': - $groups[$groupNum] = false !== strpos((string) $leadVal, (string) $filterVal); + $groups[$groupNum] = str_contains((string) $leadVal, (string) $filterVal); break; default: throw new OperatorsNotFoundException('Operator is not defined or invalid operator found.'); @@ -194,8 +194,6 @@ protected function matchFilterForLead(array $filter, array $lead): bool /** * @param mixed[] $data * @param mixed[] $lead - * - * @return ?mixed[] */ private function transformFilterDataForLead(array $data, array $lead): ?array { @@ -214,7 +212,7 @@ private function doFiltersContainCompanyFilter(array $filters): bool return true; } - if (0 === strpos($filter['field'], 'company') && 'company' !== $filter['field']) { + if (str_starts_with($filter['field'], 'company') && 'company' !== $filter['field']) { return true; } } From 1be1b9df2c14563e6e919fb262ca2e781d2797d7 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Wed, 11 Mar 2026 21:34:37 +0100 Subject: [PATCH 12/17] fix(phpstan): suppress array element type errors for transformFilterDataForLead methods --- phpstan-baseline.neon | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 211fc53ea..bc030b658 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -707,6 +707,16 @@ parameters: count: 1 path: Polyfill/EventListener/MatchFilterForLeadTrait.php + - + message: "#^Method MauticPlugin\\\\CustomObjectsBundle\\\\Helper\\\\ContactFilterMatcher\\:\\:transformFilterDataForLeadPolyfill\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: Polyfill/EventListener/MatchFilterForLeadTrait.php + + - + message: "#^Method MauticPlugin\\\\CustomObjectsBundle\\\\Helper\\\\ContactFilterMatcher\\:\\:transformFilterDataForLead\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: Helper/ContactFilterMatcher.php + - message: """ #^Fetching deprecated class constant PARAM_INT_ARRAY of class Doctrine\\\\DBAL\\\\Connection\\: From 7b6e76e5d94fc5a2d331e08086951da12eef52aa Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Thu, 12 Mar 2026 00:20:30 +0100 Subject: [PATCH 13/17] ci: update workflow to test against PHP 8.2 and Mautic 6.x Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 02265f6e9..6833ad05c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,9 +18,9 @@ jobs: strategy: matrix: - php-versions: ['8.0'] # The supported PHP versions + php-versions: ['8.2'] # The supported PHP versions db-types: ['mysql'] # can be: ['mysql', 'mariadb'] but not necessary for this plugin that does not add any DB schema - mautic-versions: ['5.1'] # The supported Mautic versions + mautic-versions: ['6.x'] # The supported Mautic versions name: Tests on PHP ${{ matrix.php-versions }}, ${{ matrix.db-types }}, Mautic ${{ matrix.mautic-versions }} From 56413fe9318e20e1d302db04446bc0c105cfeee3 Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Thu, 12 Mar 2026 00:25:31 +0100 Subject: [PATCH 14/17] ci: add fix/** branch trigger and workflow_dispatch for local testing Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6833ad05c..669f6bb26 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,9 @@ on: - '[0-9]+\.[0-9]+' - development - beta + - 'fix/**' pull_request: + workflow_dispatch: env: PLUGIN_DIR: plugins/CustomObjectsBundle # Same as extra.install-directory-name in composer.json From fbef424afe669db2db65f26b60afaa2b92ce6f4f Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Thu, 12 Mar 2026 00:30:28 +0100 Subject: [PATCH 15/17] fix(services): use #[Autowire] for leadCustomItemFetchLimit on Mautic 6 Symfony 6.4 is strict about unused _defaults bindings. Replace the ->bind()/_defaults approach with #[Autowire(param:...)] on the ContactFilterMatcher constructor, which is fully supported on Symfony 6.4. Co-Authored-By: Claude Sonnet 4.6 --- Config/services.php | 7 +------ Helper/ContactFilterMatcher.php | 2 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Config/services.php b/Config/services.php index 3cf3942b5..2f7e94f21 100644 --- a/Config/services.php +++ b/Config/services.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Mautic\CoreBundle\DependencyInjection\MauticCoreExtension; -use MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return function (ContainerConfigurator $configurator): void { @@ -11,8 +10,7 @@ ->defaults() ->autowire() ->autoconfigure() - ->public() - ->bind('int $leadCustomItemFetchLimit', '%mautic.custom_item_fetch_limit_per_lead%'); + ->public(); $excludes = [ 'Provider/SessionProvider.php', @@ -25,7 +23,4 @@ ->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}'); $services->load('MauticPlugin\\CustomObjectsBundle\\Repository\\', '../Repository/*Repository.php'); - - $services->set(ContactFilterMatcher::class) - ->arg('$leadCustomItemFetchLimit', '%mautic.custom_item_fetch_limit_per_lead%'); }; diff --git a/Helper/ContactFilterMatcher.php b/Helper/ContactFilterMatcher.php index 503533ed7..12d1155ee 100644 --- a/Helper/ContactFilterMatcher.php +++ b/Helper/ContactFilterMatcher.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\Connection; use Mautic\LeadBundle\Entity\CompanyRepository; use Mautic\LeadBundle\Entity\LeadListRepository; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use MauticPlugin\CustomObjectsBundle\DTO\TableConfig; use MauticPlugin\CustomObjectsBundle\Entity\CustomItem; use MauticPlugin\CustomObjectsBundle\Entity\CustomObject; @@ -30,6 +31,7 @@ public function __construct( LeadListRepository $segmentRepository, private CompanyRepository $companyRepository, private Connection $connection, + #[Autowire(param: 'mautic.custom_item_fetch_limit_per_lead')] private int $leadCustomItemFetchLimit ) { $this->segmentRepository = $segmentRepository; From 817583738cdd77347449aa28a16e7aa57c3765be Mon Sep 17 00:00:00 2001 From: Edouard MANGEL Date: Thu, 12 Mar 2026 00:38:33 +0100 Subject: [PATCH 16/17] fix(cs): apply PHP CS Fixer rules for Mautic 6 compatibility Bulk fix of trailing_comma_in_multiline, new_with_parentheses, fully_qualified_strict_types, ordered_imports, and phpdoc_separation violations across the codebase. These are pre-existing issues exposed when testing against Mautic 6's php-cs-fixer ruleset. Co-Authored-By: Claude Sonnet 4.6 --- Command/CustomItemsScheduledExportCommand.php | 2 +- Command/GenerateSampleDataCommand.php | 2 +- Config/config.php | 2 +- Config/services.php | 2 ++ Controller/CustomField/FormController.php | 2 +- Controller/CustomField/SaveController.php | 4 ++-- .../CustomItem/BatchDeleteController.php | 2 +- Controller/CustomItem/CancelController.php | 2 +- .../CustomItem/ContactListController.php | 2 +- Controller/CustomItem/DeleteController.php | 2 +- Controller/CustomItem/ExportController.php | 2 +- Controller/CustomItem/FormController.php | 16 +++++++------- Controller/CustomItem/LinkController.php | 2 +- Controller/CustomItem/LinkFormController.php | 6 ++--- Controller/CustomItem/ListController.php | 2 +- Controller/CustomItem/LookupController.php | 2 +- Controller/CustomItem/SaveController.php | 2 +- Controller/CustomItem/UnlinkController.php | 2 +- Controller/CustomItem/ViewController.php | 2 +- Controller/CustomObject/CancelController.php | 2 +- Controller/CustomObject/DeleteController.php | 2 +- Controller/CustomObject/FormController.php | 8 +++---- Controller/CustomObject/ListController.php | 2 +- Controller/CustomObject/SaveController.php | 4 ++-- Controller/CustomObject/ViewController.php | 2 +- CustomFieldType/AbstractCustomFieldType.php | 2 +- CustomFieldType/AbstractMultivalueType.php | 2 +- DTO/TableConfig.php | 2 +- Entity/CustomFieldOption.php | 4 ---- Entity/CustomItem.php | 2 +- Entity/CustomItemXrefCompany.php | 2 +- Entity/CustomItemXrefContact.php | 2 +- Event/CustomItemListQueryEvent.php | 2 +- Event/CustomItemXrefEntityDiscoveryEvent.php | 2 +- EventListener/ApiSubscriber.php | 2 +- EventListener/AssetsSubscriber.php | 2 +- EventListener/AuditLogSubscriber.php | 2 +- EventListener/CampaignSubscriber.php | 2 +- EventListener/ContactSubscriber.php | 2 +- EventListener/ContactTabSubscriber.php | 2 +- EventListener/CustomItemButtonSubscriber.php | 2 +- .../CustomItemPostDeleteSubscriber.php | 2 +- .../CustomItemPostSaveSubscriber.php | 2 +- EventListener/CustomItemTabSubscriber.php | 2 +- .../CustomItemXrefContactSubscriber.php | 2 +- .../CustomItemXrefCustomItemSubscriber.php | 2 +- .../CustomObjectButtonSubscriber.php | 2 +- .../CustomObjectPreDeleteSubscriber.php | 2 +- EventListener/ImportSubscriber.php | 2 +- EventListener/ReportSubscriber.php | 2 +- ...egmentFiltersChoicesGenerateSubscriber.php | 2 +- .../SegmentFiltersDictionarySubscriber.php | 2 +- EventListener/SerializerSubscriber.php | 2 +- EventListener/TokenSubscriber.php | 5 ++--- Exception/ForbiddenException.php | 2 +- Exception/NoRelationshipException.php | 2 +- Exception/NotFoundException.php | 2 +- Extension/CustomItemListeningExtension.php | 2 +- Form/Type/CampaignActionLinkType.php | 2 +- Form/Type/CampaignConditionFieldValueType.php | 2 +- Form/Type/CustomFieldType.php | 2 +- Form/Type/CustomObjectType.php | 2 +- Helper/ContactFilterMatcher.php | 6 ++--- Helper/LockFlashMessageHelper.php | 2 +- Helper/QueryFilterFactory.php | 4 ++-- Helper/QueryFilterHelper.php | 22 +++++++++---------- Model/CustomFieldOptionModel.php | 2 +- Model/CustomFieldValueModel.php | 2 +- Model/CustomItemXrefContactModel.php | 2 +- .../Permissions/CustomObjectPermissions.php | 2 +- .../Filter/CustomFieldFilterQueryBuilder.php | 2 +- .../CustomItemNameFilterQueryBuilder.php | 2 +- .../CustomObjectMergedFilterQueryBuilder.php | 2 +- Segment/Query/Filter/QueryFilterFactory.php | 2 +- .../ApiPlatform/CustomFieldFunctionalTest.php | 4 ++-- .../CustomFieldOptionFunctionalTest.php | 2 +- .../CustomObjectFunctionalTest.php | 2 +- .../EventListener/CampaignConditionTest.php | 2 +- .../EventListener/CampaignSubscriberTest.php | 2 +- .../DynamicContentSubscriberTest.php | 2 ++ .../CustomFieldFilterQueryBuilderTest.php | 2 +- .../AbstractFieldControllerTest.php | 2 +- .../CustomField/FormControllerTest.php | 2 +- .../CustomField/SaveControllerTest.php | 2 +- .../CustomItem/FormControllerTest.php | 12 +++++----- .../CustomItem/SaveControllerTest.php | 4 ++-- .../CustomItem/UnlinkControllerTest.php | 4 ++-- Tests/Unit/DTO/TableConfigTest.php | 2 +- .../CustomItemPostSaveSubscriberTest.php | 12 +++++----- .../CustomObjectPostSaveSubscriberTest.php | 2 +- .../Repository/CustomObjectRepositoryTest.php | 2 +- phpstan-class-aliases.php | 2 +- 92 files changed, 134 insertions(+), 135 deletions(-) diff --git a/Command/CustomItemsScheduledExportCommand.php b/Command/CustomItemsScheduledExportCommand.php index 3212ccc15..eed35b961 100644 --- a/Command/CustomItemsScheduledExportCommand.php +++ b/Command/CustomItemsScheduledExportCommand.php @@ -21,7 +21,7 @@ class CustomItemsScheduledExportCommand extends Command public function __construct( private CustomItemExportSchedulerModel $customItemExportSchedulerModel, private EventDispatcherInterface $eventDispatcher, - private FormatterHelper $formatterHelper + private FormatterHelper $formatterHelper, ) { parent::__construct(); } diff --git a/Command/GenerateSampleDataCommand.php b/Command/GenerateSampleDataCommand.php index ceb815d44..c704f81a5 100644 --- a/Command/GenerateSampleDataCommand.php +++ b/Command/GenerateSampleDataCommand.php @@ -22,7 +22,7 @@ class GenerateSampleDataCommand extends Command public function __construct( private EntityManager $entityManager, - private RandomHelper $randomHelper + private RandomHelper $randomHelper, ) { parent::__construct(); diff --git a/Config/config.php b/Config/config.php index 5b8fd1714..755b4473f 100644 --- a/Config/config.php +++ b/Config/config.php @@ -644,7 +644,7 @@ ], ], 'custom_object.helper.contact_filter_matcher' => [ - 'class' => \MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher::class, + 'class' => MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher::class, 'arguments' => [ 'mautic.custom.model.field', 'mautic.custom.model.object', diff --git a/Config/services.php b/Config/services.php index 2f7e94f21..38dcbff95 100644 --- a/Config/services.php +++ b/Config/services.php @@ -17,6 +17,8 @@ 'Report/ReportColumnsBuilder.php', 'Serializer/ApiNormalizer.php', 'Extension/CustomItemListeningExtension.php', + // Registered explicitly in config.php with a non-autowirable int argument + 'Helper/ContactFilterMatcher.php', ]; $services->load('MauticPlugin\\CustomObjectsBundle\\', '../') diff --git a/Controller/CustomField/FormController.php b/Controller/CustomField/FormController.php index cc2e8a2cd..0c552cca2 100644 --- a/Controller/CustomField/FormController.php +++ b/Controller/CustomField/FormController.php @@ -27,7 +27,7 @@ public function renderFormAction( CustomFieldPermissionProvider $permissionProvider, CustomFieldRouteProvider $fieldRouteProvider, CustomObjectModel $customObjectModel, - CustomObjectRouteProvider $objectRouteProvider + CustomObjectRouteProvider $objectRouteProvider, ): Response { $request = $this->getCurrentRequest(); $objectId = (int) $request->get('objectId'); diff --git a/Controller/CustomField/SaveController.php b/Controller/CustomField/SaveController.php index 7d91b2790..49079fc3b 100644 --- a/Controller/CustomField/SaveController.php +++ b/Controller/CustomField/SaveController.php @@ -41,7 +41,7 @@ public function saveAction( CustomFieldFactory $customFieldFactory, CustomFieldPermissionProvider $permissionProvider, CustomFieldRouteProvider $fieldRouteProvider, - CustomObjectModel $customObjectModel + CustomObjectModel $customObjectModel, ) { $request = $this->getCurrentRequest(); @@ -111,7 +111,7 @@ private function buildSuccessForm( CustomField $customField, Request $request, CustomFieldModel $customFieldModel, - FormFactoryInterface $formFactory + FormFactoryInterface $formFactory, ): JsonResponse { $panelId = is_numeric($request->get('panelId')) ? (int) $request->get('panelId') : null; // Is edit of existing panel in view diff --git a/Controller/CustomItem/BatchDeleteController.php b/Controller/CustomItem/BatchDeleteController.php index f4b41e0ca..f9b1cce7c 100644 --- a/Controller/CustomItem/BatchDeleteController.php +++ b/Controller/CustomItem/BatchDeleteController.php @@ -22,7 +22,7 @@ public function deleteAction( CustomItemPermissionProvider $permissionProvider, CustomItemRouteProvider $routeProvider, FlashBag $flashBag, - int $objectId + int $objectId, ): Response { $request = $this->getCurrentRequest(); diff --git a/Controller/CustomItem/CancelController.php b/Controller/CustomItem/CancelController.php index 49e211e38..fc5a92492 100644 --- a/Controller/CustomItem/CancelController.php +++ b/Controller/CustomItem/CancelController.php @@ -21,7 +21,7 @@ public function cancelAction( CustomItemRouteProvider $routeProvider, CustomItemModel $customItemModel, int $objectId, - ?int $itemId = null + ?int $itemId = null, ): Response { $page = $sessionProviderFactory->createItemProvider($objectId)->getPage(); diff --git a/Controller/CustomItem/ContactListController.php b/Controller/CustomItem/ContactListController.php index a1af5def4..55e9faa77 100644 --- a/Controller/CustomItem/ContactListController.php +++ b/Controller/CustomItem/ContactListController.php @@ -21,7 +21,7 @@ public function listAction( Request $request, PageHelperFactoryInterface $pageHelperFactory, int $objectId, - int $page = 1 + int $page = 1, ): Response { return $this->generateContactsGrid( $request, diff --git a/Controller/CustomItem/DeleteController.php b/Controller/CustomItem/DeleteController.php index 651f86abf..678d42745 100644 --- a/Controller/CustomItem/DeleteController.php +++ b/Controller/CustomItem/DeleteController.php @@ -23,7 +23,7 @@ public function deleteAction( CustomItemPermissionProvider $permissionProvider, CustomItemRouteProvider $routeProvider, int $objectId, - int $itemId + int $itemId, ): Response { try { $customItem = $customItemModel->fetchEntity($itemId); diff --git a/Controller/CustomItem/ExportController.php b/Controller/CustomItem/ExportController.php index 0f9a1b05e..9dc965ba7 100644 --- a/Controller/CustomItem/ExportController.php +++ b/Controller/CustomItem/ExportController.php @@ -26,7 +26,7 @@ class ExportController extends AbstractFormController public function exportAction( CustomItemPermissionProvider $permissionProvider, CustomItemExportSchedulerModel $model, - int $object + int $object, ): Response { $permissionProvider->canCreate($object); diff --git a/Controller/CustomItem/FormController.php b/Controller/CustomItem/FormController.php index 74873f61b..1622c62b9 100644 --- a/Controller/CustomItem/FormController.php +++ b/Controller/CustomItem/FormController.php @@ -25,7 +25,7 @@ public function newAction( CustomItemModel $customItemModel, CustomObjectModel $customObjectModel, CustomItemPermissionProvider $permissionProvider, - int $objectId + int $objectId, ): Response { try { $customItem = $this->performNewAction($customObjectModel, $customItemModel, $permissionProvider, $objectId); @@ -48,7 +48,7 @@ public function newWithRedirectToContactAction( CustomObjectModel $customObjectModel, CustomItemPermissionProvider $permissionProvider, int $objectId, - int $contactId + int $contactId, ): Response { try { $customItem = $this->performNewAction($customObjectModel, $customItemModel, $permissionProvider, $objectId); @@ -77,7 +77,7 @@ private function performNewAction( CustomObjectModel $customObjectModel, CustomItemModel $customItemModel, CustomItemPermissionProvider $permissionProvider, - int $objectId + int $objectId, ): CustomItem { $permissionProvider->canCreate($objectId); @@ -95,7 +95,7 @@ public function editAction( LockFlashMessageHelper $lockFlashMessageHelper, CustomItemPermissionProvider $permissionProvider, int $objectId, - int $itemId + int $itemId, ): Response { try { $customItem = $this->performEditAction($customItemModel, $permissionProvider, $itemId); @@ -134,7 +134,7 @@ public function editWithRedirectToContactAction( CustomItemPermissionProvider $permissionProvider, int $objectId, int $itemId, - int $contactId + int $contactId, ): Response { try { $customItem = $this->performEditAction($customItemModel, $permissionProvider, $itemId); @@ -180,7 +180,7 @@ public function cloneAction( CustomItemModel $customItemModel, CustomItemPermissionProvider $permissionProvider, int $objectId, - int $itemId + int $itemId, ): Response { try { $customItem = clone $customItemModel->fetchEntity($itemId); @@ -204,7 +204,7 @@ public function cloneAction( private function performEditAction( CustomItemModel $customItemModel, CustomItemPermissionProvider $permissionProvider, - int $itemId + int $itemId, ): CustomItem { $customItem = $customItemModel->fetchEntity($itemId); $permissionProvider->canEdit($customItem); @@ -217,7 +217,7 @@ private function renderFormForItem( CustomItemRouteProvider $routeProvider, CustomItem $customItem, string $route, - ?int $contactId = null + ?int $contactId = null, ): Response { $action = $routeProvider->buildSaveRoute($customItem->getCustomObject()->getId(), $customItem->getId()); $options = [ diff --git a/Controller/CustomItem/LinkController.php b/Controller/CustomItem/LinkController.php index 6b4e33607..9080db4d1 100644 --- a/Controller/CustomItem/LinkController.php +++ b/Controller/CustomItem/LinkController.php @@ -21,7 +21,7 @@ public function saveAction( FlashBag $flashBag, int $itemId, string $entityType, - int $entityId + int $entityId, ): JsonResponse { try { $customItem = $customItemModel->fetchEntity($itemId); diff --git a/Controller/CustomItem/LinkFormController.php b/Controller/CustomItem/LinkFormController.php index 0e1cb6a3a..f4cce8f80 100644 --- a/Controller/CustomItem/LinkFormController.php +++ b/Controller/CustomItem/LinkFormController.php @@ -31,7 +31,7 @@ public function formAction( FlashBag $flashBag, int $itemId, string $entityType, - int $entityId + int $entityId, ): Response { try { $customItem = $customItemModel->fetchEntity($itemId); @@ -93,7 +93,7 @@ public function saveAction( FlashBag $flashBag, int $itemId, string $entityType, - int $entityId + int $entityId, ): Response { $relationshipItem = null; $relationshipObject = null; @@ -164,7 +164,7 @@ protected function getRelationshipItem( CustomObject $relationshipObject, CustomItem $customItem, string $entityType, - int $entityId + int $entityId, ): CustomItem { /** @var CustomItemXrefCustomItem|null $relationshipItemXref */ $relationshipItemXref = $customItem->getCustomItemLowerReferences() diff --git a/Controller/CustomItem/ListController.php b/Controller/CustomItem/ListController.php index 381081f40..302b0331e 100644 --- a/Controller/CustomItem/ListController.php +++ b/Controller/CustomItem/ListController.php @@ -26,7 +26,7 @@ public function listAction( CustomItemPermissionProvider $permissionProvider, CustomItemRouteProvider $routeProvider, int $objectId, - int $page = 1 + int $page = 1, ): Response { $request = $this->getCurrentRequest(); diff --git a/Controller/CustomItem/LookupController.php b/Controller/CustomItem/LookupController.php index 38c4c813b..0b6dc7624 100644 --- a/Controller/CustomItem/LookupController.php +++ b/Controller/CustomItem/LookupController.php @@ -22,7 +22,7 @@ public function listAction( CustomItemModel $customItemModel, CustomItemPermissionProvider $permissionProvider, FlashBag $flashBag, - int $objectId + int $objectId, ): JsonResponse { try { $permissionProvider->canViewAtAll($objectId); diff --git a/Controller/CustomItem/SaveController.php b/Controller/CustomItem/SaveController.php index 0350b4800..9d0996217 100644 --- a/Controller/CustomItem/SaveController.php +++ b/Controller/CustomItem/SaveController.php @@ -30,7 +30,7 @@ public function saveAction( CustomItemRouteProvider $routeProvider, LockFlashMessageHelper $lockFlashMessageHelper, int $objectId, - ?int $itemId = null + ?int $itemId = null, ): Response { $request = $this->getCurrentRequest(); diff --git a/Controller/CustomItem/UnlinkController.php b/Controller/CustomItem/UnlinkController.php index fd0a724d5..fbbb79d6c 100644 --- a/Controller/CustomItem/UnlinkController.php +++ b/Controller/CustomItem/UnlinkController.php @@ -20,7 +20,7 @@ public function saveAction( FlashBag $flashBag, int $itemId, string $entityType, - int $entityId + int $entityId, ): JsonResponse { try { $customItem = $customItemModel->fetchEntity($itemId); diff --git a/Controller/CustomItem/ViewController.php b/Controller/CustomItem/ViewController.php index 62885f8cd..678b36dd7 100644 --- a/Controller/CustomItem/ViewController.php +++ b/Controller/CustomItem/ViewController.php @@ -26,7 +26,7 @@ public function viewAction( CustomItemPermissionProvider $permissionProvider, CustomItemRouteProvider $routeProvider, int $objectId, - int $itemId + int $itemId, ): Response { $request = $this->getCurrentRequest(); diff --git a/Controller/CustomObject/CancelController.php b/Controller/CustomObject/CancelController.php index 97798ef5d..ed5a8c59a 100644 --- a/Controller/CustomObject/CancelController.php +++ b/Controller/CustomObject/CancelController.php @@ -16,7 +16,7 @@ public function cancelAction( SessionProviderFactory $sessionProviderFactory, CustomObjectRouteProvider $routeProvider, CustomObjectModel $customObjectModel, - ?int $objectId + ?int $objectId, ): Response { $page = $sessionProviderFactory->createObjectProvider()->getPage(); diff --git a/Controller/CustomObject/DeleteController.php b/Controller/CustomObject/DeleteController.php index 4eb96c95a..1b6f4d710 100644 --- a/Controller/CustomObject/DeleteController.php +++ b/Controller/CustomObject/DeleteController.php @@ -25,7 +25,7 @@ public function deleteAction( FlashBag $flashBag, CustomObjectPermissionProvider $permissionProvider, EventDispatcherInterface $eventDispatcher, - int $objectId + int $objectId, ): Response { $controller = 'MauticPlugin\CustomObjectsBundle\Controller\CustomObject\ListController:listAction'; $page = [ diff --git a/Controller/CustomObject/FormController.php b/Controller/CustomObject/FormController.php index 581b00c1f..654f43c96 100644 --- a/Controller/CustomObject/FormController.php +++ b/Controller/CustomObject/FormController.php @@ -25,7 +25,7 @@ public function newAction( FormFactoryInterface $formFactory, CustomObjectRouteProvider $routeProvider, CustomFieldTypeProvider $customFieldTypeProvider, - CustomFieldModel $customFieldModel + CustomFieldModel $customFieldModel, ): Response { try { $permissionProvider->canCreate(); @@ -52,7 +52,7 @@ public function editAction( CustomObjectRouteProvider $routeProvider, CustomFieldTypeProvider $customFieldTypeProvider, CustomFieldModel $customFieldModel, - int $objectId + int $objectId, ): Response { try { $customObject = $customObjectModel->fetchEntity($objectId); @@ -93,7 +93,7 @@ public function cloneAction( CustomObjectRouteProvider $routeProvider, CustomFieldTypeProvider $customFieldTypeProvider, CustomFieldModel $customFieldModel, - int $objectId + int $objectId, ): Response { try { $customObject = clone $customObjectModel->fetchEntity($objectId); @@ -120,7 +120,7 @@ private function renderFormForObject( CustomFieldTypeProvider $customFieldTypeProvider, CustomFieldModel $customFieldModel, CustomObject $customObject, - string $route + string $route, ): Response { $form = $formFactory->create( CustomObjectType::class, diff --git a/Controller/CustomObject/ListController.php b/Controller/CustomObject/ListController.php index 130186518..1e144ef3d 100644 --- a/Controller/CustomObject/ListController.php +++ b/Controller/CustomObject/ListController.php @@ -22,7 +22,7 @@ public function listAction( CustomObjectModel $customObjectModel, CustomObjectPermissionProvider $permissionProvider, CustomObjectRouteProvider $routeProvider, - int $page = 1 + int $page = 1, ): Response { $request = $this->getCurrentRequest(); diff --git a/Controller/CustomObject/SaveController.php b/Controller/CustomObject/SaveController.php index 603a569c7..c0585332b 100644 --- a/Controller/CustomObject/SaveController.php +++ b/Controller/CustomObject/SaveController.php @@ -37,7 +37,7 @@ public function saveAction( ParamsToStringTransformer $paramsToStringTransformer, OptionsToStringTransformer $optionsToStringTransformer, LockFlashMessageHelper $lockFlashMessageHelper, - ?int $objectId = null + ?int $objectId = null, ): Response { $request = $this->getCurrentRequest(); @@ -133,7 +133,7 @@ private function handleRawPost( ParamsToStringTransformer $paramsToStringTransformer, OptionsToStringTransformer $optionsToStringTransformer, CustomObject $customObject, - array $rawCustomObject + array $rawCustomObject, ): void { if (empty($rawCustomObject['customFields'])) { return; diff --git a/Controller/CustomObject/ViewController.php b/Controller/CustomObject/ViewController.php index d8dd3e449..7fb22d28c 100644 --- a/Controller/CustomObject/ViewController.php +++ b/Controller/CustomObject/ViewController.php @@ -23,7 +23,7 @@ public function viewAction( AuditLogModel $auditLogModel, CustomObjectPermissionProvider $permissionProvider, CustomObjectRouteProvider $routeProvider, - int $objectId + int $objectId, ): Response { $request = $this->getCurrentRequest(); diff --git a/CustomFieldType/AbstractCustomFieldType.php b/CustomFieldType/AbstractCustomFieldType.php index 5a8b3199e..13fb995ec 100644 --- a/CustomFieldType/AbstractCustomFieldType.php +++ b/CustomFieldType/AbstractCustomFieldType.php @@ -26,7 +26,7 @@ abstract class AbstractCustomFieldType implements CustomFieldTypeInterface, \Str public function __construct( protected TranslatorInterface $translator, - protected FilterOperatorProviderInterface $filterOperatorProvider + protected FilterOperatorProviderInterface $filterOperatorProvider, ) { } diff --git a/CustomFieldType/AbstractMultivalueType.php b/CustomFieldType/AbstractMultivalueType.php index e46757d22..f8a97dc29 100644 --- a/CustomFieldType/AbstractMultivalueType.php +++ b/CustomFieldType/AbstractMultivalueType.php @@ -25,7 +25,7 @@ abstract class AbstractMultivalueType extends AbstractCustomFieldType public function __construct( TranslatorInterface $translator, FilterOperatorProviderInterface $filterOperatorProvider, - private CsvHelper $csvHelper + private CsvHelper $csvHelper, ) { parent::__construct($translator, $filterOperatorProvider); } diff --git a/DTO/TableConfig.php b/DTO/TableConfig.php index 70132dd11..be4e92a63 100644 --- a/DTO/TableConfig.php +++ b/DTO/TableConfig.php @@ -19,7 +19,7 @@ public function __construct( private int $limit, private int $page, private string $orderBy, - private string $orderDirection = 'ASC' + private string $orderDirection = 'ASC', ) { } diff --git a/Entity/CustomFieldOption.php b/Entity/CustomFieldOption.php index 59fef1510..f76e68eef 100644 --- a/Entity/CustomFieldOption.php +++ b/Entity/CustomFieldOption.php @@ -177,10 +177,6 @@ public function offsetExists(mixed $offset): bool /** * {@inheritdoc} - * - * @param mixed $offset - * - * @return mixed */ public function offsetGet(mixed $offset): mixed { diff --git a/Entity/CustomItem.php b/Entity/CustomItem.php index 99a658f9a..2decf3cab 100644 --- a/Entity/CustomItem.php +++ b/Entity/CustomItem.php @@ -188,7 +188,7 @@ public function __construct(/** * * @Groups({"custom_item:read", "custom_item:write"}) */ - private CustomObject $customObject + private CustomObject $customObject, ) { $this->customFieldValues = new ArrayCollection(); $this->contactReferences = new ArrayCollection(); diff --git a/Entity/CustomItemXrefCompany.php b/Entity/CustomItemXrefCompany.php index 8d03163f3..eeb166644 100644 --- a/Entity/CustomItemXrefCompany.php +++ b/Entity/CustomItemXrefCompany.php @@ -19,7 +19,7 @@ class CustomItemXrefCompany implements CustomItemXrefInterface public function __construct( private CustomItem $customItem, private Company $company, - ?\DateTimeInterface $dateAdded = null + ?\DateTimeInterface $dateAdded = null, ) { $this->dateAdded = $dateAdded ?: new \DateTimeImmutable('now', new \DateTimeZone('UTC')); } diff --git a/Entity/CustomItemXrefContact.php b/Entity/CustomItemXrefContact.php index 0648a0ea7..87f2368eb 100644 --- a/Entity/CustomItemXrefContact.php +++ b/Entity/CustomItemXrefContact.php @@ -20,7 +20,7 @@ class CustomItemXrefContact implements CustomItemXrefInterface public function __construct( private CustomItem $customItem, private Lead $contact, - ?\DateTimeInterface $dateAdded = null + ?\DateTimeInterface $dateAdded = null, ) { $this->dateAdded = $dateAdded ?: new \DateTimeImmutable('now', new \DateTimeZone('UTC')); } diff --git a/Event/CustomItemListQueryEvent.php b/Event/CustomItemListQueryEvent.php index 78f06e662..4d051b813 100644 --- a/Event/CustomItemListQueryEvent.php +++ b/Event/CustomItemListQueryEvent.php @@ -12,7 +12,7 @@ class CustomItemListQueryEvent extends Event { public function __construct( private QueryBuilder $queryBuilder, - private TableConfig $tableConfig + private TableConfig $tableConfig, ) { } diff --git a/Event/CustomItemXrefEntityDiscoveryEvent.php b/Event/CustomItemXrefEntityDiscoveryEvent.php index 8e6d4ce81..290375383 100644 --- a/Event/CustomItemXrefEntityDiscoveryEvent.php +++ b/Event/CustomItemXrefEntityDiscoveryEvent.php @@ -15,7 +15,7 @@ class CustomItemXrefEntityDiscoveryEvent extends Event public function __construct( private CustomItem $customItem, private string $entityType, - private int $entityId + private int $entityId, ) { } diff --git a/EventListener/ApiSubscriber.php b/EventListener/ApiSubscriber.php index 7125f145d..78c95d087 100644 --- a/EventListener/ApiSubscriber.php +++ b/EventListener/ApiSubscriber.php @@ -24,7 +24,7 @@ class ApiSubscriber implements EventSubscriberInterface public function __construct( private ConfigProvider $configProvider, private CustomObjectModel $customObjectModel, - private CustomItemModel $customItemModel + private CustomItemModel $customItemModel, ) { } diff --git a/EventListener/AssetsSubscriber.php b/EventListener/AssetsSubscriber.php index 0b5e7e264..4c80aee53 100644 --- a/EventListener/AssetsSubscriber.php +++ b/EventListener/AssetsSubscriber.php @@ -15,7 +15,7 @@ class AssetsSubscriber implements EventSubscriberInterface { public function __construct( private AssetsHelper $assetHelper, - private ConfigProvider $configProvider + private ConfigProvider $configProvider, ) { } diff --git a/EventListener/AuditLogSubscriber.php b/EventListener/AuditLogSubscriber.php index 1dc86ebc0..b2bfc9b4f 100644 --- a/EventListener/AuditLogSubscriber.php +++ b/EventListener/AuditLogSubscriber.php @@ -17,7 +17,7 @@ class AuditLogSubscriber implements EventSubscriberInterface { public function __construct( private AuditLogModel $auditLogModel, - private IpLookupHelper $ipLookupHelper + private IpLookupHelper $ipLookupHelper, ) { } diff --git a/EventListener/CampaignSubscriber.php b/EventListener/CampaignSubscriber.php index 01e437e79..369843243 100644 --- a/EventListener/CampaignSubscriber.php +++ b/EventListener/CampaignSubscriber.php @@ -45,7 +45,7 @@ public function __construct( private ConfigProvider $configProvider, private QueryFilterHelper $queryFilterHelper, private QueryFilterFactory $queryFilterFactory, - private Connection $connection + private Connection $connection, ) { } diff --git a/EventListener/ContactSubscriber.php b/EventListener/ContactSubscriber.php index 24cf17c35..495e0e876 100644 --- a/EventListener/ContactSubscriber.php +++ b/EventListener/ContactSubscriber.php @@ -27,7 +27,7 @@ public function __construct( private CustomItemRouteProvider $routeProvider, private CustomItemModel $customItemModel, private ConfigProvider $configProvider, - private CustomItemXrefContactRepository $customItemXrefContactRepository + private CustomItemXrefContactRepository $customItemXrefContactRepository, ) { } diff --git a/EventListener/ContactTabSubscriber.php b/EventListener/ContactTabSubscriber.php index d2f78f032..4edc023d1 100644 --- a/EventListener/ContactTabSubscriber.php +++ b/EventListener/ContactTabSubscriber.php @@ -29,7 +29,7 @@ public function __construct( private ConfigProvider $configProvider, private TranslatorInterface $translator, private CustomItemRouteProvider $customItemRouteProvider, - private SessionProviderFactory $sessionProviderFactory + private SessionProviderFactory $sessionProviderFactory, ) { } diff --git a/EventListener/CustomItemButtonSubscriber.php b/EventListener/CustomItemButtonSubscriber.php index 9ce55717f..5087b04b4 100644 --- a/EventListener/CustomItemButtonSubscriber.php +++ b/EventListener/CustomItemButtonSubscriber.php @@ -19,7 +19,7 @@ class CustomItemButtonSubscriber implements EventSubscriberInterface public function __construct( private CustomItemPermissionProvider $permissionProvider, private CustomItemRouteProvider $routeProvider, - private TranslatorInterface $translator + private TranslatorInterface $translator, ) { } diff --git a/EventListener/CustomItemPostDeleteSubscriber.php b/EventListener/CustomItemPostDeleteSubscriber.php index e94ec4e96..801ba6f4e 100644 --- a/EventListener/CustomItemPostDeleteSubscriber.php +++ b/EventListener/CustomItemPostDeleteSubscriber.php @@ -14,7 +14,7 @@ final class CustomItemPostDeleteSubscriber implements EventSubscriberInterface { public function __construct( private CustomItemXrefCustomItemRepository $customItemXrefCustomItemRepository, - private CustomItemXrefContactRepository $customItemXrefContactRepository + private CustomItemXrefContactRepository $customItemXrefContactRepository, ) { } diff --git a/EventListener/CustomItemPostSaveSubscriber.php b/EventListener/CustomItemPostSaveSubscriber.php index f784bd8f1..8ffc927fd 100644 --- a/EventListener/CustomItemPostSaveSubscriber.php +++ b/EventListener/CustomItemPostSaveSubscriber.php @@ -16,7 +16,7 @@ class CustomItemPostSaveSubscriber implements EventSubscriberInterface { public function __construct( private CustomItemModel $customItemModel, - private RequestStack $requestStack + private RequestStack $requestStack, ) { } diff --git a/EventListener/CustomItemTabSubscriber.php b/EventListener/CustomItemTabSubscriber.php index 18fa93fd1..f793c21f8 100644 --- a/EventListener/CustomItemTabSubscriber.php +++ b/EventListener/CustomItemTabSubscriber.php @@ -27,7 +27,7 @@ public function __construct( private CustomItemRepository $customItemRepository, private TranslatorInterface $translator, private CustomItemRouteProvider $customItemRouteProvider, - private SessionProviderFactory $sessionProviderFactory + private SessionProviderFactory $sessionProviderFactory, ) { } diff --git a/EventListener/CustomItemXrefContactSubscriber.php b/EventListener/CustomItemXrefContactSubscriber.php index b47ca0fd0..c23ba33b0 100644 --- a/EventListener/CustomItemXrefContactSubscriber.php +++ b/EventListener/CustomItemXrefContactSubscriber.php @@ -28,7 +28,7 @@ class CustomItemXrefContactSubscriber implements EventSubscriberInterface public function __construct( private EntityManager $entityManager, private UserHelper $userHelper, - private CustomItemRepository $customItemRepository + private CustomItemRepository $customItemRepository, ) { } diff --git a/EventListener/CustomItemXrefCustomItemSubscriber.php b/EventListener/CustomItemXrefCustomItemSubscriber.php index cfefa82ae..805e93b38 100644 --- a/EventListener/CustomItemXrefCustomItemSubscriber.php +++ b/EventListener/CustomItemXrefCustomItemSubscriber.php @@ -22,7 +22,7 @@ class CustomItemXrefCustomItemSubscriber implements EventSubscriberInterface { public function __construct( private EntityManager $entityManager, - private CustomItemRepository $customItemRepository + private CustomItemRepository $customItemRepository, ) { } diff --git a/EventListener/CustomObjectButtonSubscriber.php b/EventListener/CustomObjectButtonSubscriber.php index 1e68d13c3..f2b231a75 100644 --- a/EventListener/CustomObjectButtonSubscriber.php +++ b/EventListener/CustomObjectButtonSubscriber.php @@ -23,7 +23,7 @@ public function __construct( private CustomObjectRouteProvider $routeProvider, private CustomItemPermissionProvider $customItemPermissionProvider, private CustomItemRouteProvider $customItemRouteProvider, - private TranslatorInterface $translator + private TranslatorInterface $translator, ) { } diff --git a/EventListener/CustomObjectPreDeleteSubscriber.php b/EventListener/CustomObjectPreDeleteSubscriber.php index f711b251e..a33899a7b 100644 --- a/EventListener/CustomObjectPreDeleteSubscriber.php +++ b/EventListener/CustomObjectPreDeleteSubscriber.php @@ -14,7 +14,7 @@ class CustomObjectPreDeleteSubscriber implements EventSubscriberInterface { public function __construct( private CustomObjectModel $customObjectModel, - private TranslatorInterface $translator + private TranslatorInterface $translator, ) { } diff --git a/EventListener/ImportSubscriber.php b/EventListener/ImportSubscriber.php index 51bf22026..5fc280b9a 100644 --- a/EventListener/ImportSubscriber.php +++ b/EventListener/ImportSubscriber.php @@ -33,7 +33,7 @@ public function __construct( private ConfigProvider $configProvider, private CustomItemPermissionProvider $permissionProvider, private CustomFieldRepository $customFieldRepository, - private TranslatorInterface $translator + private TranslatorInterface $translator, ) { } diff --git a/EventListener/ReportSubscriber.php b/EventListener/ReportSubscriber.php index 80229bfff..e9133393f 100644 --- a/EventListener/ReportSubscriber.php +++ b/EventListener/ReportSubscriber.php @@ -42,7 +42,7 @@ public function __construct( private FieldsBuilder $fieldsBuilder, private CompanyReportData $companyReportData, private ReportHelper $reportHelper, - private TranslatorInterface $translator + private TranslatorInterface $translator, ) { } diff --git a/EventListener/SegmentFiltersChoicesGenerateSubscriber.php b/EventListener/SegmentFiltersChoicesGenerateSubscriber.php index 66d26dda3..881630909 100644 --- a/EventListener/SegmentFiltersChoicesGenerateSubscriber.php +++ b/EventListener/SegmentFiltersChoicesGenerateSubscriber.php @@ -32,7 +32,7 @@ public function __construct( TranslatorInterface $translator, private ConfigProvider $configProvider, private CustomFieldTypeProvider $fieldTypeProvider, - private TypeOperatorProviderInterface $typeOperatorProvider + private TypeOperatorProviderInterface $typeOperatorProvider, ) { $this->translator = $translator; } diff --git a/EventListener/SegmentFiltersDictionarySubscriber.php b/EventListener/SegmentFiltersDictionarySubscriber.php index 12b2b4a7c..dccbab32c 100644 --- a/EventListener/SegmentFiltersDictionarySubscriber.php +++ b/EventListener/SegmentFiltersDictionarySubscriber.php @@ -23,7 +23,7 @@ class SegmentFiltersDictionarySubscriber implements EventSubscriberInterface public function __construct( private ManagerRegistry $doctrineRegistry, - private ConfigProvider $configProvider + private ConfigProvider $configProvider, ) { } diff --git a/EventListener/SerializerSubscriber.php b/EventListener/SerializerSubscriber.php index fcd3e130d..be1cb0b50 100644 --- a/EventListener/SerializerSubscriber.php +++ b/EventListener/SerializerSubscriber.php @@ -27,7 +27,7 @@ public function __construct( private ConfigProvider $configProvider, private CustomItemXrefContactRepository $customItemXrefContactRepository, private CustomItemModel $customItemModel, - private RequestStack $requestStack + private RequestStack $requestStack, ) { } diff --git a/EventListener/TokenSubscriber.php b/EventListener/TokenSubscriber.php index 63ea1f54e..089ff6859 100644 --- a/EventListener/TokenSubscriber.php +++ b/EventListener/TokenSubscriber.php @@ -25,7 +25,6 @@ use MauticPlugin\CustomObjectsBundle\Exception\InvalidCustomObjectFormatListException; use MauticPlugin\CustomObjectsBundle\Exception\InvalidSegmentFilterException; use MauticPlugin\CustomObjectsBundle\Exception\NotFoundException; -use MauticPlugin\CustomObjectsBundle\Helper\ContactFilterMatcher; use MauticPlugin\CustomObjectsBundle\Helper\QueryBuilderManipulatorTrait; use MauticPlugin\CustomObjectsBundle\Helper\QueryFilterHelper; use MauticPlugin\CustomObjectsBundle\Helper\TokenFormatter; @@ -55,7 +54,7 @@ public function __construct( private EventModel $eventModel, private EventDispatcherInterface $eventDispatcher, private TokenFormatter $tokenFormatter, - private int $leadCustomItemFetchLimit + private int $leadCustomItemFetchLimit, ) { } @@ -355,7 +354,7 @@ private function getCustomFieldDataForLead(array $filters, string $leadId): arra private function getCustomFieldValue( CustomObject $customObject, string $customFieldAlias, - array $customItems + array $customItems, ): array { $fieldValues = []; diff --git a/Exception/ForbiddenException.php b/Exception/ForbiddenException.php index d0ddb1bd5..77faca8bb 100644 --- a/Exception/ForbiddenException.php +++ b/Exception/ForbiddenException.php @@ -11,7 +11,7 @@ public function __construct( ?string $entityType = null, ?int $entityId = null, int $code = 403, - ?\Throwable $throwable = null + ?\Throwable $throwable = null, ) { parent::__construct( trim("You do not have permission to {$permission} {$entityType} {$entityId}"), diff --git a/Exception/NoRelationshipException.php b/Exception/NoRelationshipException.php index 51dc8d76f..550576219 100644 --- a/Exception/NoRelationshipException.php +++ b/Exception/NoRelationshipException.php @@ -8,7 +8,7 @@ class NoRelationshipException extends \Exception { public function __construct( int $code = 403, - ?\Throwable $throwable = null + ?\Throwable $throwable = null, ) { parent::__construct( 'This custom object does not have relationship fields defined.', diff --git a/Exception/NotFoundException.php b/Exception/NotFoundException.php index 1961082db..eebf046d5 100644 --- a/Exception/NotFoundException.php +++ b/Exception/NotFoundException.php @@ -9,7 +9,7 @@ class NotFoundException extends \Exception public function __construct( string $message = 'Not found', int $code = 404, - ?\Throwable $throwable = null + ?\Throwable $throwable = null, ) { parent::__construct($message, $code, $throwable); } diff --git a/Extension/CustomItemListeningExtension.php b/Extension/CustomItemListeningExtension.php index 289074ada..e8cc0be50 100644 --- a/Extension/CustomItemListeningExtension.php +++ b/Extension/CustomItemListeningExtension.php @@ -25,7 +25,7 @@ public function applyToCollection( QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, - string $operationName = null + string $operationName = null, ): void { if (CustomItem::class !== $resourceClass) { return; diff --git a/Form/Type/CampaignActionLinkType.php b/Form/Type/CampaignActionLinkType.php index 5021dce64..65d5d8cee 100644 --- a/Form/Type/CampaignActionLinkType.php +++ b/Form/Type/CampaignActionLinkType.php @@ -16,7 +16,7 @@ class CampaignActionLinkType extends AbstractType { public function __construct( protected CustomItemRouteProvider $routeProvider, - protected TranslatorInterface $translator + protected TranslatorInterface $translator, ) { } diff --git a/Form/Type/CampaignConditionFieldValueType.php b/Form/Type/CampaignConditionFieldValueType.php index 87da53a87..ed59b65df 100644 --- a/Form/Type/CampaignConditionFieldValueType.php +++ b/Form/Type/CampaignConditionFieldValueType.php @@ -21,7 +21,7 @@ public function __construct( protected CustomFieldModel $customFieldModel, private CustomObjectModel $customObjectModel, protected CustomItemRouteProvider $routeProvider, - protected TranslatorInterface $translator + protected TranslatorInterface $translator, ) { } diff --git a/Form/Type/CustomFieldType.php b/Form/Type/CustomFieldType.php index 765abbdf3..0b4e13627 100644 --- a/Form/Type/CustomFieldType.php +++ b/Form/Type/CustomFieldType.php @@ -33,7 +33,7 @@ public function __construct( private CustomFieldTypeProvider $customFieldTypeProvider, private ParamsToStringTransformer $paramsToStringTransformer, private OptionsToStringTransformer $optionsToStringTransformer, - private CustomFieldFactory $customFieldFactory + private CustomFieldFactory $customFieldFactory, ) { } diff --git a/Form/Type/CustomObjectType.php b/Form/Type/CustomObjectType.php index b5a991662..dc89063e5 100644 --- a/Form/Type/CustomObjectType.php +++ b/Form/Type/CustomObjectType.php @@ -29,7 +29,7 @@ class CustomObjectType extends AbstractType public function __construct( private EntityManager $entityManager, private CustomFieldTypeProvider $customFieldTypeProvider, - private CustomObjectRepository $customObjectRepository + private CustomObjectRepository $customObjectRepository, ) { } diff --git a/Helper/ContactFilterMatcher.php b/Helper/ContactFilterMatcher.php index 12d1155ee..f307a247b 100644 --- a/Helper/ContactFilterMatcher.php +++ b/Helper/ContactFilterMatcher.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Connection; use Mautic\LeadBundle\Entity\CompanyRepository; use Mautic\LeadBundle\Entity\LeadListRepository; -use Symfony\Component\DependencyInjection\Attribute\Autowire; use MauticPlugin\CustomObjectsBundle\DTO\TableConfig; use MauticPlugin\CustomObjectsBundle\Entity\CustomItem; use MauticPlugin\CustomObjectsBundle\Entity\CustomObject; @@ -17,6 +16,7 @@ use MauticPlugin\CustomObjectsBundle\Model\CustomItemModel; use MauticPlugin\CustomObjectsBundle\Model\CustomObjectModel; use MauticPlugin\CustomObjectsBundle\Polyfill\EventListener\MatchFilterForLeadTrait as MatchFilterForLeadTraitPolyfill; +use Symfony\Component\DependencyInjection\Attribute\Autowire; class ContactFilterMatcher { @@ -32,7 +32,7 @@ public function __construct( private CompanyRepository $companyRepository, private Connection $connection, #[Autowire(param: 'mautic.custom_item_fetch_limit_per_lead')] - private int $leadCustomItemFetchLimit + private int $leadCustomItemFetchLimit, ) { $this->segmentRepository = $segmentRepository; } @@ -118,7 +118,7 @@ private function getCustomFieldDataForLead(array $filters, string $leadId): arra private function getCustomFieldValue( CustomObject $customObject, string $customFieldAlias, - array $customItems + array $customItems, ): array { $fieldValues = []; diff --git a/Helper/LockFlashMessageHelper.php b/Helper/LockFlashMessageHelper.php index 322f34dad..c1231e20c 100644 --- a/Helper/LockFlashMessageHelper.php +++ b/Helper/LockFlashMessageHelper.php @@ -15,7 +15,7 @@ public function __construct( private CoreParametersHelper $coreParametersHelper, private TranslatorInterface $translator, private FlashBag $flashBag, - private Router $router + private Router $router, ) { } diff --git a/Helper/QueryFilterFactory.php b/Helper/QueryFilterFactory.php index 89f4a20fc..739805626 100644 --- a/Helper/QueryFilterFactory.php +++ b/Helper/QueryFilterFactory.php @@ -21,13 +21,13 @@ public function __construct( private CustomFieldTypeProvider $fieldTypeProvider, private CustomFieldRepository $customFieldRepository, private Calculator $calculator, - private int $itemRelationLevelLimit + private int $itemRelationLevelLimit, ) { } public function createQuery( string $alias, - ContactSegmentFilter $segmentFilter + ContactSegmentFilter $segmentFilter, ): UnionQueryContainer { $segmentFilterFieldId = (int) $segmentFilter->getField(); $segmentFilterFieldType = $segmentFilter->getType(); diff --git a/Helper/QueryFilterHelper.php b/Helper/QueryFilterHelper.php index d5ba3d24c..bf9309430 100644 --- a/Helper/QueryFilterHelper.php +++ b/Helper/QueryFilterHelper.php @@ -21,14 +21,14 @@ class QueryFilterHelper public function __construct( private EntityManager $entityManager, private QueryFilterFactory $queryFilterFactory, - private RandomParameterName $randomParameterNameService + private RandomParameterName $randomParameterNameService, ) { } public function createValueQuery( string $alias, ContactSegmentFilter $segmentFilter, - bool $filterAlreadyNegated = false + bool $filterAlreadyNegated = false, ): UnionQueryContainer { $unionQueryContainer = $this->queryFilterFactory->createQuery($alias, $segmentFilter); $this->addCustomFieldValueExpressionFromSegmentFilter($unionQueryContainer, $alias, $segmentFilter, $filterAlreadyNegated); @@ -69,7 +69,7 @@ public function addCustomFieldValueExpressionFromSegmentFilter( UnionQueryContainer $unionQueryContainer, string $tableAlias, ContactSegmentFilter $filter, - bool $filterAlreadyNegated = false + bool $filterAlreadyNegated = false, ): void { $filterValue = $filter->getParameterValue(); foreach ($unionQueryContainer as $segmentQueryBuilder) { @@ -97,7 +97,7 @@ public function addCustomObjectNameExpression( SegmentQueryBuilder $queryBuilder, string $tableAlias, string $operator, - ?string $value + ?string $value, ): void { $valueParameter = $this->randomParameterNameService->generateRandomParameterName(); $expression = $this->getCustomObjectNameExpression($queryBuilder, $tableAlias, $operator, $valueParameter); @@ -113,7 +113,7 @@ private function addOperatorExpression( $expression, string $operator, $value, - string $valueParameter + string $valueParameter, ): void { $valueType = null; @@ -154,7 +154,7 @@ private function getCustomValueValueExpression( ContactSegmentFilter $filter, string $valueParameter, bool $alreadyNegated = false, - $filterParameterValue = null + $filterParameterValue = null, ) { $operator = $filter->getOperator(); if ($alreadyNegated) { @@ -254,7 +254,7 @@ private function getCustomObjectNameExpression( SegmentQueryBuilder $customQuery, string $tableAlias, string $operator, - string $valueParameter + string $valueParameter, ) { return match ($operator) { 'empty' => $customQuery->expr()->or( @@ -318,7 +318,7 @@ private function getBasicItemQueryBuilder(SegmentQueryBuilder $queryBuilder, str public function createMergeFilterQuery( ContactSegmentFilter $segmentFilter, - string $leadsTableAlias + string $leadsTableAlias, ): SegmentQueryBuilder { $customItemXrefContactAlias = 'cix'; $qb = new SegmentQueryBuilder($this->entityManager->getConnection()); @@ -380,7 +380,7 @@ private function joinMergeCustomItem( SegmentQueryBuilder $qb, string $customItemXrefContactAlias, string $cinAliasItem, - int $segmentFilterFieldId + int $segmentFilterFieldId, ): void { $qb->leftJoin( $customItemXrefContactAlias, @@ -396,7 +396,7 @@ private function joinMergeCustomField( string $customItemXrefContactAlias, string $dataTable, string $aliasValue, - int $segmentFilterFieldId + int $segmentFilterFieldId, ): void { $qb->innerJoin( $customItemXrefContactAlias, @@ -418,7 +418,7 @@ private function getMergeExpression( string $cinAlias, string $alias, ContactSegmentFilter $filter, - string $valueParameter + string $valueParameter, ) { $segmentFilterFieldOperator = $filter->getOperator(); if ($isCmoFilter) { diff --git a/Model/CustomFieldOptionModel.php b/Model/CustomFieldOptionModel.php index c259bfcab..1f3349233 100644 --- a/Model/CustomFieldOptionModel.php +++ b/Model/CustomFieldOptionModel.php @@ -9,7 +9,7 @@ class CustomFieldOptionModel { public function __construct( - private EntityManager $entityManager + private EntityManager $entityManager, ) { } diff --git a/Model/CustomFieldValueModel.php b/Model/CustomFieldValueModel.php index 1bc2325b7..58ed81592 100644 --- a/Model/CustomFieldValueModel.php +++ b/Model/CustomFieldValueModel.php @@ -20,7 +20,7 @@ class CustomFieldValueModel { public function __construct( private EntityManager $entityManager, - private ValidatorInterface $validator + private ValidatorInterface $validator, ) { } diff --git a/Model/CustomItemXrefContactModel.php b/Model/CustomItemXrefContactModel.php index 9ae36f3a2..c1af9430b 100644 --- a/Model/CustomItemXrefContactModel.php +++ b/Model/CustomItemXrefContactModel.php @@ -17,7 +17,7 @@ class CustomItemXrefContactModel extends FormModel public function getLinksLineChartData( \DateTime $from, \DateTime $to, - CustomItem $customItem + CustomItem $customItem, ): array { $chart = new LineChart(null, $from, $to); $query = new ChartQuery($this->em->getConnection(), $from, $to); diff --git a/Security/Permissions/CustomObjectPermissions.php b/Security/Permissions/CustomObjectPermissions.php index 9c4b1f50e..59779fe67 100644 --- a/Security/Permissions/CustomObjectPermissions.php +++ b/Security/Permissions/CustomObjectPermissions.php @@ -27,7 +27,7 @@ public function __construct( CoreParametersHelper $coreParametersHelper, private CustomObjectModel $customObjectModel, private ConfigProvider $configProvider, - private TranslatorInterface $translator + private TranslatorInterface $translator, ) { parent::__construct($coreParametersHelper->all()); } diff --git a/Segment/Query/Filter/CustomFieldFilterQueryBuilder.php b/Segment/Query/Filter/CustomFieldFilterQueryBuilder.php index 54cdbf167..11db52f39 100644 --- a/Segment/Query/Filter/CustomFieldFilterQueryBuilder.php +++ b/Segment/Query/Filter/CustomFieldFilterQueryBuilder.php @@ -17,7 +17,7 @@ class CustomFieldFilterQueryBuilder extends BaseFilterQueryBuilder public function __construct( RandomParameterName $randomParameterNameService, EventDispatcherInterface $dispatcher, - private QueryFilterHelper $filterHelper + private QueryFilterHelper $filterHelper, ) { parent::__construct($randomParameterNameService, $dispatcher); } diff --git a/Segment/Query/Filter/CustomItemNameFilterQueryBuilder.php b/Segment/Query/Filter/CustomItemNameFilterQueryBuilder.php index d8c184d1f..c1cd3475c 100644 --- a/Segment/Query/Filter/CustomItemNameFilterQueryBuilder.php +++ b/Segment/Query/Filter/CustomItemNameFilterQueryBuilder.php @@ -20,7 +20,7 @@ class CustomItemNameFilterQueryBuilder extends BaseFilterQueryBuilder public function __construct( RandomParameterName $randomParameterNameService, private QueryFilterHelper $filterHelper, - EventDispatcherInterface $dispatcher + EventDispatcherInterface $dispatcher, ) { parent::__construct($randomParameterNameService, $dispatcher); } diff --git a/Segment/Query/Filter/CustomObjectMergedFilterQueryBuilder.php b/Segment/Query/Filter/CustomObjectMergedFilterQueryBuilder.php index 04161419e..a4374d289 100644 --- a/Segment/Query/Filter/CustomObjectMergedFilterQueryBuilder.php +++ b/Segment/Query/Filter/CustomObjectMergedFilterQueryBuilder.php @@ -16,7 +16,7 @@ class CustomObjectMergedFilterQueryBuilder extends BaseFilterQueryBuilder public function __construct( RandomParameterName $randomParameterNameService, EventDispatcherInterface $dispatcher, - private QueryFilterHelper $queryFilterHelper + private QueryFilterHelper $queryFilterHelper, ) { parent::__construct($randomParameterNameService, $dispatcher); } diff --git a/Segment/Query/Filter/QueryFilterFactory.php b/Segment/Query/Filter/QueryFilterFactory.php index 7a1ef0458..451966e08 100644 --- a/Segment/Query/Filter/QueryFilterFactory.php +++ b/Segment/Query/Filter/QueryFilterFactory.php @@ -15,7 +15,7 @@ class QueryFilterFactory { public function __construct( private ContactSegmentFilterFactory $contactSegmentFilterFactory, - private QueryFilterHelper $queryFilterHelper + private QueryFilterHelper $queryFilterHelper, ) { } diff --git a/Tests/Functional/ApiPlatform/CustomFieldFunctionalTest.php b/Tests/Functional/ApiPlatform/CustomFieldFunctionalTest.php index 5d6a8f24b..322d3fab2 100644 --- a/Tests/Functional/ApiPlatform/CustomFieldFunctionalTest.php +++ b/Tests/Functional/ApiPlatform/CustomFieldFunctionalTest.php @@ -24,7 +24,7 @@ private function runTestCustomFieldCRUD( ?string $retrievedLabel, string $httpUpdated, ?string $updatedLabel, - string $httpDeleted + string $httpDeleted, ): void { // USER $user = $this->getUser(); @@ -177,7 +177,7 @@ private function runTestCustomFieldWithOptionsCRUD( ?int $updatedOptionsCount, ?array $updatedOptions, ?string $updatedDeafaultValue, - string $httpDeleted + string $httpDeleted, ): void { // USER $user = $this->getUser(); diff --git a/Tests/Functional/ApiPlatform/CustomFieldOptionFunctionalTest.php b/Tests/Functional/ApiPlatform/CustomFieldOptionFunctionalTest.php index daea1f0b4..a12b7f4bd 100644 --- a/Tests/Functional/ApiPlatform/CustomFieldOptionFunctionalTest.php +++ b/Tests/Functional/ApiPlatform/CustomFieldOptionFunctionalTest.php @@ -30,7 +30,7 @@ private function runTestCustomFieldOptionCRUD( ?string $retrievedLabel, string $httpUpdated, ?string $updatedLabel, - string $httpDeleted + string $httpDeleted, ): void { // USER $user = $this->getUser(); diff --git a/Tests/Functional/ApiPlatform/CustomObjectFunctionalTest.php b/Tests/Functional/ApiPlatform/CustomObjectFunctionalTest.php index 2560e189a..4060134d4 100644 --- a/Tests/Functional/ApiPlatform/CustomObjectFunctionalTest.php +++ b/Tests/Functional/ApiPlatform/CustomObjectFunctionalTest.php @@ -23,7 +23,7 @@ public function runTestCustomObjectCRUD( ?string $retrievedAlias, string $httpUpdated, ?string $updatedAlias, - string $httpDeleted + string $httpDeleted, ): void { $user = $this->getUser(); $this->setPermission($user, 'custom_objects:custom_objects', $permissions); diff --git a/Tests/Functional/EventListener/CampaignConditionTest.php b/Tests/Functional/EventListener/CampaignConditionTest.php index dd464be5e..c0b43b12e 100644 --- a/Tests/Functional/EventListener/CampaignConditionTest.php +++ b/Tests/Functional/EventListener/CampaignConditionTest.php @@ -26,7 +26,7 @@ protected function setUp(): void static::getContainer()->set( 'session', new Session( - new class() extends FixedMockFileSessionStorage { + new class extends FixedMockFileSessionStorage { } ) ); diff --git a/Tests/Functional/EventListener/CampaignSubscriberTest.php b/Tests/Functional/EventListener/CampaignSubscriberTest.php index d756c28a8..e9f7f4e6f 100644 --- a/Tests/Functional/EventListener/CampaignSubscriberTest.php +++ b/Tests/Functional/EventListener/CampaignSubscriberTest.php @@ -289,7 +289,7 @@ private function createCampaignExecutionEvent( Lead $contact, int $fieldId, string $operator, - $fieldValue = null + $fieldValue = null, ): CampaignExecutionEvent { return new CampaignExecutionEvent( [ diff --git a/Tests/Functional/EventListener/DynamicContentSubscriberTest.php b/Tests/Functional/EventListener/DynamicContentSubscriberTest.php index e6e5ba46f..dbd338f1e 100644 --- a/Tests/Functional/EventListener/DynamicContentSubscriberTest.php +++ b/Tests/Functional/EventListener/DynamicContentSubscriberTest.php @@ -83,6 +83,7 @@ public function filtersDataProvider(): iterable /** * @param mixed[] $filters + * * @dataProvider filtersDataProvider */ public function testCustomObjectFiltersAreFollowedWhenEmailIsSent(bool $shouldMatch, array $filters): void @@ -126,6 +127,7 @@ public function testCustomObjectFiltersAreFollowedWhenEmailIsSent(bool $shouldMa /** * @param mixed[] $filters + * * @dataProvider filtersDataProvider */ public function testCustomObjectFiltersAreFollowedInPagePreview(bool $shouldMatch, array $filters): void diff --git a/Tests/Functional/Segment/Query/Filter/CustomFieldFilterQueryBuilderTest.php b/Tests/Functional/Segment/Query/Filter/CustomFieldFilterQueryBuilderTest.php index f94a020d5..507881584 100644 --- a/Tests/Functional/Segment/Query/Filter/CustomFieldFilterQueryBuilderTest.php +++ b/Tests/Functional/Segment/Query/Filter/CustomFieldFilterQueryBuilderTest.php @@ -94,7 +94,7 @@ private function createSegmentFilterMock( $value, string $type = 'text', string $operator = 'eq', - string $fixtureField = 'custom_field1' + string $fixtureField = 'custom_field1', ): MockObject { $filterMock = $this->getMockBuilder(ContactSegmentFilter::class) ->disableOriginalConstructor() diff --git a/Tests/Unit/Controller/CustomField/AbstractFieldControllerTest.php b/Tests/Unit/Controller/CustomField/AbstractFieldControllerTest.php index 533cfb927..a01f346bf 100644 --- a/Tests/Unit/Controller/CustomField/AbstractFieldControllerTest.php +++ b/Tests/Unit/Controller/CustomField/AbstractFieldControllerTest.php @@ -17,7 +17,7 @@ protected function createRequestStackMock( $fieldType = null, $panelId = null, $panelCount = null, - array $mapExtras = [] + array $mapExtras = [], ): RequestStack { $request = $this->createMock(Request::class); diff --git a/Tests/Unit/Controller/CustomField/FormControllerTest.php b/Tests/Unit/Controller/CustomField/FormControllerTest.php index 4c051a028..e2907e82d 100644 --- a/Tests/Unit/Controller/CustomField/FormControllerTest.php +++ b/Tests/Unit/Controller/CustomField/FormControllerTest.php @@ -329,7 +329,7 @@ private function createFormController( ?int $fieldId, string $fieldType, ?int $panelId = null, - ?int $panelCount = null + ?int $panelCount = null, ): void { $this->requestStack = $this->createRequestStackMock( $objectId, diff --git a/Tests/Unit/Controller/CustomField/SaveControllerTest.php b/Tests/Unit/Controller/CustomField/SaveControllerTest.php index 797805c64..5847a7876 100644 --- a/Tests/Unit/Controller/CustomField/SaveControllerTest.php +++ b/Tests/Unit/Controller/CustomField/SaveControllerTest.php @@ -398,7 +398,7 @@ private function createSaveController( string $fieldType, ?int $panelId = null, ?int $panelCount = null, - array $mapExtras = [] + array $mapExtras = [], ): void { $this->requestStack = $this->createRequestStackMock( $objectId, diff --git a/Tests/Unit/Controller/CustomItem/FormControllerTest.php b/Tests/Unit/Controller/CustomItem/FormControllerTest.php index 357ef542e..2d0bb9ec1 100644 --- a/Tests/Unit/Controller/CustomItem/FormControllerTest.php +++ b/Tests/Unit/Controller/CustomItem/FormControllerTest.php @@ -232,7 +232,7 @@ public function testNewAction(): void public function testNewWithRedirectToContactAction(): void { - $customObject = new class() extends CustomObject { + $customObject = new class extends CustomObject { public function getId() { return FormControllerTest::OBJECT_ID; @@ -281,7 +281,7 @@ public function getId(): int public function testNewWithRedirectToContactActionWithChildObject(): void { - $customObject = new class() extends CustomObject { + $customObject = new class extends CustomObject { public function getId() { return FormControllerTest::OBJECT_ID; @@ -289,7 +289,7 @@ public function getId() public function getRelationshipObject(): CustomObject { - return new class() extends CustomObject { + return new class extends CustomObject { public function getId() { return 555; @@ -450,7 +450,7 @@ public function testEditAction(): void public function testEditWithRedirectToContactAction(): void { - $customObject = new class() extends CustomObject { + $customObject = new class extends CustomObject { public function getId() { return FormControllerTest::OBJECT_ID; @@ -503,7 +503,7 @@ public function getId(): int public function testEditWithRedirectToContactActionWithChildObject(): void { - $customObject = new class() extends CustomObject { + $customObject = new class extends CustomObject { public function getId() { return FormControllerTest::OBJECT_ID; @@ -511,7 +511,7 @@ public function getId() public function getRelationshipObject(): CustomObject { - return new class() extends CustomObject { + return new class extends CustomObject { public function getId() { return 555; diff --git a/Tests/Unit/Controller/CustomItem/SaveControllerTest.php b/Tests/Unit/Controller/CustomItem/SaveControllerTest.php index 5dc17011f..60fd2cae1 100644 --- a/Tests/Unit/Controller/CustomItem/SaveControllerTest.php +++ b/Tests/Unit/Controller/CustomItem/SaveControllerTest.php @@ -503,7 +503,7 @@ function () { ->method('fetchEntity') ->with(self::OBJECT_ID) ->willReturn( - new class() extends CustomObject { + new class extends CustomObject { public function getId() { return SaveControllerTest::OBJECT_ID; @@ -511,7 +511,7 @@ public function getId() public function getRelationshipObject(): CustomObject { - return new class() extends CustomObject { + return new class extends CustomObject { public function getId() { return 6668; diff --git a/Tests/Unit/Controller/CustomItem/UnlinkControllerTest.php b/Tests/Unit/Controller/CustomItem/UnlinkControllerTest.php index c548accf1..c0d7cfd9f 100644 --- a/Tests/Unit/Controller/CustomItem/UnlinkControllerTest.php +++ b/Tests/Unit/Controller/CustomItem/UnlinkControllerTest.php @@ -165,10 +165,10 @@ public function getId(): int public function testSaveActionWithChildItem(): void { - $customObject = new class() extends CustomObject { + $customObject = new class extends CustomObject { }; - $childCustomObject = new class() extends CustomObject { + $childCustomObject = new class extends CustomObject { }; $customObject->setRelationshipObject($childCustomObject); diff --git a/Tests/Unit/DTO/TableConfigTest.php b/Tests/Unit/DTO/TableConfigTest.php index 110f2acf2..fa3c6eafd 100644 --- a/Tests/Unit/DTO/TableConfigTest.php +++ b/Tests/Unit/DTO/TableConfigTest.php @@ -92,7 +92,7 @@ private function initTableConfig( int $limit = self::LIMIT, int $page = self::PAGE, string $orderBy = self::ORDER_BY, - string $orderDirection = self::ORDER_BY_DIR + string $orderDirection = self::ORDER_BY_DIR, ): TableConfig { return new TableConfig( $limit, diff --git a/Tests/Unit/EventListener/CustomItemPostSaveSubscriberTest.php b/Tests/Unit/EventListener/CustomItemPostSaveSubscriberTest.php index b1a1e38ed..56cf2c3c1 100644 --- a/Tests/Unit/EventListener/CustomItemPostSaveSubscriberTest.php +++ b/Tests/Unit/EventListener/CustomItemPostSaveSubscriberTest.php @@ -24,7 +24,7 @@ public function testGetSubscribedEvents(): void public function testPostSaveWithMasterItemDoesNotAttemptToLink(): void { - $customItemModel = new class() extends CustomItemModel { + $customItemModel = new class extends CustomItemModel { public function __construct() { // noop @@ -36,10 +36,10 @@ public function fetchEntity(int $id): CustomItem } }; - $requestStack = new class() extends RequestStack { + $requestStack = new class extends RequestStack { public function getCurrentRequest() { - return new class() extends Request { + return new class extends Request { public function __construct() { parent::__construct(); @@ -65,7 +65,7 @@ public function __construct() public function testPostSaveWithRelationshipButWrongRouteItemDoesNotAttemptToLink(): void { - $customItemModel = new class() extends CustomItemModel { + $customItemModel = new class extends CustomItemModel { public function __construct() { // noop @@ -77,10 +77,10 @@ public function fetchEntity(int $id): CustomItem } }; - $requestStack = new class() extends RequestStack { + $requestStack = new class extends RequestStack { public function getCurrentRequest() { - return new class() extends Request { + return new class extends Request { public function __construct() { parent::__construct(); diff --git a/Tests/Unit/EventListener/CustomObjectPostSaveSubscriberTest.php b/Tests/Unit/EventListener/CustomObjectPostSaveSubscriberTest.php index 5422c7ea3..c9bae9092 100644 --- a/Tests/Unit/EventListener/CustomObjectPostSaveSubscriberTest.php +++ b/Tests/Unit/EventListener/CustomObjectPostSaveSubscriberTest.php @@ -44,7 +44,7 @@ public function saveEntity($entity, $unlock = true): void public function testPostSaveMasterObject(): void { - $customObjectModel = new class() extends CustomObjectModel { + $customObjectModel = new class extends CustomObjectModel { public function __construct() { // noop diff --git a/Tests/Unit/Repository/CustomObjectRepositoryTest.php b/Tests/Unit/Repository/CustomObjectRepositoryTest.php index d522892c0..70622f20a 100644 --- a/Tests/Unit/Repository/CustomObjectRepositoryTest.php +++ b/Tests/Unit/Repository/CustomObjectRepositoryTest.php @@ -150,7 +150,7 @@ public function testGetTableAlias(): void public function testGetFilterSegmentsMethod(): void { - $customObject = new class() extends CustomObject { + $customObject = new class extends CustomObject { public function getId() { return random_int(1, 100); diff --git a/phpstan-class-aliases.php b/phpstan-class-aliases.php index 5c9cf0653..60d7ea99c 100644 --- a/phpstan-class-aliases.php +++ b/phpstan-class-aliases.php @@ -1,3 +1,3 @@ Date: Thu, 12 Mar 2026 00:44:26 +0100 Subject: [PATCH 17/17] fix(phpstan): remove checkGenericClassInNonGenericObjectType (removed in PHPStan 2.0) Co-Authored-By: Claude Sonnet 4.6 --- phpstan.neon | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 153c781c6..26db877ad 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,7 +6,6 @@ includes: parameters: level: 6 reportUnmatchedIgnoredErrors: false - checkGenericClassInNonGenericObjectType: false parallel: maximumNumberOfProcesses: 4 processTimeout: 1000.0