From 8695099819fa3f2d61cf2b665167980be1e52d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 5 Mar 2023 17:43:44 +0100 Subject: [PATCH] DX: fix phstan & cs --- phpstan-baseline-level-2.neon | 5 - phpstan-baseline-level-3.neon | 69 ---------- phpstan-baseline-level-4.neon | 119 ------------------ phpstan-baseline-level-5.neon | 20 --- phpstan-types.neon | 5 - .../Entity/ActivityReasonRender.php | 10 +- .../src/Templating/Entity/CategoryRender.php | 12 +- .../Templating/BudgetElementTypeRender.php | 3 + src/Bundle/ChillMainBundle/Entity/Country.php | 41 ++---- .../Entity/Embeddable/CommentEmbeddable.php | 5 +- .../Entity/AbstractChillEntityRender.php | 13 +- .../Templating/Entity/AddressRender.php | 33 ++--- .../Entity/BoxUtilsChillEntityRenderTrait.php | 25 ++++ .../Templating/Entity/ChillEntityRender.php | 4 +- .../Entity/ChillEntityRenderInterface.php | 10 +- .../Templating/Entity/CommentRender.php | 22 ++-- .../Templating/Entity/UserRender.php | 6 +- .../migrations/Version20230301155213.php | 7 ++ .../Templating/Entity/ClosingMotiveRender.php | 16 +-- .../Templating/Entity/PersonRender.php | 11 +- .../Entity/PersonRenderInterface.php | 3 + .../Templating/Entity/ResourceKindRender.php | 3 + .../Templating/Entity/SocialActionRender.php | 3 + .../Templating/Entity/SocialIssueRender.php | 9 +- .../Templating/Entity/ThirdPartyRender.php | 14 +-- 25 files changed, 119 insertions(+), 349 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Templating/Entity/BoxUtilsChillEntityRenderTrait.php diff --git a/phpstan-baseline-level-2.neon b/phpstan-baseline-level-2.neon index 8fb9beff9..6f7cec495 100644 --- a/phpstan-baseline-level-2.neon +++ b/phpstan-baseline-level-2.neon @@ -235,11 +235,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php - - - message: "#^Call to method Chill\\\\MainBundle\\\\Entity\\\\Address\\:\\:getPostcode\\(\\) with incorrect case\\: getPostCode$#" - count: 6 - path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php - - message: "#^Only booleans are allowed in a negated boolean, null given\\.$#" count: 1 diff --git a/phpstan-baseline-level-3.neon b/phpstan-baseline-level-3.neon index bcc9b773d..1d5aa5252 100644 --- a/phpstan-baseline-level-3.neon +++ b/phpstan-baseline-level-3.neon @@ -10,31 +10,11 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\ActivityBundle\\\\Entity\\\\ActivityReason\\) of method Chill\\\\ActivityBundle\\\\Templating\\\\Entity\\\\ActivityReasonRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 2 - path: src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php - - message: "#^Return type \\(array\\\\>\\) of method Chill\\\\AsideActivityBundle\\\\Security\\\\AsideActivityVoter\\:\\:getRolesWithHierarchy\\(\\) should be covariant with return type \\(array\\\\>\\) of method Chill\\\\MainBundle\\\\Security\\\\ProvideRoleHierarchyInterface\\:\\:getRolesWithHierarchy\\(\\)$#" count: 1 path: src/Bundle/ChillAsideActivityBundle/src/Security/AsideActivityVoter.php - - - message: "#^Parameter \\#1 \\$asideActivityCategory \\(Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory\\) of method Chill\\\\AsideActivityBundle\\\\Templating\\\\Entity\\\\CategoryRender\\:\\:renderBox\\(\\) should be contravariant with parameter \\$entity \\(Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderBox\\(\\)$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php - - - - message: "#^Parameter \\#1 \\$asideActivityCategory \\(Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory\\) of method Chill\\\\AsideActivityBundle\\\\Templating\\\\Entity\\\\CategoryRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php - - - - message: "#^Parameter \\#1 \\$asideActivityCategory \\(Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory\\) of method Chill\\\\AsideActivityBundle\\\\Templating\\\\Entity\\\\CategoryRender\\:\\:supports\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:supports\\(\\)$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php - - message: "#^Parameter \\#1 \\$criteria \\(array\\\\) of method Chill\\\\CalendarBundle\\\\Repository\\\\CalendarDocRepository\\:\\:findBy\\(\\) should be contravariant with parameter \\$criteria \\(array\\) of method Chill\\\\CalendarBundle\\\\Repository\\\\CalendarDocRepositoryInterface\\:\\:findBy\\(\\)$#" count: 1 @@ -431,20 +411,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\CommentEmbeddable\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\CommentRender\\:\\:renderBox\\(\\) should be contravariant with parameter \\$entity \\(Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderBox\\(\\)$#" - count: 2 - path: src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php - - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\CommentEmbeddable\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\CommentRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 2 - path: src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php - - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\MainBundle\\\\Entity\\\\User\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\UserRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php - message: "#^Parameter \\#1 \\$value \\(string\\) of method Chill\\\\MainBundle\\\\Validation\\\\Validator\\\\ValidPhonenumber\\:\\:validate\\(\\) should be contravariant with parameter \\$value \\(mixed\\) of method Symfony\\\\Component\\\\Validator\\\\ConstraintValidatorInterface\\:\\:validate\\(\\)$#" @@ -767,31 +733,6 @@ parameters: path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\\\ClosingMotive\\) of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\ClosingMotiveRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 2 - path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php - - - - message: "#^Parameter \\#1 \\$person \\(Chill\\\\PersonBundle\\\\Entity\\\\Person\\) of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\PersonRender\\:\\:renderBox\\(\\) should be contravariant with parameter \\$entity \\(Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderBox\\(\\)$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php - - - - message: "#^Parameter \\#1 \\$person \\(Chill\\\\PersonBundle\\\\Entity\\\\Person\\) of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\PersonRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php - - - - message: "#^Parameter \\#1 \\$socialIssue \\(Chill\\\\PersonBundle\\\\Entity\\\\SocialWork\\\\SocialIssue\\) of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\SocialIssueRender\\:\\:renderBox\\(\\) should be contravariant with parameter \\$entity \\(Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderBox\\(\\)$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php - - - - message: "#^Parameter \\#1 \\$socialIssue \\(Chill\\\\PersonBundle\\\\Entity\\\\SocialWork\\\\SocialIssue\\) of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\SocialIssueRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php - - message: "#^Parameter \\#1 \\$object \\(Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkEvaluationDocument\\) of method Chill\\\\PersonBundle\\\\Workflow\\\\AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler\\:\\:getRelatedObjects\\(\\) should be contravariant with parameter \\$object \\(object\\) of method Chill\\\\MainBundle\\\\Workflow\\\\EntityWorkflowHandlerInterface\\:\\:getRelatedObjects\\(\\)$#" count: 1 @@ -857,16 +798,6 @@ parameters: count: 1 path: src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\ThirdPartyBundle\\\\Entity\\\\ThirdParty\\) of method Chill\\\\ThirdPartyBundle\\\\Templating\\\\Entity\\\\ThirdPartyRender\\:\\:renderBox\\(\\) should be contravariant with parameter \\$entity \\(Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderBox\\(\\)$#" - count: 2 - path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php - - - - message: "#^Parameter \\#1 \\$entity \\(Chill\\\\ThirdPartyBundle\\\\Entity\\\\ThirdParty\\) of method Chill\\\\ThirdPartyBundle\\\\Templating\\\\Entity\\\\ThirdPartyRender\\:\\:renderString\\(\\) should be contravariant with parameter \\$entity \\(object\\) of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderString\\(\\)$#" - count: 2 - path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php - - message: "#^Parameter \\#1 \\$document \\(Chill\\\\DocStoreBundle\\\\Entity\\\\StoredObject\\) of method Chill\\\\WopiBundle\\\\Service\\\\Wopi\\\\ChillDocumentManager\\:\\:getBasename\\(\\) should be contravariant with parameter \\$document \\(ChampsLibres\\\\WopiLib\\\\Contract\\\\Entity\\\\Document\\) of method ChampsLibres\\\\WopiLib\\\\Contract\\\\Service\\\\DocumentManagerInterface\\:\\:getBasename\\(\\)$#" count: 1 diff --git a/phpstan-baseline-level-4.neon b/phpstan-baseline-level-4.neon index a608e293b..432e06695 100644 --- a/phpstan-baseline-level-4.neon +++ b/phpstan-baseline-level-4.neon @@ -175,21 +175,6 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php - - - message: "#^Call to method getCategory\\(\\) on an unknown class Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php - - - - message: "#^Call to method getName\\(\\) on an unknown class Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php - - - - message: "#^Parameter \\$entity of method Chill\\\\ActivityBundle\\\\Templating\\\\Entity\\\\ActivityReasonRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php - - message: "#^Parameter \\$context of method Chill\\\\ActivityBundle\\\\Timeline\\\\TimelineActivityProvider\\:\\:getEntityTemplate\\(\\) has invalid type Chill\\\\MainBundle\\\\Timeline\\\\type\\.$#" count: 1 @@ -255,11 +240,6 @@ parameters: count: 1 path: src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php - - - message: "#^Call to an undefined method Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory\\:\\:getName\\(\\)\\.$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php - - message: "#^Call to method DateTimeImmutable\\:\\:add\\(\\) on a separate line has no effect\\.$#" count: 1 @@ -275,11 +255,6 @@ parameters: count: 1 path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php - - - message: "#^Instanceof between Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory and Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory will always evaluate to true\\.$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php - - message: "#^Static call to instance method Chill\\\\BudgetBundle\\\\Calculator\\\\CalculatorInterface\\:\\:getAlias\\(\\)\\.$#" count: 3 @@ -430,11 +405,6 @@ parameters: count: 1 path: src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php - - - message: "#^Parameter \\$entity of method Chill\\\\BudgetBundle\\\\Templating\\\\BudgetElementTypeRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php - - message: "#^Property Chill\\\\CalendarBundle\\\\Command\\\\AzureGrantAdminConsentAndAcquireToken\\:\\:\\$clientRegistry is never read, only written\\.$#" count: 1 @@ -565,16 +535,6 @@ parameters: count: 1 path: src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php - - - message: "#^Default value of the parameter \\#3 \\$contextGenerationData \\(array\\{\\}\\) of method Chill\\\\CalendarBundle\\\\Service\\\\DocGenerator\\\\CalendarContext\\:\\:getData\\(\\) is incompatible with type array\\{mainPerson\\?\\: Chill\\\\PersonBundle\\\\Entity\\\\Person, thirdParty\\?\\: Chill\\\\ThirdPartyBundle\\\\Entity\\\\ThirdParty, title\\: string\\}\\.$#" - count: 1 - path: src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php - - - - message: "#^Offset 'trackDatetime' does not exist on array\\{askMainPerson\\: bool, mainPersonLabel\\: string\\|null, askThirdParty\\: bool, thirdPartyLabel\\: string\\|null, trackDateTime\\: bool\\}\\.$#" - count: 1 - path: src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Helper\\\\HelperInterface\\:\\:ask\\(\\)\\.$#" count: 1 @@ -2105,15 +2065,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Entity/Country.php - - - message: "#^Method Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\CommentEmbeddable\\:\\:getUserId\\(\\) has invalid return type Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\interger\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php - - - - message: "#^Method Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\CommentEmbeddable\\:\\:getUserId\\(\\) should return Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\interger but returns int\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php - message: "#^Property Chill\\\\MainBundle\\\\Entity\\\\GeographicalUnit\\:\\:\\$geom is unused\\.$#" @@ -2515,11 +2466,6 @@ parameters: count: 2 path: src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php - - - message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Center\\\\GroupingCenterInterface\\:\\:getName\\(\\)\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php - - message: "#^Property Chill\\\\MainBundle\\\\Form\\\\Type\\\\Select2CountryType\\:\\:\\$requestStack is never read, only written\\.$#" count: 1 @@ -2845,11 +2791,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php - - - message: "#^Strict comparison using \\=\\=\\= between null and Chill\\\\MainBundle\\\\Entity\\\\Embeddable\\\\interger will always evaluate to false\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php - - message: "#^Method Chill\\\\MainBundle\\\\Serializer\\\\Normalizer\\\\DateNormalizer\\:\\:normalize\\(\\) should return array\\|ArrayObject\\|bool\\|float\\|int\\|string\\|null but return statement is missing\\.$#" count: 1 @@ -2915,46 +2856,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php - - - message: "#^PHPDoc tag @param for parameter \\$addr with type mixed is not subtype of native type Chill\\\\MainBundle\\\\Entity\\\\Address\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php - - - - message: "#^PHPDoc tag @param has invalid value \\(Address addr\\)\\: Unexpected token \"addr\", expected variable at offset 26$#" - count: 3 - path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php - - - - message: "#^Strict comparison using \\!\\=\\= between null and Chill\\\\MainBundle\\\\Entity\\\\the will always evaluate to true\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php - - - - message: "#^Strict comparison using \\=\\=\\= between Chill\\\\MainBundle\\\\Entity\\\\the and 'FR' will always evaluate to false\\.$#" - count: 3 - path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php - - - - message: "#^Parameter \\$entity of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php - - - - message: "#^Parameter \\$entity of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\ChillEntityRenderInterface\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php - - - - message: "#^If condition is always true\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php - - - - message: "#^Parameter \\$entity of method Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\UserRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php - - message: "#^PHPDoc tag @return has invalid value \\(array\\<'to'\\: DateTimeImmutable, 'from'\\: DateTimeImmutable\\>\\)\\: Unexpected token \"\\:\", expected '\\>' at offset 29$#" count: 1 @@ -4301,26 +4202,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php - - - message: "#^Parameter \\$entity of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\ClosingMotiveRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php - - - - message: "#^Call to method getTitle\\(\\) on an unknown class Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php - - - - message: "#^Parameter \\$entity of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\ResourceKindRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php - - - - message: "#^Parameter \\$socialAction of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\SocialActionRender\\:\\:renderBox\\(\\) has invalid type Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php - - message: "#^Call to method getId\\(\\) on an unknown class ChillPersonBundle\\:AccompanyingPeriod\\.$#" count: 1 diff --git a/phpstan-baseline-level-5.neon b/phpstan-baseline-level-5.neon index a4c985c85..10390e8da 100644 --- a/phpstan-baseline-level-5.neon +++ b/phpstan-baseline-level-5.neon @@ -25,21 +25,6 @@ parameters: count: 1 path: src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php - - - message: "#^Parameter \\#1 \\$name of method Chill\\\\MainBundle\\\\Entity\\\\Country\\:\\:setName\\(\\) expects string, array\\ given\\.$#" - count: 1 - path: src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php - - - - message: "#^Parameter \\#1 \\$title of method Chill\\\\MainBundle\\\\Entity\\\\LocationType\\:\\:setTitle\\(\\) expects array, string given\\.$#" - count: 1 - path: src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php - - - - message: "#^Parameter \\#1 \\$status of method Chill\\\\CalendarBundle\\\\Entity\\\\Invite\\:\\:setStatus\\(\\) expects string, array\\ given\\.$#" - count: 1 - path: src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadInvite.php - - message: "#^Parameter \\#2 \\$byUser of class Chill\\\\CalendarBundle\\\\Messenger\\\\Message\\\\CalendarRemovedMessage constructor expects Chill\\\\MainBundle\\\\Entity\\\\User\\|null, Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null given\\.$#" count: 1 @@ -570,11 +555,6 @@ parameters: count: 2 path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php - - - message: "#^Parameter \\#1 \\$entity of method Chill\\\\PersonBundle\\\\Templating\\\\Entity\\\\ClosingMotiveRender\\:\\:renderString\\(\\) expects Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\\\ClosingMotive, Chill\\\\MainBundle\\\\Templating\\\\Entity\\\\type given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php - - message: "#^Parameter \\#1 \\$entityName of method Doctrine\\\\ORM\\\\EntityManager\\:\\:getRepository\\(\\) expects class\\-string\\, string given\\.$#" count: 1 diff --git a/phpstan-types.neon b/phpstan-types.neon index 7a2e3764a..d62c8bc4b 100644 --- a/phpstan-types.neon +++ b/phpstan-types.neon @@ -340,11 +340,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php - - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" - count: 2 - path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php - - message: "#^Method Chill\\\\ReportBundle\\\\DataFixtures\\\\ORM\\\\LoadReports\\:\\:getRandomChoice\\(\\) should return array\\\\|string but return statement is missing\\.$#" count: 1 diff --git a/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php b/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php index 991591141..c60a8d286 100644 --- a/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php +++ b/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php @@ -13,13 +13,18 @@ namespace Chill\ActivityBundle\Templating\Entity; use Chill\ActivityBundle\Entity\ActivityReason; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; +use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait; +use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; /** * Render activity reason. + * + * @implements ChillEntityRenderInterface */ -class ActivityReasonRender extends AbstractChillEntityRender +class ActivityReasonRender implements ChillEntityRenderInterface { + use BoxUtilsChillEntityRenderTrait; /** * @var TranslatableStringHelper */ @@ -51,9 +56,6 @@ class ActivityReasonRender extends AbstractChillEntityRender $this->getDefaultClosingBox(); } - /** - * @param ActivityReason $entity - */ public function renderString($entity, array $options): string { $category = ''; diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index 7940b42e7..066a0ca52 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -16,6 +16,9 @@ use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Symfony\Component\Templating\EngineInterface; +/** + * @implements ChillEntityRenderInterface + */ final class CategoryRender implements ChillEntityRenderInterface { public const DEFAULT_ARGS = [ @@ -45,9 +48,6 @@ final class CategoryRender implements ChillEntityRenderInterface return $parents; } - /** - * @param AsideActivityCategory $asideActivityCategory - */ public function renderBox($asideActivityCategory, array $options): string { $options = array_merge(self::DEFAULT_ARGS, $options); @@ -63,9 +63,6 @@ final class CategoryRender implements ChillEntityRenderInterface ); } - /** - * @param AsideActivityCategory $asideActivityCategory - */ public function renderString($asideActivityCategory, array $options): string { $options = array_merge(self::DEFAULT_ARGS, $options); @@ -84,9 +81,6 @@ final class CategoryRender implements ChillEntityRenderInterface return implode($options[self::SEPERATOR_KEY], $titles); } - /** - * @param AsideActivityCategory $asideActivityCategory - */ public function supports($asideActivityCategory, array $options): bool { return $asideActivityCategory instanceof AsideActivityCategory; diff --git a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php index 9cc89e2bf..842e6be4e 100644 --- a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php +++ b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php @@ -17,6 +17,9 @@ use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Symfony\Component\Templating\EngineInterface; +/** + * @implements ChillEntityRenderInterface + */ final class BudgetElementTypeRender implements ChillEntityRenderInterface { private EngineInterface $engine; diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index 313d62b3d..0c8509233 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -43,36 +43,20 @@ class Country private ?int $id = null; /** - * @var string + * @var array * * @ORM\Column(type="json") * @groups({"read", "docgen:read"}) * @Context({"is-translatable": true}, groups={"docgen:read"}) */ - private $name; + private array $name = []; - /** - * @return string - */ - public function __toString() - { - return $this->getName(); - } - - /** - * @return the string - */ - public function getCountryCode() + public function getCountryCode(): string { return $this->countryCode; } - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): ?int { return $this->id; } @@ -81,29 +65,22 @@ class Country * Get name. * */ - public function getName() + public function getName(): array { return $this->name; } - /** - * @param string $countryCode - */ - public function setCountryCode($countryCode) + public function setCountryCode(?string $countryCode): self { - $this->countryCode = $countryCode; + $this->countryCode = (string) $countryCode; return $this; } /** - * Set name. - * - * @param string $name - * - * @return Country + * @param array $name */ - public function setName($name) + public function setName(array $name): self { $this->name = $name; diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php index 9fc437bd0..f404d5931 100644 --- a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php @@ -51,10 +51,7 @@ class CommentEmbeddable return $this->date; } - /** - * @return interger $userId - */ - public function getUserId() + public function getUserId(): ?int { return $this->userId; } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php index 089c62d77..16977fb27 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php @@ -11,15 +11,10 @@ declare(strict_types=1); namespace Chill\MainBundle\Templating\Entity; +/** + * @deprecated load @link{BoxUtilsChillEntityRenderTrait} in the render + */ abstract class AbstractChillEntityRender implements ChillEntityRenderInterface { - protected function getDefaultClosingBox(): string - { - return ''; - } - - protected function getDefaultOpeningBox($classSuffix): string - { - return '
'; - } + use BoxUtilsChillEntityRenderTrait; } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index 4db8abe9b..8a34ab687 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -18,6 +18,9 @@ use Symfony\Component\Templating\EngineInterface; use function array_merge; use function strtr; +/** + * @implements ChillEntityRenderInterface
+ */ class AddressRender implements ChillEntityRenderInterface { public const DEFAULT_OPTIONS = [ @@ -41,10 +44,6 @@ class AddressRender implements ChillEntityRenderInterface $this->translatableStringHelper = $translatableStringHelper; } - /** - * @param Address addr - * @param mixed $addr - */ public function renderBox($addr, array $options): string { $options = array_merge(self::DEFAULT_OPTIONS, $options); @@ -59,18 +58,12 @@ class AddressRender implements ChillEntityRenderInterface ]); } - /** - * @param Address addr - * @param mixed $addr - * - * @return string[] - */ public function renderLines(Address $addr, bool $includeCityLine = true, bool $includeCountry = true): array { $lines = []; - if (null !== $addr->getPostCode()) { - if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') { + if (null !== $addr->getPostcode()) { + if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') { $lines[] = $this->renderIntraBuildingLine($addr); $lines[] = $this->renderBuildingLine($addr); $lines[] = $this->renderStreetLine($addr); @@ -117,10 +110,8 @@ class AddressRender implements ChillEntityRenderInterface $res = trim($street . ', ' . $streetNumber, ', '); - if (null !== $addr->getPostCode()->getCountry()->getCountryCode()) { - if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') { - $res = trim($streetNumber . ', ' . $street, ', '); - } + if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') { + $res = trim($streetNumber . ', ' . $street, ', '); } if ((',' === $res) || ('' === $res)) { @@ -130,10 +121,6 @@ class AddressRender implements ChillEntityRenderInterface return $res; } - /** - * @param Address addr - * @param mixed $addr - */ public function renderString($addr, array $options): string { return implode(' — ', $this->renderLines($addr)); @@ -163,10 +150,8 @@ class AddressRender implements ChillEntityRenderInterface $res = null; } - if (null !== $addr->getPostCode()->getCountry()->getCountryCode()) { - if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') { - $res = $addr->getBuildingName(); - } + if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') { + $res = $addr->getBuildingName(); } return $res; diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/BoxUtilsChillEntityRenderTrait.php b/src/Bundle/ChillMainBundle/Templating/Entity/BoxUtilsChillEntityRenderTrait.php new file mode 100644 index 000000000..860313cbd --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/Entity/BoxUtilsChillEntityRenderTrait.php @@ -0,0 +1,25 @@ +'; + } + + protected function getDefaultOpeningBox($classSuffix): string + { + return '
'; + } +} diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php index e7f471d35..6b1294d42 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php @@ -14,8 +14,10 @@ namespace Chill\MainBundle\Templating\Entity; /** * Render an entity using `__toString()`. */ -class ChillEntityRender extends AbstractChillEntityRender +class ChillEntityRender implements ChillEntityRenderInterface { + use BoxUtilsChillEntityRenderTrait; + public function renderBox($entity, array $options): string { return $this->getDefaultOpeningBox('default') . $entity diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php index ca52b22ed..9dadc4f7a 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php @@ -14,6 +14,8 @@ namespace Chill\MainBundle\Templating\Entity; /** * Interface to implement which will render an entity in template on a custom * manner. + * + * @template T */ interface ChillEntityRenderInterface { @@ -29,7 +31,7 @@ interface ChillEntityRenderInterface * * ``` * - * @param type $entity + * @param T $entity */ public function renderBox($entity, array $options): string; @@ -38,14 +40,12 @@ interface ChillEntityRenderInterface * * Example: returning the name of a person. * - * @param object $entity + * @param T $entity */ public function renderString($entity, array $options): string; /** * Return true if the class support this object for the given options. - * - * @param object $entity */ - public function supports($entity, array $options): bool; + public function supports(object $entity, array $options): bool; } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index 7b5537692..7e567725e 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -13,33 +13,32 @@ namespace Chill\MainBundle\Templating\Entity; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Repository\UserRepository; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Symfony\Component\Templating\EngineInterface; use function array_merge; -class CommentRender extends AbstractChillEntityRender +/** + * @implements ChillEntityRenderInterface + */ +class CommentRender implements ChillEntityRenderInterface { + use BoxUtilsChillEntityRenderTrait; /** * @var EngineInterface */ private $engine; - /** - * @var \Chill\MainBundle\Repository\UserRepository - */ - private $userRepository; + private UserRepositoryInterface $userRepository; public function __construct( - UserRepository $userRepository, + UserRepositoryInterface $userRepository, EngineInterface $engine ) { $this->userRepository = $userRepository; $this->engine = $engine; } - /** - * @param CommentEmbeddable $entity - */ public function renderBox($entity, array $options): string { // default options @@ -50,7 +49,7 @@ class CommentRender extends AbstractChillEntityRender 'metadata' => true, ], $options); - if ($entity->getUserId()) { + if (null !== $entity->getUserId()) { $user = $this->userRepository->find($entity->getUserId()); } @@ -67,9 +66,6 @@ class CommentRender extends AbstractChillEntityRender ); } - /** - * @param CommentEmbeddable $entity - */ public function renderString($entity, array $options): string { return $entity->getComment(); diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php index 6780db742..eab014289 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php @@ -19,6 +19,9 @@ use Symfony\Component\Templating\EngineInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function array_merge; +/** + * @implements ChillEntityRenderInterface + */ class UserRender implements ChillEntityRenderInterface { public const DEFAULT_OPTIONS = [ @@ -50,9 +53,6 @@ class UserRender implements ChillEntityRenderInterface ]); } - /** - * @param User $entity - */ public function renderString($entity, array $options): string { $opts = array_merge(self::DEFAULT_OPTIONS, $options); diff --git a/src/Bundle/ChillMainBundle/migrations/Version20230301155213.php b/src/Bundle/ChillMainBundle/migrations/Version20230301155213.php index 6d93b71d9..518789213 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20230301155213.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20230301155213.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php index 688136b35..0064a53d5 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php @@ -12,14 +12,19 @@ declare(strict_types=1); namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; +use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait; +use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; /** * Render closing motive. + * + * @implements ChillEntityRenderInterface */ -class ClosingMotiveRender extends AbstractChillEntityRender +class ClosingMotiveRender implements ChillEntityRenderInterface { + use BoxUtilsChillEntityRenderTrait; private const SEPARATOR = ' > '; /** @@ -40,9 +45,6 @@ class ClosingMotiveRender extends AbstractChillEntityRender $this->getDefaultClosingBox(); } - /** - * @param ClosingMotive $entity - */ public function renderString($entity, array $options): string { return $this->renderStringRecursive( @@ -57,12 +59,12 @@ class ClosingMotiveRender extends AbstractChillEntityRender return $entity instanceof ClosingMotive; } - protected function renderStringRecursive(ClosingMotive $motive, $existing, array $options) + private function renderStringRecursive(ClosingMotive $motive, string $existing, array $options) { $newExisting = $this->translatableStringHelper->localize($motive->getName()); if ($motive->hasParent()) { - if (!empty($existing)) { + if ('' !== $existing) { $newExisting = $newExisting . self::SEPARATOR . $existing; } @@ -73,7 +75,7 @@ class ClosingMotiveRender extends AbstractChillEntityRender ); } - if (!empty($existing)) { + if ('' !== $existing) { return $newExisting . self::SEPARATOR . $existing; } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 9fb60b040..05d9b3009 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -12,6 +12,8 @@ declare(strict_types=1); namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; +use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait; +use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; use Symfony\Component\Templating\EngineInterface; @@ -22,8 +24,9 @@ use function array_key_exists; /** * Render a Person. */ -class PersonRender extends AbstractChillEntityRender implements PersonRenderInterface +class PersonRender implements PersonRenderInterface { + use BoxUtilsChillEntityRenderTrait; private ConfigPersonAltNamesHelper $configAltNamesHelper; private EngineInterface $engine; @@ -40,9 +43,6 @@ class PersonRender extends AbstractChillEntityRender implements PersonRenderInte $this->translator = $translator; } - /** - * @param Person $person - */ public function renderBox($person, array $options): string { $params = [ @@ -72,9 +72,6 @@ class PersonRender extends AbstractChillEntityRender implements PersonRenderInte $this->getDefaultClosingBox(); } - /** - * @param Person $person - */ public function renderString($person, array $options): string { $options = array_merge(['addAge' => true], $options); diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php index cc42ec305..2f69d31a9 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -12,9 +12,12 @@ declare(strict_types=1); namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; +use Chill\PersonBundle\Entity\Person; /** * Render a Person. + * + * @extends ChillEntityRenderInterface */ interface PersonRenderInterface extends ChillEntityRenderInterface { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php index b1aa31e41..61c674b76 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php @@ -15,6 +15,9 @@ use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Person\PersonResourceKind; +/** + * @implements ChillEntityRenderInterface + */ final class ResourceKindRender implements ChillEntityRenderInterface { private TranslatableStringHelper $translatableStringHelper; diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php index bfe49c0a4..dd8083878 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php @@ -20,6 +20,9 @@ use function array_merge; use function array_reverse; use function implode; +/** + * @implements ChillEntityRenderInterface + */ class SocialActionRender implements ChillEntityRenderInterface { public const AND_CHILDREN_MENTION = 'show_and_children_mention'; diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php index 62d17f47e..f3962535b 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -19,6 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; use function array_reverse; use function implode; +/** + * @implements ChillEntityRenderInterface + */ final class SocialIssueRender implements ChillEntityRenderInterface { public const AND_CHILDREN_MENTION = 'show_and_children_mention'; @@ -53,9 +56,6 @@ final class SocialIssueRender implements ChillEntityRenderInterface $this->translator = $translator; } - /** - * @param SocialIssue $socialIssue - */ public function renderBox($socialIssue, array $options): string { $options = array_merge(self::DEFAULT_ARGS, $options); @@ -74,9 +74,6 @@ final class SocialIssueRender implements ChillEntityRenderInterface ); } - /** - * @param SocialIssue $socialIssue - */ public function renderString($socialIssue, array $options): string { /** @var SocialIssue $socialIssue */ diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index 7e708f757..ece12f5c9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -12,12 +12,18 @@ declare(strict_types=1); namespace Chill\ThirdPartyBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; +use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait; +use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\ThirdPartyBundle\Entity\ThirdParty; use Symfony\Component\Templating\EngineInterface; -class ThirdPartyRender extends AbstractChillEntityRender +/** + * @implements ChillEntityRenderInterface + */ +class ThirdPartyRender implements ChillEntityRenderInterface { + use BoxUtilsChillEntityRenderTrait; protected EngineInterface $engine; protected TranslatableStringHelper $translatableStringHelper; @@ -30,9 +36,6 @@ class ThirdPartyRender extends AbstractChillEntityRender $this->translatableStringHelper = $translatableStringHelper; } - /** - * @param ThirdParty $entity - */ public function renderBox($entity, array $options): string { $params = [ @@ -59,9 +62,6 @@ class ThirdPartyRender extends AbstractChillEntityRender $this->getDefaultClosingBox(); } - /** - * @param ThirdParty $entity - */ public function renderString($entity, array $options): string { if ($entity->getCivility() !== null) {