fix: SA: Split critical issues in its own file.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera 2021-11-16 13:55:55 +01:00
parent c68bda5c9b
commit 8ede116cf5
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
12 changed files with 333 additions and 380 deletions

View File

@ -70,11 +70,6 @@ parameters:
count: 1
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
-
message: "#^Undefined variable\\: \\$person$#"
count: 1
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -85,21 +80,6 @@ parameters:
count: 2
path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
-
message: "#^Access to an undefined property Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory\\:\\:\\$oldParent\\.$#"
count: 2
path: src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php
-
message: "#^Access to an undefined property Chill\\\\AsideActivityBundle\\\\Form\\\\AsideActivityCategoryType\\:\\:\\$categoryRender\\.$#"
count: 2
path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php
-
message: "#^Access to an undefined property Chill\\\\AsideActivityBundle\\\\Form\\\\AsideActivityFormType\\:\\:\\$translatableStringHelper\\.$#"
count: 1
path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -125,11 +105,6 @@ parameters:
count: 2
path: src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
-
message: "#^Access to an undefined property Chill\\\\CalendarBundle\\\\DataFixtures\\\\ORM\\\\LoadCalendarRange\\:\\:\\$userRepository\\.$#"
count: 2
path: src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -225,11 +200,6 @@ parameters:
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
-
message: "#^Access to an undefined property Chill\\\\CustomFieldsBundle\\\\Form\\\\DataTransformer\\\\JsonCustomFieldToArrayTransformer\\:\\:\\$customField\\.$#"
count: 3
path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php
-
message: "#^Instantiated class PhpOffice\\\\PhpWord\\\\TemplateProcessor not found\\.$#"
count: 1
@ -320,11 +290,6 @@ parameters:
count: 2
path: src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php
-
message: "#^Undefined variable\\: \\$id$#"
count: 1
path: src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php
-
message: "#^Casting to string something that's already string\\.$#"
count: 5
@ -340,11 +305,6 @@ parameters:
count: 2
path: src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:getRoleFor\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php
-
message: "#^Variable \\$entity in isset\\(\\) is never defined\\.$#"
count: 1
@ -380,11 +340,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\CRUD\\\\Routing\\\\CRUDRoutesLoader\\:\\:\\$apiConfig\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -400,11 +355,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:tempOutput\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
@ -460,11 +410,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Controller\\\\AdminCountryCRUDController\\:\\:\\$paginatorFactory\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/AdminCountryCRUDController.php
-
message: "#^Cannot unset offset '_token' on array\\{formatter\\: mixed, export\\: mixed, centers\\: mixed, alias\\: string\\}\\.$#"
count: 1
@ -480,11 +425,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Controller/PostalCodeController.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createEditForm\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/UserController.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
@ -535,11 +475,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Entity\\\\RoleScope\\:\\:\\$new\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/RoleScope.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -635,11 +570,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php
-
message: "#^Undefined variable\\: \\$current$#"
count: 1
path: src/Bundle/ChillMainBundle/Pagination/PageGenerator.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
@ -660,36 +590,11 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Routing\\\\MenuComposer\\:\\:\\$routeCollection\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Routing/MenuComposer.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Search\\\\SearchApiResult\\:\\:\\$relevance\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Search/SearchApiResult.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedAttributes\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedClasses\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:isGranted\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
@ -815,26 +720,11 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Controller\\\\PersonController\\:\\:\\$security\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Controller/PersonController.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Controller/PersonController.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Controller\\\\TimelinePersonController\\:\\:\\$authorizationHelper\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\DataFixtures\\\\ORM\\\\LoadHousehold\\:\\:\\$personIds\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php
-
message: "#^Variable method call on mixed\\.$#"
count: 1
@ -855,31 +745,11 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\:\\:\\$work\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Implicit array creation is not allowed \\- variable \\$centers might not exist\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Household\\\\PersonHouseholdAddress\\:\\:\\$relation\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Person\\:\\:\\$currentHouseholdParticipationAt\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Entity/Person.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -950,11 +820,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
-
message: "#^Undefined variable\\: \\$choiceSlug$#"
count: 1
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -975,11 +840,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Form\\\\CreationPersonType\\:\\:\\$centerTransformer\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/CreationPersonType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
@ -1005,11 +865,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Household/MembersEditor.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Household\\\\MembersEditorFactory\\:\\:\\$validator\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
-
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
count: 1
@ -1020,36 +875,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:countBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$action$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$limit$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$offset$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$orderBy$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
@ -1075,11 +900,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
-
message: "#^Variable variables are not allowed\\.$#"
count: 4
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -1095,16 +915,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php
-
message: "#^Function Chill\\\\PersonBundle\\\\Serializer\\\\Normalizer\\\\·\\\\is_array not found\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php
-
message: "#^Variable method call on object\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
@ -1115,16 +925,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php
-
message: "#^Undefined variable\\: \\$value$#"
count: 1
path: src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php
-
message: "#^Parameter \\$personRepostory of method Chill\\\\PersonBundle\\\\Widget\\\\PersonListWidget\\:\\:__construct\\(\\) has invalid type Chill\\\\PersonBundle\\\\Widget\\\\PersonRepository\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -1190,11 +990,6 @@ parameters:
count: 1
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
-
message: "#^Undefined variable\\: \\$choiceSlug$#"
count: 1
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -1205,21 +1000,11 @@ parameters:
count: 1
path: src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php
-
message: "#^Access to an undefined property Chill\\\\ReportBundle\\\\Timeline\\\\TimelineReportProvider\\:\\:\\$security\\.$#"
count: 4
path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 4
path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php
-
message: "#^Undefined variable\\: \\$type$#"
count: 1
path: src/Bundle/ChillTaskBundle/Controller/TaskController.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
@ -1295,11 +1080,6 @@ parameters:
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php
-
message: "#^Call to an undefined method Chill\\\\ThirdPartyBundle\\\\Form\\\\Type\\\\PickThirdPartyTypeCategoryType\\:\\:transform\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1

