diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1b3cca67e..4bf44fbad 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -16,18 +16,8 @@ parameters: path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\ActivityBundle\\\\Entity\\\\Activity\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - - - message: "#^Only booleans are allowed in a ternary operator condition, Chill\\\\MainBundle\\\\Entity\\\\Scope\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - - - message: "#^Only booleans are allowed in a ternary operator condition, Chill\\\\PersonBundle\\\\Entity\\\\Person\\|null given\\.$#" - count: 1 + message: "#^Cannot call method getId\\(\\) on null\\.$#" + count: 2 path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - @@ -35,36 +25,6 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - - message: "#^Method Chill\\\\ActivityBundle\\\\Controller\\\\ActivityReasonCategoryController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php - - - - message: "#^Method Chill\\\\ActivityBundle\\\\Controller\\\\ActivityReasonCategoryController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\ActivityBundle\\\\Entity\\\\ActivityReasonCategory\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php - - - - message: "#^Method Chill\\\\ActivityBundle\\\\Controller\\\\ActivityReasonController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php - - - - message: "#^Method Chill\\\\ActivityBundle\\\\Controller\\\\ActivityReasonController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\ActivityBundle\\\\Entity\\\\ActivityReason\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php - - message: "#^Parameter \\$options of attribute class Symfony\\\\Component\\\\Routing\\\\Attribute\\\\Route constructor expects array\\, array\\ given\\.$#" count: 1 @@ -280,16 +240,6 @@ parameters: count: 1 path: src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 3 - path: src/Bundle/ChillBudgetBundle/Form/ChargeType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillBudgetBundle/Form/ResourceType.php - - message: "#^PHPDoc tag @param for parameter \\$limit with type mixed is not subtype of native type int\\|null\\.$#" count: 1 @@ -375,11 +325,6 @@ parameters: count: 1 path: src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php - - - message: "#^Parameter \\$normalizationContext of attribute class Symfony\\\\Component\\\\Serializer\\\\Annotation\\\\Context constructor expects array\\, array\\ given\\.$#" - count: 5 - path: src/Bundle/ChillCalendarBundle/Entity/Calendar.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 @@ -510,26 +455,6 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php - - - message: "#^Method Chill\\\\CustomFieldsBundle\\\\Controller\\\\CustomFieldController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php - - - - message: "#^Method Chill\\\\CustomFieldsBundle\\\\Controller\\\\CustomFieldController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomFieldsGroup\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomField\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php - - message: "#^Only booleans are allowed in a ternary operator condition, Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomFieldsGroup\\|null given\\.$#" count: 1 @@ -565,26 +490,6 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php - - - message: "#^Method Chill\\\\CustomFieldsBundle\\\\Controller\\\\CustomFieldsGroupController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php - - - - message: "#^Method Chill\\\\CustomFieldsBundle\\\\Controller\\\\CustomFieldsGroupController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php - - - - message: "#^Method Chill\\\\CustomFieldsBundle\\\\Controller\\\\CustomFieldsGroupController\\:\\:createMakeDefaultForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomFieldsGroup\\|null given\\.$#" - count: 4 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -930,11 +835,6 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php - - message: "#^Property Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomField\\:\\:\\$required \\(false\\) does not accept bool\\.$#" count: 1 @@ -958,11 +858,6 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php - - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php - - message: "#^PHPDoc tag @param for parameter \\$resolver with type Chill\\\\CustomFieldsBundle\\\\Form\\\\OptionsResolverInterface is not subtype of native type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolver\\.$#" count: 1 @@ -988,11 +883,6 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php - - - message: "#^Only booleans are allowed in a negated boolean, string given\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php - - message: "#^Parameter \\#1 \\$customFieldsGroup \\(Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomFieldsGroup\\|null\\) of method Chill\\\\CustomFieldsBundle\\\\Form\\\\DataTransformer\\\\CustomFieldsGroupToIdTransformer\\:\\:transform\\(\\) should be contravariant with parameter \\$value \\(mixed\\) of method Symfony\\\\Component\\\\Form\\\\DataTransformerInterface\\\\:\\:transform\\(\\)$#" count: 1 @@ -1003,6 +893,11 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php + - + message: "#^Strict comparison using \\=\\=\\= between null and string will always evaluate to false\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php + - message: "#^Call to an undefined method Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomField\\:\\:getLabel\\(\\)\\.$#" count: 1 @@ -1268,51 +1163,16 @@ parameters: count: 1 path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\EventBundle\\\\Entity\\\\Event given\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\EventBundle\\\\Entity\\\\Event\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillEventBundle/Controller/EventController.php - - message: "#^Parameter \\$options of attribute class Symfony\\\\Component\\\\Routing\\\\Attribute\\\\Route constructor expects array\\, array\\ given\\.$#" count: 2 path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - message: "#^Method Chill\\\\EventBundle\\\\Controller\\\\EventTypeController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/EventTypeController.php - - - - message: "#^Method Chill\\\\EventBundle\\\\Controller\\\\EventTypeController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/EventTypeController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\EventBundle\\\\Entity\\\\EventType\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillEventBundle/Controller/EventTypeController.php - - message: "#^Parameter \\$options of attribute class Symfony\\\\Component\\\\Routing\\\\Attribute\\\\Route constructor expects array\\, array\\ given\\.$#" count: 1 path: src/Bundle/ChillEventBundle/Controller/EventTypeController.php - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\EventBundle\\\\Entity\\\\Participation\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php - - message: "#^Strict comparison using \\=\\=\\= between null and Chill\\\\EventBundle\\\\Entity\\\\Event will always evaluate to false\\.$#" count: 1 @@ -1328,41 +1188,11 @@ parameters: count: 3 path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php - - - message: "#^Method Chill\\\\EventBundle\\\\Controller\\\\RoleController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/RoleController.php - - - - message: "#^Method Chill\\\\EventBundle\\\\Controller\\\\RoleController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/RoleController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\EventBundle\\\\Entity\\\\Role\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillEventBundle/Controller/RoleController.php - - message: "#^Parameter \\$options of attribute class Symfony\\\\Component\\\\Routing\\\\Attribute\\\\Route constructor expects array\\, array\\ given\\.$#" count: 1 path: src/Bundle/ChillEventBundle/Controller/RoleController.php - - - message: "#^Method Chill\\\\EventBundle\\\\Controller\\\\StatusController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/StatusController.php - - - - message: "#^Method Chill\\\\EventBundle\\\\Controller\\\\StatusController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/StatusController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\EventBundle\\\\Entity\\\\Status\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillEventBundle/Controller/StatusController.php - - message: "#^Parameter \\$options of attribute class Symfony\\\\Component\\\\Routing\\\\Attribute\\\\Route constructor expects array\\, array\\ given\\.$#" count: 1 @@ -1413,11 +1243,6 @@ parameters: count: 1 path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php - - - message: "#^Parameter \\#1 \\$parameters of method Doctrine\\\\ORM\\\\QueryBuilder\\:\\:setParameters\\(\\) expects Doctrine\\\\Common\\\\Collections\\\\ArrayCollection\\, array\\{\\:person_id\\: mixed, \\:reachable_circles\\: mixed\\} given\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Repository/ParticipationRepository.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 @@ -1668,11 +1493,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php - - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php - - message: "#^Only booleans are allowed in an if condition, int given\\.$#" count: 1 @@ -1693,11 +1513,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php - - - message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:flush\\(\\) invoked with 1 parameter, 0 required\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php - - message: "#^Instanceof between Chill\\\\MainBundle\\\\Export\\\\DirectExportInterface and Chill\\\\MainBundle\\\\Export\\\\DirectExportInterface will always evaluate to true\\.$#" count: 1 @@ -1743,16 +1558,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Controller/PasswordController.php - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\MainBundle\\\\Entity\\\\PermissionsGroup\\|null given\\.$#" - count: 5 - path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\MainBundle\\\\Entity\\\\RoleScope\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:createQuery\\(\\)\\.$#" count: 1 @@ -1828,21 +1633,26 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Controller/UserController.php - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\MainBundle\\\\Entity\\\\GroupCenter\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Controller/UserController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\MainBundle\\\\Entity\\\\User\\|null given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Controller/UserController.php - - message: "#^Parameter \\#1 \\$records of method League\\\\Csv\\\\Writer\\:\\:insertAll\\(\\) expects iterable\\\\>, iterable\\\\> given\\.$#" count: 1 path: src/Bundle/ChillMainBundle/Controller/UserExportController.php + - + message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Entity\\\\User\\:\\:getNotificationFlags\\(\\)\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserProfileController.php + + - + message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Entity\\\\User\\:\\:setNotificationFlags\\(\\)\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserProfileController.php + + - + message: "#^Class Chill\\\\MainBundle\\\\Form\\\\UserProfileType not found\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserProfileController.php + - message: "#^Parameter \\#1 \\$user of method Chill\\\\MainBundle\\\\Entity\\\\Workflow\\\\EntityWorkflow\\:\\:addSubscriberToFinal\\(\\) expects Chill\\\\MainBundle\\\\Entity\\\\User, Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null given\\.$#" count: 1 @@ -2299,26 +2109,11 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Form/ScopeType.php - - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Form/Type/AddressType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Form/Type/AddressType.php - - message: "#^Property Chill\\\\MainBundle\\\\Form\\\\Type\\\\ChillPhoneNumberType\\:\\:\\$phoneNumberUtil is never read, only written\\.$#" count: 1 path: src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php - - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#" count: 1 @@ -2469,11 +2264,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php - - - message: "#^Only booleans are allowed in a ternary operator condition, int\\<0, max\\> given\\.$#" - count: 4 - path: src/Bundle/ChillMainBundle/Search/SearchApiQuery.php - - message: "#^Else branch is unreachable because previous condition is always true\\.$#" count: 1 @@ -2929,16 +2719,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Actions/ActionEvent.php - - - message: "#^Call to function array_key_exists\\(\\) with 'joinColumns' and Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping will always evaluate to false\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php - - - - message: "#^Call to function array_key_exists\\(\\) with 'joinTable' and Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping will always evaluate to false\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -2954,41 +2734,11 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php - - - message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping given\\.$#" - count: 2 - path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php - - - - message: "#^Method Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\EntityPersonCRUDController\\:\\:filterQueryEntitiesByPerson\\(\\) has invalid return type Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\QueryBuilder\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php - - - - message: "#^PHPDoc tag @param for parameter \\$qb with type Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\QueryBuilder is not subtype of native type Doctrine\\\\ORM\\\\QueryBuilder\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php - - - - message: "#^PHPDoc tag @return with type Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\QueryBuilder is not subtype of native type Doctrine\\\\ORM\\\\QueryBuilder\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php - - message: "#^PHPDoc tag @throws with type Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\Symfony\\\\Component\\\\HttpKernel\\\\Exception\\\\NotFoundHttpException is not subtype of Throwable$#" count: 1 path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php - - - message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\EntityPersonCRUDController\\:\\:createEntity\\(\\) has invalid type Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\string\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php - - - - message: "#^Parameter \\$qb of method Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\EntityPersonCRUDController\\:\\:filterQueryEntitiesByPerson\\(\\) has invalid type Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\QueryBuilder\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -3009,11 +2759,6 @@ parameters: count: 2 path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php - - message: "#^Strict comparison using \\=\\=\\= between null and Chill\\\\PersonBundle\\\\Entity\\\\Person will always evaluate to false\\.$#" count: 1 @@ -3044,11 +2789,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php - - - message: "#^Call to an undefined method Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingPeriodController\\:\\:get\\(\\)\\.$#" - count: 13 - path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php - - message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" count: 1 @@ -3127,21 +2867,6 @@ parameters: count: 2 path: src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php - - - message: "#^Method Chill\\\\PersonBundle\\\\Controller\\\\PersonAddressController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php - - - - message: "#^Method Chill\\\\PersonBundle\\\\Controller\\\\PersonAddressController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php - - - - message: "#^Call to an undefined method Chill\\\\PersonBundle\\\\Controller\\\\PersonController\\:\\:get\\(\\)\\.$#" - count: 4 - path: src/Bundle/ChillPersonBundle/Controller/PersonController.php - - message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\\\:\\:findOneByEntity\\(\\)\\.$#" count: 1 @@ -3439,17 +3164,7 @@ parameters: - message: "#^Negated boolean expression is always true\\.$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Entity/Person.php - - - - message: "#^Only booleans are allowed in a negated boolean, null given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Entity/Person.php - - - - message: "#^Only booleans are allowed in a ternary operator condition, Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriodParticipation\\|null given\\.$#" - count: 1 + count: 2 path: src/Bundle/ChillPersonBundle/Entity/Person.php - @@ -3497,11 +3212,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Entity/Person.php - - - message: "#^Strict comparison using \\=\\=\\= between true and Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriodParticipation\\|null will always evaluate to false\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Entity/Person.php - - message: "#^Property Chill\\\\PersonBundle\\\\Entity\\\\SocialWork\\\\Result\\:\\:\\$desactivationDate \\(DateTime\\|null\\) does not accept DateTimeInterface\\|null\\.$#" count: 1 @@ -3612,26 +3322,11 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/PersonType.php - - message: "#^Strict comparison using \\=\\=\\= between 'create' and 'create' will always evaluate to true\\.$#" count: 1 path: src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php - - - message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php - - message: "#^Call to method Chill\\\\PersonBundle\\\\Entity\\\\Person\\:\\:getFirstName\\(\\) with incorrect case\\: getFirstname$#" count: 1 @@ -3792,11 +3487,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php - - - message: "#^Only booleans are allowed in an if condition, int\\<0, max\\> given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php - - message: "#^Property Chill\\\\PersonBundle\\\\Security\\\\Authorization\\\\AccompanyingPeriodVoter\\:\\:\\$security is never read, only written\\.$#" count: 1 @@ -3907,29 +3597,9 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php - - - message: "#^Call to function is_array\\(\\) with 'concerned' will always evaluate to false\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php - - - - message: "#^Left side of && is always false\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php - - - - message: "#^Only booleans are allowed in &&, null given on the left side\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php - - - - message: "#^Strict comparison using \\=\\=\\= between false and false will always evaluate to true\\.$#" - count: 1 + count: 2 path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php - @@ -3947,16 +3617,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php - - - message: "#^Only booleans are allowed in a ternary operator condition, Chill\\\\PersonBundle\\\\Entity\\\\Household\\\\Household\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php - - - - message: "#^Only booleans are allowed in a ternary operator condition, array\\ given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php - - message: "#^Parameter \\#1 \\$person \\(Chill\\\\PersonBundle\\\\Entity\\\\Person\\) of method Chill\\\\PersonBundle\\\\Serializer\\\\Normalizer\\\\PersonJsonNormalizer\\:\\:normalize\\(\\) should be contravariant with parameter \\$data \\(mixed\\) of method Symfony\\\\Component\\\\Serializer\\\\Normalizer\\\\NormalizerInterface\\:\\:normalize\\(\\)$#" count: 2 @@ -4144,7 +3804,7 @@ parameters: - message: "#^Call to an undefined method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:get\\(\\)\\.$#" - count: 7 + count: 3 path: src/Bundle/ChillReportBundle/Controller/ReportController.php - @@ -4152,113 +3812,13 @@ parameters: count: 2 path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectRepository\\\\:\\:findByCFGroup\\(\\)\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectRepository\\\\:\\:findByEntity\\(\\)\\.$#" count: 2 path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - message: "#^Call to method getId\\(\\) on an unknown class ChillReportBundle\\:Report\\.$#" - count: 2 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Call to method getPerson\\(\\) on an unknown class ChillReportBundle\\:Report\\.$#" - count: 3 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:createAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:createCreateForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:createEditForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\Form but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:editAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:exportAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\A\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:exportAction\\(\\) should return Chill\\\\ReportBundle\\\\Controller\\\\A but returns Symfony\\\\Component\\\\HttpFoundation\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:listAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:newAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:selectReportTypeAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:selectReportTypeForExportAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:updateAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:viewAction\\(\\) has invalid return type Chill\\\\ReportBundle\\\\Controller\\\\Response\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\PersonBundle\\\\Entity\\\\Person\\|null given\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Only booleans are allowed in a negated boolean, Chill\\\\ReportBundle\\\\Entity\\\\Report given\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^PHPDoc tag @return with type Chill\\\\ReportBundle\\\\Controller\\\\Response is not subtype of native type Symfony\\\\Component\\\\HttpFoundation\\\\Response\\.$#" - count: 8 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Parameter \\#1 \\$className of method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getRepository\\(\\) expects class\\-string\\, string given\\.$#" - count: 4 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - message: "#^Parameter \\#1 \\$entity of method Chill\\\\ReportBundle\\\\Controller\\\\ReportController\\:\\:createEditForm\\(\\) expects Chill\\\\ReportBundle\\\\Entity\\\\Report, ChillReportBundle\\:Report given\\.$#" + message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectRepository\\\\:\\:findByCFGroup\\(\\)\\.$#" count: 1 path: src/Bundle/ChillReportBundle/Controller/ReportController.php @@ -4312,16 +3872,6 @@ parameters: count: 1 path: src/Bundle/ChillReportBundle/Form/ReportType.php - - - message: "#^Call to method getId\\(\\) on an unknown class ChillReportBundle\\:Report\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php - - - - message: "#^Parameter \\#1 \\$className of method Doctrine\\\\ORM\\\\EntityManager\\:\\:getRepository\\(\\) expects class\\-string\\, string given\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php - - message: "#^Parameter \\#1 \\$context of method Chill\\\\ReportBundle\\\\Timeline\\\\TimelineReportProvider\\:\\:checkContext\\(\\) expects string, Chill\\\\MainBundle\\\\Timeline\\\\type given\\.$#" count: 1 @@ -4405,11 +3955,6 @@ parameters: count: 1 path: src/Bundle/ChillTaskBundle/Event/Lifecycle/TaskLifecycleEvent.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php - - message: "#^Parameter \\#1 \\$repository of class Chill\\\\PersonBundle\\\\Form\\\\DataTransformer\\\\PersonToIdTransformer constructor expects Chill\\\\PersonBundle\\\\Repository\\\\PersonRepository, Doctrine\\\\ORM\\\\EntityManagerInterface given\\.$#" count: 1 diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index c45d3a451..9be48e61e 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -83,7 +83,7 @@ final class ActivityController extends AbstractController $activity = $this->activityRepository->find($id); - if (!$activity) { + if (null === $activity) { throw $this->createNotFoundException('Unable to find Activity entity.'); } @@ -106,9 +106,9 @@ final class ActivityController extends AbstractController $this->logger->notice('An activity has been removed', [ 'by_user' => $this->getUser()->getUserIdentifier(), 'activity_id' => $activity->getId(), - 'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null, - 'comment' => $activity->getComment()->getComment(), - 'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null, + 'person_id' => null === $activity->getPerson() ? $activity->getPerson()->getId() : null, + 'comment' => null === $activity->getComment()->getComment(), + 'scope_id' => null === $activity->getScope() ? $activity->getScope()->getId() : null, 'reasons_ids' => $activity->getReasons() ->map( static fn (ActivityReason $ar): int => $ar->getId() diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index bdedb63cf..1f96638f2 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\ActivityReasonCategory; use Chill\ActivityBundle\Form\ActivityReasonCategoryType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; /** @@ -88,7 +89,7 @@ class ActivityReasonCategoryController extends AbstractController $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); } @@ -112,9 +113,8 @@ class ActivityReasonCategoryController extends AbstractController * * @param ActivityReasonCategory $entity The entity * - * @return \Symfony\Component\Form\Form The form */ - private function createCreateForm(ActivityReasonCategory $entity) + private function createCreateForm(ActivityReasonCategory $entity): FormInterface { $form = $this->createForm(ActivityReasonCategoryType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'), @@ -131,9 +131,8 @@ class ActivityReasonCategoryController extends AbstractController * * @param ActivityReasonCategory $entity The entity * - * @return \Symfony\Component\Form\Form The form */ - private function createEditForm(ActivityReasonCategory $entity) + private function createEditForm(ActivityReasonCategory $entity): FormInterface { $form = $this->createForm(ActivityReasonCategoryType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', ['id' => $entity->getId()]), diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 0c65505ed..8805411e8 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -16,6 +16,8 @@ use Chill\ActivityBundle\Form\ActivityReasonType; use Chill\ActivityBundle\Repository\ActivityReasonRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Form; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; /** @@ -89,7 +91,7 @@ class ActivityReasonController extends AbstractController $entity = $em->getRepository(ActivityReason::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find ActivityReason entity.'); } @@ -112,10 +114,8 @@ class ActivityReasonController extends AbstractController * Creates a form to create a ActivityReason entity. * * @param ActivityReason $entity The entity - * - * @return \Symfony\Component\Form\Form The form */ - private function createCreateForm(ActivityReason $entity) + private function createCreateForm(ActivityReason $entity): FormInterface { $form = $this->createForm(ActivityReasonType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreason_create'), @@ -131,10 +131,8 @@ class ActivityReasonController extends AbstractController * Creates a form to edit a ActivityReason entity. * * @param ActivityReason $entity The entity - * - * @return \Symfony\Component\Form\Form The form */ - private function createEditForm(ActivityReason $entity) + private function createEditForm(ActivityReason $entity): FormInterface { $form = $this->createForm(ActivityReasonType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreason_update', ['id' => $entity->getId()]), diff --git a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php index ce38a94b3..bab2239bf 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php @@ -46,20 +46,20 @@ class ChargeType extends AbstractType 'required' => false, ]); - if ($options['show_start_date']) { + if (true === $options['show_start_date']) { $builder->add('startDate', ChillDateType::class, [ 'label' => 'Start of validity period', ]); } - if ($options['show_end_date']) { + if (true === $options['show_end_date']) { $builder->add('endDate', ChillDateType::class, [ 'required' => false, 'label' => 'End of validity period', ]); } - if ($options['show_help']) { + if (true === $options['show_help']) { $builder->add('help', ChoiceType::class, [ 'choices' => [ 'charge.help.running' => Charge::HELP_ASKED, diff --git a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php index ecbbe219e..9bc39fa00 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php @@ -45,13 +45,13 @@ class ResourceType extends AbstractType 'required' => false, ]); - if ($options['show_start_date']) { + if (true === $options['show_start_date']) { $builder->add('startDate', ChillDateType::class, [ 'label' => 'Start of validity period', ]); } - if ($options['show_end_date']) { + if (true === $options['show_end_date']) { $builder->add('endDate', ChillDateType::class, [ 'required' => false, 'label' => 'End of validity period', diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index c45acd41f..a4f78950e 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -97,7 +97,7 @@ final readonly class CalendarContext implements CalendarContextInterface 'data' => $this->translatableStringHelper->localize($template->getName()), ]); - if ($options['askMainPerson']) { + if (true === $options['askMainPerson']) { $builder->add('mainPerson', EntityType::class, [ 'class' => Person::class, 'multiple' => false, @@ -109,7 +109,7 @@ final readonly class CalendarContext implements CalendarContextInterface ]); } - if ($options['askThirdParty']) { + if (true === $options['askThirdParty']) { $builder->add('thirdParty', EntityType::class, [ 'class' => ThirdParty::class, 'multiple' => false, @@ -132,7 +132,7 @@ final readonly class CalendarContext implements CalendarContextInterface ] ); - if ($options['askMainPerson']) { + if (true === $options['askMainPerson']) { $data['mainPerson'] = $this->normalizer->normalize($contextGenerationData['mainPerson'] ?? null, 'docgen', [ 'docgen:expects' => Person::class, 'groups' => ['docgen:read'], @@ -142,7 +142,7 @@ final readonly class CalendarContext implements CalendarContextInterface ]); } - if ($options['askThirdParty']) { + if (true === $options['askThirdParty']) { $data['thirdParty'] = $this->normalizer->normalize($contextGenerationData['thirdParty'] ?? null, 'docgen', [ 'docgen:expects' => ThirdParty::class, 'groups' => ['docgen:read'], @@ -167,7 +167,7 @@ final readonly class CalendarContext implements CalendarContextInterface $options = $this->getOptions($template); $data = []; - if ($options['askMainPerson']) { + if (true === $options['askMainPerson']) { $data['mainPerson'] = null; if (1 === \count($entity->getPersons())) { @@ -175,7 +175,7 @@ final readonly class CalendarContext implements CalendarContextInterface } } - if ($options['askThirdParty']) { + if (true === $options['askThirdParty']) { $data['thirdParty'] = null; if (1 === \count($entity->getProfessionals())) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index 6efe14318..86fd03b8c 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -70,7 +70,7 @@ class CustomFieldController extends AbstractController $entity = $em->getRepository(CustomField::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find CustomField entity.'); } @@ -98,7 +98,7 @@ class CustomFieldController extends AbstractController ->getRepository(CustomFieldsGroup::class) ->find($cfGroupId); - if (!$cfGroup) { + if (null === $cfGroup) { throw $this->createNotFoundException('CustomFieldsGroup with id '.$cfGroupId.' is not found !'); } $entity->setCustomFieldsGroup($cfGroup); @@ -122,7 +122,7 @@ class CustomFieldController extends AbstractController $entity = $em->getRepository(CustomField::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find CustomField entity.'); } @@ -150,7 +150,7 @@ class CustomFieldController extends AbstractController /** * Creates a form to create a CustomField entity. * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createCreateForm(CustomField $entity, mixed $type) { @@ -174,7 +174,7 @@ class CustomFieldController extends AbstractController * * @param CustomField $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createEditForm(CustomField $entity, mixed $type) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 422851c2b..f4d780f4a 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -24,6 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Contracts\Translation\TranslatorInterface; @@ -81,7 +82,7 @@ class CustomFieldsGroupController extends AbstractController $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); } @@ -134,7 +135,7 @@ class CustomFieldsGroupController extends AbstractController $cFGroup = $em->getRepository(CustomFieldsGroup::class)->findOneById($cFGroupId); - if (!$cFGroup) { + if (null === $cFGroup) { throw $this->createNotFoundException('customFieldsGroup not found with '."id {$cFGroupId}"); } @@ -194,7 +195,7 @@ class CustomFieldsGroupController extends AbstractController $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroups entity.'); } @@ -237,7 +238,7 @@ class CustomFieldsGroupController extends AbstractController $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); } @@ -260,7 +261,7 @@ class CustomFieldsGroupController extends AbstractController $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); } @@ -320,7 +321,7 @@ class CustomFieldsGroupController extends AbstractController * * @param CustomFieldsGroup $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createCreateForm(CustomFieldsGroup $entity) { @@ -338,10 +339,8 @@ class CustomFieldsGroupController extends AbstractController * Creates a form to edit a CustomFieldsGroup entity. * * @param CustomFieldsGroup $entity The entity - * - * @return \Symfony\Component\Form\Form The form */ - private function createEditForm(CustomFieldsGroup $entity) + private function createEditForm(CustomFieldsGroup $entity): FormInterface { $form = $this->createForm(CustomFieldsGroupType::class, $entity, [ 'action' => $this->generateUrl('customfieldsgroup_update', ['id' => $entity->getId()]), @@ -354,10 +353,8 @@ class CustomFieldsGroupController extends AbstractController /** * create a form to make the group default. - * - * @return \Symfony\Component\Form\Form */ - private function createMakeDefaultForm(?CustomFieldsGroup $group = null): \Symfony\Component\Form\FormInterface + private function createMakeDefaultForm(?CustomFieldsGroup $group = null): FormInterface { return $this->createFormBuilder($group, [ 'method' => 'POST', diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index ac82503ce..6b22b3371 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -82,7 +82,7 @@ class CustomField */ public function getName($locale = null) { - if ($locale) { + if (null !== $locale) { if (isset($this->name[$locale])) { return $this->name[$locale]; } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php index df7c3600c..76eac4db7 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php @@ -72,7 +72,7 @@ class CustomFieldType extends AbstractType // check if the customField object is "new" // If no data is passed to the form, the data is "null". // This should be considered a new "customField" - if (!$customField || null === $customField->getId()) { + if (null === $customField || null === $customField->getId()) { $form->add('slug', TextType::class); } }); diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index e410ea5c1..c2cab43be 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -29,7 +29,7 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface */ public function reverseTransform($id): ?CustomFieldsGroup { - if (!$id) { + if (null === $id) { return null; } diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index 2063a5154..c8e5a23ef 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -72,7 +72,7 @@ final class EventController extends AbstractController 'id' => $event_id, ]); - if (!$event) { + if (null === $event) { throw $this->createNotFoundException('Unable to find this event.'); } @@ -273,10 +273,6 @@ final class EventController extends AbstractController #[\Symfony\Component\Routing\Attribute\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')] public function showAction(Event $event, Request $request) { - if (!$event) { - throw $this->createNotFoundException('Unable to find Event entity.'); - } - $this->denyAccessUnlessGranted( EventVoter::SEE_DETAILS, $event, @@ -308,7 +304,7 @@ final class EventController extends AbstractController $entity = $em->getRepository(Event::class)->find($event_id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find Event entity.'); } diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index e1e391ce7..f0c7d94e7 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -58,7 +58,7 @@ class EventTypeController extends AbstractController $entity = $em->getRepository(EventType::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find EventType entity.'); } @@ -110,7 +110,7 @@ class EventTypeController extends AbstractController $entity = $em->getRepository(EventType::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find EventType entity.'); } @@ -134,7 +134,7 @@ class EventTypeController extends AbstractController * * @param EventType $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createCreateForm(EventType $entity) { @@ -153,7 +153,7 @@ class EventTypeController extends AbstractController * * @param EventType $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createEditForm(EventType $entity) { diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index e8ff1ea44..f162882e4 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -250,7 +250,7 @@ final class ParticipationController extends AbstractController 'id' => $participation_id, ]); - if (!$participation) { + if (null === $participation) { throw $this->createNotFoundException('Unable to find participation.'); } diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 3d9e4f82b..2b11a7b4d 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -58,7 +58,7 @@ class RoleController extends AbstractController $entity = $em->getRepository(Role::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find Role entity.'); } @@ -110,7 +110,7 @@ class RoleController extends AbstractController $entity = $em->getRepository(Role::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find Role entity.'); } @@ -134,7 +134,7 @@ class RoleController extends AbstractController * * @param Role $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createCreateForm(Role $entity) { @@ -153,7 +153,7 @@ class RoleController extends AbstractController * * @param Role $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createEditForm(Role $entity) { diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index d390ede9c..29c00d5a6 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -58,7 +58,7 @@ class StatusController extends AbstractController $entity = $em->getRepository(Status::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find Status entity.'); } @@ -110,7 +110,7 @@ class StatusController extends AbstractController $entity = $em->getRepository(Status::class)->find($id); - if (!$entity) { + if (null === $entity) { throw $this->createNotFoundException('Unable to find Status entity.'); } @@ -134,7 +134,7 @@ class StatusController extends AbstractController * * @param Status $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createCreateForm(Status $entity) { @@ -153,7 +153,7 @@ class StatusController extends AbstractController * * @param Status $entity The entity * - * @return \Symfony\Component\Form\Form The form + * @return \Symfony\Component\Form\FormInterface The form */ private function createEditForm(Status $entity) { diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index 71dd7d872..3dc5bbdb3 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -88,11 +88,11 @@ class LoadAndUpdateLanguagesCommand extends Command foreach (Languages::getNames() as $code => $lang) { $excludeCode = ( ( - !$input->getOption(self::INCLUDE_REGIONAL_VERSION) + null === $input->getOption(self::INCLUDE_REGIONAL_VERSION) && strpos($code, '_') && !\in_array($code, $this->regionalVersionToInclude, true) ) || ( - !$input->getOption(self::INCLUDE_ANCIENT) + null === $input->getOption(self::INCLUDE_ANCIENT) && \in_array($code, $this->ancientToExclude, true) ) ); diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 82428943d..2a856a13c 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -54,7 +54,7 @@ final class PermissionsGroupController extends AbstractController { $permissionsGroup = $this->permissionsGroupRepository->find($id); - if (!$permissionsGroup) { + if (null === $permissionsGroup) { throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); } @@ -157,11 +157,11 @@ final class PermissionsGroupController extends AbstractController $permissionsGroup = $this->permissionsGroupRepository->find($pgid); $roleScope = $this->roleScopeRepository->find($rsid); - if (!$permissionsGroup) { + if (null === $permissionsGroup) { throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); } - if (!$roleScope) { + if (null === $roleScope) { throw $this->createNotFoundException('Unable to find RoleScope entity'); } @@ -213,7 +213,7 @@ final class PermissionsGroupController extends AbstractController { $permissionsGroup = $this->permissionsGroupRepository->find($id); - if (!$permissionsGroup) { + if (null === $permissionsGroup) { throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); } @@ -288,7 +288,7 @@ final class PermissionsGroupController extends AbstractController { $permissionsGroup = $this->permissionsGroupRepository->find($id); - if (!$permissionsGroup) { + if (null === $permissionsGroup) { throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); } @@ -341,7 +341,7 @@ final class PermissionsGroupController extends AbstractController $permissionsGroup = $this->permissionsGroupRepository ->find($id); - if (!$permissionsGroup) { + if (null === $permissionsGroup) { throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); } diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index a5144f4e2..2e89a8997 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -57,7 +57,7 @@ class UserController extends CRUDController $user = $em->getRepository(User::class)->find($uid); - if (!$user) { + if (null === $user) { throw $this->createNotFoundException('Unable to find User entity.'); } @@ -110,14 +110,14 @@ class UserController extends CRUDController $user = $em->getRepository(User::class)->find($uid); - if (!$user) { + if (null === $user) { throw $this->createNotFoundException('Unable to find User entity.'); } $groupCenter = $em->getRepository(GroupCenter::class) ->find($gcid); - if (!$groupCenter) { + if (null === $groupCenter) { throw $this->createNotFoundException('Unable to find groupCenter entity'); } @@ -434,7 +434,7 @@ class UserController extends CRUDController 'permissionsGroup' => $permissionsGroup, ]); - if (!$groupCenterManaged) { + if (null === $groupCenterManaged) { $groupCenter = new GroupCenter(); $groupCenter->setCenter($center); $groupCenter->setPermissionsGroup($permissionsGroup); diff --git a/src/Bundle/ChillMainBundle/Form/Type/AddressType.php b/src/Bundle/ChillMainBundle/Form/Type/AddressType.php index 5b21a4808..adba5a458 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/AddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/AddressType.php @@ -36,7 +36,7 @@ class AddressType extends AbstractType { $builder ->add('street', TextType::class, [ - 'required' => !$options['has_no_address'], // true if has no address is false + 'required' => false === $options['has_no_address'], // true if has no address is false ]) ->add('streetNumber', TextType::class, [ 'required' => false, @@ -44,10 +44,10 @@ class AddressType extends AbstractType ->add('postCode', PostalCodeType::class, [ 'label' => 'Postal code', 'placeholder' => 'Choose a postal code', - 'required' => !$options['has_no_address'], // true if has no address is false + 'required' => false === $options['has_no_address'], // true if has no address is false ]); - if ($options['has_valid_from']) { + if (true === $options['has_valid_from']) { $builder ->add( 'validFrom', @@ -58,7 +58,7 @@ class AddressType extends AbstractType ); } - if ($options['has_no_address']) { + if (true === $options['has_no_address']) { $builder ->add('isNoAddress', ChoiceType::class, [ 'required' => true, diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php index 65a4ea6a0..226dcf15a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php @@ -30,7 +30,7 @@ final class ChillTextareaType extends AbstractType { public function buildView(FormView $view, FormInterface $form, array $options): void { - if (!$options['disable_editor']) { + if (false === $options['disable_editor']) { $view->vars['attr']['ckeditor'] = true; } } diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index 14f8fcf96..52ac34150 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -113,7 +113,7 @@ class UserType extends AbstractType ]); // @phpstan-ignore-next-line - if ($options['is_creation'] && $this->parameterBag->get('chill_main.access_user_change_password')) { + if ((true === $options['is_creation']) && $this->parameterBag->get('chill_main.access_user_change_password')) { $builder->add('plainPassword', RepeatedType::class, [ 'mapped' => false, 'type' => PasswordType::class, diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php index 325fba31d..f8a767287 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php @@ -96,12 +96,12 @@ class SearchApiQuery { $isMultiple = \count($this->whereClauses); $where = - ($isMultiple ? '(' : ''). + ($isMultiple > 0 ? '(' : ''). \implode( - ($isMultiple ? ')' : '').' AND '.($isMultiple ? '(' : ''), + ($isMultiple > 0 ? ')' : '').' AND '.($isMultiple > 0 ? '(' : ''), $this->whereClauses ). - ($isMultiple ? ')' : ''); + ($isMultiple > 0 ? ')' : ''); $select = $this->buildSelectClause($countOnly); diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php index d77542d78..07cd71f61 100644 --- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php @@ -79,7 +79,7 @@ final class ChillPersonMoveCommand extends Command $sqls = $this->mover->getSQL($from, $to, $deleteEntities); - if ($input->getOption('dump-sql')) { + if (true === $input->getOption('dump-sql')) { foreach ($sqls as $sql) { $output->writeln($sql); } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php index 9a025dbb1..c0cb5c4b3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php @@ -33,7 +33,7 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController * @ParamConverter("accompanyingPeriodWork", options={"id": "acpw_id"}) */ #[Route(path: '{_locale}/person/accompanying-period/work/{id}/assign-duplicate', name: 'chill_person_accompanying_period_work_assign_duplicate')] - public function assignDuplicate(AccompanyingPeriodWork $acpw, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + public function assignDuplicate(AccompanyingPeriodWork $acpw, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|Response { $accompanyingPeriod = $acpw->getAccompanyingPeriod(); @@ -80,7 +80,7 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController * @ParamConverter("acpw2", options={"id": "acpw2_id"}) */ #[Route(path: '/{_locale}/person/{acpw1_id}/acpw-duplicate/{acpw2_id}/confirm', name: 'chill_person_acpw_duplicate_confirm')] - public function confirmAction(AccompanyingPeriodWork $acpw1, AccompanyingPeriodWork $acpw2, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + public function confirmAction(AccompanyingPeriodWork $acpw1, AccompanyingPeriodWork $acpw2, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|Response { $accompanyingPeriod = $acpw1->getAccompanyingPeriod(); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 0dee85ebe..733b30801 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -217,7 +217,7 @@ class PersonAddressController extends AbstractController } /** - * @return \Symfony\Component\Form\Form + * @return \Symfony\Component\Form\FormInterface */ protected function createCreateForm(Person $person, Address $address) { @@ -237,7 +237,7 @@ class PersonAddressController extends AbstractController } /** - * @return \Symfony\Component\Form\Form + * @return \Symfony\Component\Form\FormInterface */ protected function createEditForm(Person $person, Address $address) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index bcd531d52..febf50982 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -608,7 +608,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI */ public function containsAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool { - return ($this->participationsContainAccompanyingPeriod($accompanyingPeriod)) ? false : true; + return null === $this->participationsContainAccompanyingPeriod($accompanyingPeriod); } /** @@ -1428,7 +1428,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI { $participation = $this->participationsContainAccompanyingPeriod($accompanyingPeriod); - if (!null === $participation) { + if (null !== $participation) { $participation->setEndDate(new \DateTime()); $this->accompanyingPeriodParticipations->removeElement($participation); } diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index d23c3367b..a414f8402 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -229,7 +229,7 @@ class PersonType extends AbstractType 'by_reference' => false, ]); - if ($options['cFGroup']) { + if (true === $options['cFGroup']) { $builder ->add( 'cFData', diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php index f22357baf..4d7026652 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php @@ -28,7 +28,7 @@ class PersonAltNameType extends AbstractType foreach ($this->getKeyChoices() as $label => $key) { $builder->add( $key, - $options['force_hidden'] ? HiddenType::class : TextType::class, + true === $options['force_hidden'] ? HiddenType::class : TextType::class, [ 'label' => $label, 'required' => false, diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index a5f888f5f..a884094f8 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -45,7 +45,7 @@ class PersonPhoneType extends AbstractType $oldPersonPhone = $this->em->getUnitOfWork() ->getOriginalEntityData($event->getData()); - if ($oldPersonPhone['phonenumber'] ?? null !== $event->getForm()->getData()->getPhonenumber()) { + if (($oldPersonPhone['phonenumber'] ?? null) !== $event->getForm()->getData()->getPhonenumber()) { $type = $this->phonenumberHelper->getType($event->getData()->getPhonenumber()); $event->getData()->setType($type); } diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index c5d1dfc1c..ab2462d38 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -100,7 +100,7 @@ class SimilarPersonMatcher $notDuplicatePersons = $this->personNotDuplicateRepository->findNotDuplicatePerson($person); - if (\count($notDuplicatePersons)) { + if (count($notDuplicatePersons) > 0) { $qb->andWhere($qb->expr()->notIn('p.id', ':notDuplicatePersons')); $qb->setParameter('notDuplicatePersons', $notDuplicatePersons); } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php index 563abc340..7b3d16cf0 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php @@ -171,8 +171,8 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize private function performChecks($data): void { if ( - null === $data['concerned'] ?? null - && false === \is_array('concerned') + !isset($data['concerned']) + || !\is_array($data['concerned']) ) { throw new Exception\UnexpectedValueException("The schema does not have any key 'concerned'"); } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 199c9df9f..260f43c44 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -210,9 +210,21 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar return $data; } - return [...$data, 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($person), $format, $context), 'altNames' => $this->normalizeAltNames($person->getAltNames()), 'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null, 'current_residential_addresses' => $currentResidentialAddresses ? - $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : - null]; + return [ + ...$data, + 'centers' => $this->normalizer->normalize( + $this->centerResolverManager->resolveCenters($person), + $format, + $context + ), + 'altNames' => $this->normalizeAltNames($person->getAltNames()), + 'current_household_id' => $household !== null ? + $this->normalizer->normalize($household->getId(), $format, $context) : + null, + 'current_residential_addresses' => $currentResidentialAddresses !== [] ? + $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : + null + ]; } public function supportsDenormalization($data, $type, $format = null, array $context = []): bool diff --git a/src/Bundle/ChillReportBundle/Controller/ReportController.php b/src/Bundle/ChillReportBundle/Controller/ReportController.php index b682adfe8..8bc0426d1 100644 --- a/src/Bundle/ChillReportBundle/Controller/ReportController.php +++ b/src/Bundle/ChillReportBundle/Controller/ReportController.php @@ -21,6 +21,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Form; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Contracts\Translation\TranslatorInterface; @@ -46,8 +48,6 @@ class ReportController extends AbstractController * @param int $person_id the id of the person * @param int $cf_group_id the id of the report type * @param Request $request The request containing the form data (from the newAction) - * - * @return Response the web page */ public function createAction($person_id, $cf_group_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { @@ -105,17 +105,15 @@ class ReportController extends AbstractController * * @param int|string $person_id the id of the person * @param int|string $report_id the id of the report - * - * @return Response the web page */ public function editAction(int|string $person_id, int|string $report_id): \Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); /** @var Report $report */ - $report = $em->getRepository('ChillReportBundle:Report')->find($report_id); + $report = $em->getRepository(Report::class)->find($report_id); - if (!$report) { + if (null == $report) { throw $this->createNotFoundException($this->translator->trans('Unable to find this report.')); } @@ -147,17 +145,15 @@ class ReportController extends AbstractController * * @param int $cf_group_id The id of the report type to export * @param Request $request The request - * - * @return A csv file with all the reports of the selected type */ - public function exportAction($cf_group_id, Request $request) + public function exportAction($cf_group_id, Request $request): \Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); $cFGroup = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($cf_group_id); - $reports = $em->getRepository('ChillReportBundle:Report')->findByCFGroup($cFGroup); + $reports = $em->getRepository(Report::class)->findByCFGroup($cFGroup); - $response = $this->render('ChillReportBundle:Report:export.csv.twig', [ + $response = $this->render('@ChillReport/Report/export.csv.twig', [ 'reports' => $reports, 'cf_group' => $cFGroup, ]); @@ -173,8 +169,6 @@ class ReportController extends AbstractController * * @param int $person_id the id of the person * @param Request $request The request - * - * @return Response the web page */ public function listAction($person_id, Request $request): \Symfony\Component\HttpFoundation\Response { @@ -192,8 +186,7 @@ class ReportController extends AbstractController ); $total = $em - ->createQuery('SELECT COUNT(r.id) FROM ChillReportBundle:Report r ' - .'WHERE r.person = :person AND r.scope IN (:scopes) ') + ->createQuery('SELECT COUNT(r.id) FROM '.Report::class.' r WHERE r.person = :person AND r.scope IN (:scopes) ') ->setParameter('person', $person) ->setParameter('scopes', $reachableScopes) ->getSingleScalarResult(); @@ -202,7 +195,7 @@ class ReportController extends AbstractController $paginator = $this->paginator->create($total); $reports = $em->createQuery('SELECT r - FROM ChillReportBundle:Report r + FROM '.Report::class.' r WHERE r.person = :person AND r.scope IN (:scopes) ORDER BY r.date DESC') ->setParameter('person', $person) @@ -230,8 +223,6 @@ class ReportController extends AbstractController * @param int $person_id the id of the person * @param int $cf_group_id the id of the report type * @param Request $request The request - * - * @return Response the web page */ public function newAction($person_id, $cf_group_id, Request $request): \Symfony\Component\HttpFoundation\Response { @@ -278,8 +269,6 @@ class ReportController extends AbstractController * * @param int $person_id the id of the person * @param Request $request The request - * - * @return Response the web page */ public function selectReportTypeAction($person_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { @@ -342,8 +331,6 @@ class ReportController extends AbstractController * (a csv file with all the report of this type). * * @param Request $request The request - * - * @return Response the web page */ public function selectReportTypeForExportAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { @@ -389,16 +376,14 @@ class ReportController extends AbstractController * * @param int $person_id the id of the person * @param int $report_id the id of the report - * - * @return Response the web page */ public function updateAction($person_id, $report_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); - $report = $em->getRepository('ChillReportBundle:Report')->find($report_id); + $report = $em->getRepository(Report::class)->find($report_id); - if (!$report) { + if (null === $report) { throw $this->createNotFoundException($this->translator->trans('Unable to find this report.')); } @@ -445,8 +430,6 @@ class ReportController extends AbstractController * * @param int $report_id the id of the report * @param int $person_id the id of the person - * - * @return Response the web page */ public function viewAction($report_id, $person_id): \Symfony\Component\HttpFoundation\Response { @@ -454,9 +437,9 @@ class ReportController extends AbstractController $person = $em->getRepository(Person::class)->find($person_id); - $entity = $em->getRepository('ChillReportBundle:Report')->find($report_id); + $entity = $em->getRepository(Report::class)->find($report_id); - if (!$entity || !$person) { + if (null === $entity || null === $person) { throw $this->createNotFoundException($this->translator->trans('Unable to find this report.')); } @@ -479,10 +462,8 @@ class ReportController extends AbstractController * Creates a form to create a Report entity. * * @param Report $entity The entity - * - * @return \Symfony\Component\Form\Form The form */ - private function createCreateForm(Report $entity, Person $person, mixed $cFGroup): \Symfony\Component\Form\FormInterface + private function createCreateForm(Report $entity, Person $person, mixed $cFGroup): FormInterface { return $this->createForm(ReportType::class, $entity, [ 'action' => $this->generateUrl( @@ -501,10 +482,8 @@ class ReportController extends AbstractController * Creates a form to edit a Report entity. * * @param Report $entity the report to edit - * - * @return \Symfony\Component\Form\Form The form */ - private function createEditForm(Report $entity): \Symfony\Component\Form\FormInterface + private function createEditForm(Report $entity): FormInterface { return $this->createForm(ReportType::class, $entity, [ 'action' => $this->generateUrl( diff --git a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php index c45abf20a..a6930b724 100644 --- a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php +++ b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php @@ -48,7 +48,7 @@ class TimelineReportProvider implements TimelineProviderInterface public function getEntities(array $ids) { - $reports = $this->em->getRepository('ChillReportBundle:Report') + $reports = $this->em->getRepository(Report::class) ->findBy(['id' => $ids]); $result = []; diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php index 7fa7a3c4c..9a9f0c8e6 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php @@ -81,7 +81,7 @@ class SingleTaskListType extends AbstractType 'label' => 'Assignee', ]); - if ($options['add_status']) { + if (true === $options['add_status']) { $builder ->add('status', ChoiceType::class, [ 'choices' => $statuses, @@ -91,7 +91,7 @@ class SingleTaskListType extends AbstractType ]); } - if ($options['add_type']) { + if (true === $options['add_type']) { $types = $this->getTaskTypesChoices($options); if (\count($types) > 0) {