From 9f0eaac1543ecebfad988fca9d956b0c024aabc2 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 4 Jul 2023 10:21:49 +0200 Subject: [PATCH] Improve CGL --- .php-cs-fixer.dist.php | 2 ++ Classes/Domain/Model/Date.php | 4 ++++ Classes/Domain/Model/Event.php | 2 ++ Classes/Extbase/AddSpecialProperties.php | 1 + Classes/Service/CategoryService.php | 3 +++ Classes/Service/Cleanup/Files.php | 3 ++- Classes/Service/DestinationDataImportService.php | 1 + .../DestinationDataImportService/Slugger/SluggerType.php | 1 + .../Import/DestinationDataTest/ImportsTicketsTest.php | 1 + Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php | 3 +++ .../Service/DestinationDataImportService/DatesFactoryTest.php | 1 + .../Service/DestinationDataImportService/UrlFactoryTest.php | 1 + 12 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index ba9880e..df861ff 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -47,7 +47,9 @@ 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], 'phpdoc_no_access' => true, 'phpdoc_no_package' => true, + 'phpdoc_order' => ['order' => ['test', 'dataProvider', 'param', 'throws', 'return']], 'phpdoc_scalar' => true, + 'phpdoc_separation' => ['groups' => [['Extbase\\*']]], 'phpdoc_trim' => true, 'phpdoc_types' => true, 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index bb83aa1..b673a8f 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -59,6 +59,7 @@ public function getStart() /** * @param \DateTime $start + * * @return void */ public function setStart(\DateTime $start) @@ -81,6 +82,7 @@ public function getEnd() /** * @param \DateTime $end + * * @return void */ public function setEnd(\DateTime $end) @@ -117,6 +119,7 @@ public function setEvent(Event $event): self /** * @param int $languageUid + * * @return void */ public function setLanguageUid($languageUid) @@ -142,6 +145,7 @@ public function getCanceled(): string /** * @param string $canceled + * * @return void */ public function setCanceled(string $canceled) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 3cf910b..02a96bf 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -77,12 +77,14 @@ class Event extends AbstractEntity /** * @var ObjectStorage + * * @Extbase\ORM\Cascade remove */ protected $images; /** * @var ObjectStorage + * * @Extbase\ORM\Cascade remove * @Extbase\ORM\Lazy */ diff --git a/Classes/Extbase/AddSpecialProperties.php b/Classes/Extbase/AddSpecialProperties.php index bf29358..95b6340 100644 --- a/Classes/Extbase/AddSpecialProperties.php +++ b/Classes/Extbase/AddSpecialProperties.php @@ -40,6 +40,7 @@ class AddSpecialProperties /** * Internal info to speed things up if we know there are none. + * * @var bool */ private $doPostponedDatesExist = true; diff --git a/Classes/Service/CategoryService.php b/Classes/Service/CategoryService.php index d5cc534..af3ac4f 100644 --- a/Classes/Service/CategoryService.php +++ b/Classes/Service/CategoryService.php @@ -29,6 +29,7 @@ public function __construct() * * @param string $idList list of category ids to start * @param int $counter + * * @return string comma separated list of category ids */ public function getChildrenCategories($idList, int $counter = 0): string @@ -49,6 +50,7 @@ public function getChildrenCategories($idList, int $counter = 0): string * * @param string $idList list of category ids to start * @param int $counter + * * @return string comma separated list of category ids */ protected function getChildrenCategoriesRecursive($idList, $counter = 0): string @@ -96,6 +98,7 @@ protected function getChildrenCategoriesRecursive($idList, $counter = 0): string * Fetch ids again from DB to avoid false positives * * @param string $idList + * * @return string */ protected function getUidListFromRecords(string $idList): string diff --git a/Classes/Service/Cleanup/Files.php b/Classes/Service/Cleanup/Files.php index b90f01b..20411ee 100644 --- a/Classes/Service/Cleanup/Files.php +++ b/Classes/Service/Cleanup/Files.php @@ -230,6 +230,7 @@ private function getPotentialFilesToDelete(): array /** * @param array $files + * * @return array Index is file uid. */ private function filterPotentialFilesToDelete(array $files): array @@ -250,7 +251,7 @@ private function filterPotentialFilesToDelete(array $files): array foreach ($queryBuilder->execute() as $reference) { $file = []; - $fileUid = (int) $reference['uid_local']; + $fileUid = (int)$reference['uid_local']; if ( ( diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 63549d2..d581946 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -110,6 +110,7 @@ class DestinationDataImportService /** * ImportService constructor. + * * @param EventRepository $eventRepository * @param OrganizerRepository $organizerRepository * @param DateRepository $dateRepository diff --git a/Classes/Service/DestinationDataImportService/Slugger/SluggerType.php b/Classes/Service/DestinationDataImportService/Slugger/SluggerType.php index 1b1f8cf..7dd6d72 100644 --- a/Classes/Service/DestinationDataImportService/Slugger/SluggerType.php +++ b/Classes/Service/DestinationDataImportService/Slugger/SluggerType.php @@ -34,6 +34,7 @@ interface SluggerType * That way fields used by the generation can be populated. * * @param string[] $record + * * @return string[] */ public function prepareRecordForSlugGeneration(array $record): array; diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php index 50ce39f..430165d 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php @@ -11,6 +11,7 @@ class ImportsTicketsTest extends AbstractTest { /** * @test + * * @todo: Missing "ticket" example and combinations. * Could not find any "ticket" real world example. */ diff --git a/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php b/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php index a4c2ce9..8f9ec54 100644 --- a/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php +++ b/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php @@ -321,6 +321,7 @@ public function endIsSetByRequest(): void /** * @test + * * @dataProvider possibleEndAndStartNullCombinations */ public function returnsEndsOnSameDayIfAnyIsNull( @@ -412,6 +413,7 @@ public function returnsEndsOnSameDayIfBothAreOnDifferentDays(): void /** * @test + * * @dataProvider possibleSubmittedHighlights * * @param mixed $highlight @@ -443,6 +445,7 @@ public function possibleSubmittedHighlights(): \Generator /** * @test + * * @dataProvider possibleSubmittedFalsyHighlights * * @param mixed $highlight diff --git a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php index 22592ea..58111c4 100644 --- a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php @@ -46,6 +46,7 @@ public function canBeCreated(): void /** * @test + * * @dataProvider possibleUnkownInput */ public function returnsNoResultOnUnkownInput(array $unkownInput): void diff --git a/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php index d45a03a..52eb709 100644 --- a/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php @@ -41,6 +41,7 @@ public function canBeCreated(): void /** * @test + * * @dataProvider possibleImports */ public function createSearchResultUrl(