212
phpstan-critical.neon Normal file
View File

@ -0,0 +1,212 @@
parameters:
ignoreErrors:
-
message: "#^Implicit array creation is not allowed \\- variable \\$centers might not exist\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Person\\:\\:\\$currentHouseholdParticipationAt\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Entity/Person.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Household\\\\PersonHouseholdAddress\\:\\:\\$relation\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\:\\:\\$work\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Undefined variable\\: \\$person$#"
count: 1
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Household\\\\MembersEditorFactory\\:\\:\\$validator\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
-
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:countBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$action$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$limit$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$offset$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$orderBy$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Variable variables are not allowed\\.$#"
count: 4
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
-
message: "#^Function Chill\\\\PersonBundle\\\\Serializer\\\\Normalizer\\\\·\\\\is_array not found\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php
-
message: "#^Undefined variable\\: \\$value$#"
count: 1
path: src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php
-
message: "#^Undefined variable\\: \\$choiceSlug$#"
count: 1
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
-
message: "#^Undefined variable\\: \\$choiceSlug$#"
count: 1
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
-
message: "#^Undefined variable\\: \\$type$#"
count: 1
path: src/Bundle/ChillTaskBundle/Controller/TaskController.php
-
message: "#^Undefined variable\\: \\$id$#"
count: 1
path: src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:getRoleFor\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\CRUD\\\\Routing\\\\CRUDRoutesLoader\\:\\:\\$apiConfig\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:tempOutput\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Controller\\\\AdminCountryCRUDController\\:\\:\\$paginatorFactory\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/AdminCountryCRUDController.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createEditForm\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/UserController.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Entity\\\\RoleScope\\:\\:\\$new\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/RoleScope.php
-
message: "#^Undefined variable\\: \\$current$#"
count: 1
path: src/Bundle/ChillMainBundle/Pagination/PageGenerator.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Routing\\\\MenuComposer\\:\\:\\$routeCollection\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Routing/MenuComposer.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Search\\\\SearchApiResult\\:\\:\\$relevance\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Search/SearchApiResult.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedAttributes\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedClasses\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:isGranted\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Controller\\\\PersonController\\:\\:\\$security\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Controller/PersonController.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Controller\\\\TimelinePersonController\\:\\:\\$authorizationHelper\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\DataFixtures\\\\ORM\\\\LoadHousehold\\:\\:\\$personIds\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Form\\\\CreationPersonType\\:\\:\\$centerTransformer\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/CreationPersonType.php
-
message: "#^Access to an undefined property Chill\\\\ReportBundle\\\\Timeline\\\\TimelineReportProvider\\:\\:\\$security\\.$#"
count: 4
path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php
-
message: "#^Access to an undefined property Chill\\\\AsideActivityBundle\\\\Entity\\\\AsideActivityCategory\\:\\:\\$oldParent\\.$#"
count: 2
path: src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php
-
message: "#^Access to an undefined property Chill\\\\AsideActivityBundle\\\\Form\\\\AsideActivityCategoryType\\:\\:\\$categoryRender\\.$#"
count: 2
path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php
-
message: "#^Access to an undefined property Chill\\\\AsideActivityBundle\\\\Form\\\\AsideActivityFormType\\:\\:\\$translatableStringHelper\\.$#"
count: 1
path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
-
message: "#^Access to an undefined property Chill\\\\CalendarBundle\\\\DataFixtures\\\\ORM\\\\LoadCalendarRange\\:\\:\\$userRepository\\.$#"
count: 2
path: src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php
-
message: "#^Access to an undefined property Chill\\\\CustomFieldsBundle\\\\Form\\\\DataTransformer\\\\JsonCustomFieldToArrayTransformer\\:\\:\\$customField\\.$#"
count: 3
path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php
-
message: "#^Call to an undefined method Chill\\\\ThirdPartyBundle\\\\Form\\\\Type\\\\PickThirdPartyTypeCategoryType\\:\\:transform\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php

View File

@ -17,5 +17,6 @@ parameters:
- src/Bundle/*/src/Resources/*
includes:
- phpstan-critical.neon
- phpstan-baseline.neon

View File

@ -23,6 +23,7 @@ use Chill\MainBundle\Security\RoleProvider;
use Doctrine\ORM\EntityManagerInterface;
use Chill\MainBundle\Entity\GroupCenter;
use Chill\MainBundle\Entity\RoleScope;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Helper for authorizations.
@ -147,7 +148,9 @@ class AuthorizationHelper implements AuthorizationHelperInterface
if (NULL === $scope) {
return true;
} elseif (is_iterable($scope)) {
}
if (is_iterable($scope)) {
foreach ($scope as $s) {
if ($s === $roleScope->getScope()) {
return true;
@ -176,14 +179,11 @@ class AuthorizationHelper implements AuthorizationHelperInterface
/**
* Get reachable Centers for the given user, role,
* and optionnaly Scope
* and optionally Scope
*
* @param User $user
* @param string|Role $role
* @param null|Scope $scope
* @return Center[]|array
*/
public function getReachableCenters(User $user, string $role, ?Scope $scope = null): array
public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array
{
if ($role instanceof Role) {
$role = $role->getRole();
@ -199,14 +199,14 @@ class AuthorizationHelper implements AuthorizationHelperInterface
if ($scope === null) {
$centers[] = $groupCenter->getCenter();
break 1;
} else {
}
if ($scope->getId() == $roleScope->getScope()->getId()){
$centers[] = $groupCenter->getCenter();
break 1;
}
}
}
}
}
@ -242,12 +242,10 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @deprecated Use getReachableCircles
*
* @param User $user
* @param string role
* @param Center|Center[] $center
* @return Scope[]|array
*/
public function getReachableScopes(User $user, string $role, $center): array
public function getReachableScopes(UserInterface $user, string $role, $center): array
{
if ($role instanceof Role) {
$role = $role->getRole();
@ -259,12 +257,11 @@ class AuthorizationHelper implements AuthorizationHelperInterface
/**
* Return all reachable circle for a given user, center and role
*
* @param User $user
* @param string|Role $role
* @param Center|Center[] $center
* @return Scope[]
*/
public function getReachableCircles(User $user, $role, $center)
public function getReachableCircles(UserInterface $user, $role, $center)
{
$scopes = [];

View File

@ -4,29 +4,23 @@ namespace Chill\MainBundle\Security\Authorization;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\User\UserInterface;
interface AuthorizationHelperInterface
{
/**
* Get reachable Centers for the given user, role,
* and optionnaly Scope
*
* @param User $user
* @param string|Role $role
* @param null|Scope $scope
* @return Center[]
*/
public function getReachableCenters(User $user, string $role, ?Scope $scope = null): array;
public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array;
/**
* @param User $user
* @param string $role
* @param Center|Center[]|array $center
* @return array
*/
public function getReachableScopes(User $user, string $role, $center): array;
public function getReachableScopes(UserInterface $user, string $role, $center): array;
}

View File

@ -1044,9 +1044,9 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
{
if (count($this->getPersons()) === 0){
return null;
} else {
return $this->getPersons()->first()->getCenter();
}
return $this->getPersons()->first()->getCenter();
}
/**
@ -1116,7 +1116,9 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
{
if ($this->getPersonLocation() instanceof Person) {
return 'person';
} elseif ($this->getAddressLocation() instanceof Address) {
}
if ($this->getAddressLocation() instanceof Address) {
return 'address';
} else {
return 'none';
@ -1137,11 +1139,11 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
public function getGroupSequence()
{
if ($this->getStep() == self::STEP_DRAFT)
{
if ($this->getStep() == self::STEP_DRAFT) {
return [[self::STEP_DRAFT]];
} elseif ($this->getStep() == self::STEP_CONFIRMED)
{
}
if ($this->getStep() == self::STEP_CONFIRMED) {
return [[self::STEP_DRAFT, self::STEP_CONFIRMED]];
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
@ -34,7 +36,7 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
public function findOneBy(array $criteria): ?AccompanyingPeriodWork
{
return $this->findOneBy($criteria);
return $this->repository->findOneBy($criteria);
}
public function getClassName()

View File

@ -1,22 +1,7 @@
<?php
/*
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Search;
use Chill\MainBundle\Search\AbstractSearch;
@ -38,7 +23,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
protected PaginatorFactory $paginatorFactory;
protected PersonACLAwareRepositoryInterface $personACLAwareRepository;
const NAME = "person_regular";
public const NAME = "person_regular";
private const POSSIBLE_KEYS = [
'_default', 'firstname', 'lastname', 'birthdate', 'birthdate-before',
@ -102,7 +87,9 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
'preview' => $options[SearchInterface::SEARCH_PREVIEW_OPTION],
'paginator' => $paginator
));
} elseif ($format === 'json') {
}
if ($format === 'json') {
return [
'results' => $this->search($terms, $start, $limit, \array_merge($options, [ 'simplify' => true ])),
'pagination' => [
@ -113,14 +100,9 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
}
/**
*
* @param string $pattern
* @param int $start
* @param int $limit
* @param array $options
* @return Person[]
*/
protected function search(array $terms, $start, $limit, array $options = array())
protected function search(array $terms, int $start, int $limit, array $options = [])
{
[
'_default' => $default,
@ -131,7 +113,6 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
'birthdate-after' => $birthdateAfter,
'gender' => $gender,
'nationality' => $countryCode,
] = $terms + \array_fill_keys(self::POSSIBLE_KEYS, null);
foreach (['birthdateBefore', 'birthdateAfter', 'birthdate'] as $v) {

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Chill\PersonBundle\Serializer\Normalizer;
use Chill\PersonBundle\Entity\Household\Position;
@ -33,9 +35,9 @@ class MembersEditorNormalizer implements DenormalizerInterface, DenormalizerAwar
// household)
if (NULL === $data['destination']) {
return $this->denormalizeLeave($data, $type, $format, $context);
} else {
return $this->denormalizeMove($data, $type, $format, $context);
}
return $this->denormalizeMove($data, $type, $format, $context);
}
private function performChecks($data): void

View File

@ -67,7 +67,7 @@ class PersonNormalizer implements
$this->centerResolverDispatcher = $centerResolverDispatcher;
}
public function normalize($person, string $format = null, array $context = array())
public function normalize($person, string $format = null, array $context = [])
{
/** @var Household $household */
$household = $person->getCurrentHousehold();
@ -128,22 +128,44 @@ class PersonNormalizer implements
$person = new Person();
}
foreach (['firstName', 'lastName', 'phonenumber', 'mobilenumber', 'gender']
as $item) {
if (\array_key_exists($item, $data)) {
$person->{'set'.\ucfirst($item)}($data[$item]);
$properties = ['firstName', 'lastName', 'phonenumber', 'mobilenumber', 'gender'];
$properties = array_filter(
$properties,
static fn (string $property): bool => array_key_exists($property, $data)
);
foreach ($properties as $item) {
$callable = [$person, sprintf('set%s', ucfirst($item))];
if (is_callable($callable)) {
$closure = \Closure::fromCallable($callable);
$closure($data[$item]);
}
}
foreach ([
$propertyToClassMapping = [
'birthdate' => \DateTime::class,
'deathdate' => \DateTime::class,
'center' => Center::class
] as $item => $class) {
if (\array_key_exists($item, $data)) {
'center' => Center::class,
];
$propertyToClassMapping = array_filter(
$propertyToClassMapping,
static fn (string $item): bool => array_key_exists($item, $data)
);
foreach ($propertyToClassMapping as $item => $class) {
$object = $this->denormalizer->denormalize($data[$item], $class, $format, $context);
if ($object instanceof $class) {
$person->{'set'.\ucfirst($item)}($object);
$callable = [$object, sprintf('set%s', ucfirst($item))];
if (is_callable($callable)) {
$closure = \Closure::fromCallable($callable);
$closure($object);
}
}
}

View File

@ -1,35 +1,22 @@
<?php
/*
* Copyright (C) 2016 Julien Fastré <julien.fastre@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\MainBundle\Templating\Widget\WidgetInterface;
use Doctrine\ORM\EntityRepository;
use Chill\PersonBundle\Repository\PersonRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\Expr;
use Doctrine\DBAL\Types\Types;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\EntityManager;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Twig\Environment;
/**
@ -42,44 +29,21 @@ use Twig\Environment;
*/
class PersonListWidget implements WidgetInterface
{
/**
* Repository for persons
*
* @var PersonRepository
*/
protected $personRepository;
protected PersonRepository $personRepository;
/**
* The entity manager
*
* @var EntityManager
*/
protected $entityManager;
protected EntityManagerInterface $entityManager;
/**
* the authorization helper
*
* @var AuthorizationHelper;
*/
protected $authorizationHelper;
protected AuthorizationHelperInterface $authorizationHelper;
/**
*
* @var TokenStorage
*/
protected $tokenStorage;
protected TokenStorageInterface $tokenStorage;
/**
*
* @var UserInterface
*/
protected $user;
protected UserInterface $user;
public function __construct(
PersonRepository $personRepostory,
EntityManager $em,
AuthorizationHelper $authorizationHelper,
TokenStorage $tokenStorage
EntityManagerInterface $em,
AuthorizationHelperInterface $authorizationHelper,
TokenStorageInterface $tokenStorage
) {
$this->personRepository = $personRepostory;
$this->authorizationHelper = $authorizationHelper;
@ -88,11 +52,8 @@ class PersonListWidget implements WidgetInterface
}
/**
*
* @param type $place
* @param array $context
* @param array $config
* @return string
*/
public function render(Environment $env, $place, array $context, array $config)
{
@ -134,8 +95,10 @@ class PersonListWidget implements WidgetInterface
. "implements %s", $config['filtering_class'],
PersonListWidget\PersonFilteringInterface::class));
}
$ids = $filteringClass->getPersonIds($this->entityManager,
$this->getUser());
$ids = $filteringClass->getPersonIds(
$this->entityManager,
$this->getUser()
);
$in = (new Expr())->in('person.id', ':ids');
$and->add($in);
$qb->setParameter('ids', $ids);
@ -178,12 +141,7 @@ class PersonListWidget implements WidgetInterface
);
}
/**
*
* @return UserInterface
* @throws \RuntimeException
*/
private function getUser()
private function getUser(): UserInterface
{
$token = $this->tokenStorage->getToken();
@ -193,9 +151,10 @@ class PersonListWidget implements WidgetInterface
$user = $token->getUser();
if (!$user instanceof UserInterface || $user == null) {
throw new \RuntimeException("the user should implement UserInterface. "
. "Are you logged in ?");
if ($user === null) {
throw new \RuntimeException(
'The user should implement UserInterface. Are you logged in ?'
);
}
return $user;

View File

@ -22,6 +22,8 @@ namespace Chill\PersonBundle\Widget\PersonListWidget;
use Doctrine\ORM\EntityManager;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
@ -78,8 +80,7 @@ interface PersonFilteringInterface
}
* ```
*
* @param EntityManager $em
* @return int[] an array of persons id to show
*/
public function getPersonIds(EntityManager $em, User $user);
public function getPersonIds(EntityManagerInterface $em, UserInterface $user);
}