From e2ab3bfc6e30462bfa913f8be3396664a97fc859 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 9 Nov 2021 11:31:20 +0000 Subject: [PATCH] Add PHPStan project with level 1. --- composer.json | 1 + phpstan-baseline.neon | 647 ++++++++++++++++++ phpstan.neon.dist | 146 ++++ .../Controller/CalendarController.php | 6 +- .../DocGeneratorTemplateController.php | 2 + .../CRUD/Controller/ApiController.php | 2 + .../ChillMainBundle/Doctrine/Model/Point.php | 56 +- .../PasswordRecover/PasswordRecoverVoter.php | 2 + 8 files changed, 827 insertions(+), 35 deletions(-) create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon.dist diff --git a/composer.json b/composer.json index 0d134cbf8..ac26cfc2a 100644 --- a/composer.json +++ b/composer.json @@ -54,6 +54,7 @@ "doctrine/doctrine-fixtures-bundle": "^3.3", "fakerphp/faker": "^1.13", "nelmio/alice": "^3.8", + "phpstan/phpstan": "^1.0", "phpunit/phpunit": "^7.0", "symfony/debug-bundle": "^5.1", "symfony/dotenv": "^5.1", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..1e7d2f6e5 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,647 @@ +parameters: + ignoreErrors: + - + message: "#^Variable \\$activities might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php + + - + message: "#^Variable \\$view might not be defined\\.$#" + count: 4 + path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php + + - + message: "#^Anonymous function has an unused use \\$data\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php + + - + message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getDescription\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php + + - + message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getTitle\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php + + - + message: "#^Variable \\$header might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php + + - + message: "#^Variable \\$select might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php + + - + message: "#^Undefined variable\\: \\$person$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php + + - + message: "#^Method Chill\\\\ActivityBundle\\\\Timeline\\\\TimelineActivityProvider\\:\\:getFromClausePerson\\(\\) invoked with 1 parameter, 0 required\\.$#" + count: 1 + path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php + + - + message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:buildQueryEntities\\(\\) invoked with 3 parameters, 2 required\\.$#" + count: 1 + path: src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.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: "#^Variable \\$view might not be defined\\.$#" + count: 4 + path: src/Bundle/ChillCalendarBundle/Controller/CalendarController.php + + - + message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldChoice\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php + + - + message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldDate\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php + + - + message: "#^Anonymous function has an unused use \\$entries\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php + + - + message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldLongChoice\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php + + - + message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldNumber\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php + + - + message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldText\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php + + - + message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldTitle\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php + + - + message: "#^Variable \\$optionBuilder might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php + + - + message: "#^Call to sprintf contains 0 placeholders, 1 value given\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.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 + path: src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php + + - + message: "#^Instantiated class PhpOffice\\\\PhpWord\\\\TemplateProcessor not found\\.$#" + count: 1 + path: src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php + + - + message: "#^Class Chill\\\\DocStoreBundle\\\\Entity\\\\DocumentCategory constructor invoked with 0 parameters, 2 required\\.$#" + count: 1 + path: src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php + + - + message: "#^Class App\\\\Entity\\\\AccompanyingCourseDocument not found\\.$#" + count: 1 + path: src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php + + - + message: "#^Access to an undefined property Chill\\\\DocStoreBundle\\\\Security\\\\Authorization\\\\PersonDocumentVoter\\:\\:\\$helper\\.$#" + count: 1 + path: src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php + + - + message: "#^Variable \\$participation might not be defined\\.$#" + count: 3 + path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php + + - + message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\EventTypeType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#" + count: 1 + path: src/Bundle/ChillEventBundle/Form/EventTypeType.php + + - + message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\RoleType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#" + count: 1 + path: src/Bundle/ChillEventBundle/Form/RoleType.php + + - + message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\StatusType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#" + count: 1 + path: src/Bundle/ChillEventBundle/Form/StatusType.php + + - + message: "#^Method Chill\\\\EventBundle\\\\Search\\\\EventSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillEventBundle/Search/EventSearch.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: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:getEntity\\(\\) invoked with 4 parameters, 3 required\\.$#" + count: 3 + path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\ApiController\\:\\:entityPostAction\\(\\) invoked with 4 parameters, 3 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php + + - + message: "#^Variable \\$entity in isset\\(\\) is never defined\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php + + - + message: "#^Call to sprintf contains 2 placeholders, 0 values given\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:buildQueryEntities\\(\\) invoked with 3 parameters, 2 required\\.$#" + count: 2 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:onPreDelete\\(\\) invoked with 3 parameters, 2 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: "#^Method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:createNotFoundException\\(\\) invoked with 3 parameters, 0\\-2 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: "#^Parameter \\$scope of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:getReachableCenters\\(\\) has invalid type Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\Scope\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: "#^Variable \\$entity in isset\\(\\) is never defined\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Resolver\\\\Resolver\\:\\:getConfigValue\\(\\) should return string but return statement is missing\\.$#" + 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 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 + path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillUserSendRenewPasswordCodeCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadAndUpdateLanguagesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadCountriesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php + + - + message: "#^Variable \\$countries might not be defined\\.$#" + count: 2 + path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadPostalCodesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php + + - + message: "#^Variable \\$csv might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Command\\\\SetPasswordCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" + 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 + path: src/Bundle/ChillMainBundle/Controller/ExportController.php + + - + message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createEditForm\\(\\)\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createAddLinkGroupCenterForm\\(\\) invoked with 1 parameter, 2 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createEditPasswordForm\\(\\) invoked with 2 parameters, 1 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:getDeleteLinkGroupCenterByUser\\(\\) invoked with 1 parameter, 2 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: "#^Variable \\$p might not be defined\\.$#" + count: 2 + path: src/Bundle/ChillMainBundle/Doctrine/DQL/OverlapsI.php + + - + message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Entity\\\\RoleScope\\:\\:\\$new\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Entity/RoleScope.php + + - + message: "#^Function findColumnPosition not found\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php + + - + message: "#^Inner named functions are not supported by PHPStan\\. Consider refactoring to an anonymous function, class method, or a top\\-level\\-defined function\\. See issue \\#165 \\(https\\://github\\.com/phpstan/phpstan/issues/165\\) for more details\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Export\\\\Formatter\\\\CSVFormatter\\:\\:orderingHeaders\\(\\) should return Chill\\\\MainBundle\\\\Export\\\\Formatter\\\\type but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php + + - + message: "#^Variable \\$line might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php + + - + message: "#^Variable \\$value in empty\\(\\) always exists and is not falsy\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/DateIntervalTransformer.php + + - + message: "#^Undefined variable\\: \\$current$#" + count: 1 + path: src/Bundle/ChillMainBundle/Pagination/PageGenerator.php + + - + message: "#^Class Chill\\\\MainBundle\\\\Repository\\\\GroupCenter not found\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Repository/UserRepository.php + + - + message: "#^Access to an undefined property Chill\\\\MainBundle\\\\Routing\\\\MenuComposer\\:\\:\\$routeCollection\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Routing/MenuComposer.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Search\\\\SearchApi\\:\\:buildUnionQuery\\(\\) invoked with 4 parameters, 3 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Search/SearchApi.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: "#^Method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:userCanReachCenter\\(\\) invoked with 3 parameters, 2 required\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php + + - + message: "#^Call to sprintf contains 0 placeholders, 1 value given\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php + + - + message: "#^Variable \\$message on left side of \\?\\? always exists and is not nullable\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php + + - + message: "#^Method Chill\\\\MainBundle\\\\Timeline\\\\TimelineBuilder\\:\\:getTemplateData\\(\\) should return array but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php + + - + message: "#^Constant __METHOD not found\\.$#" + count: 2 + path: src/Bundle/ChillMainBundle/Util/DateRangeCovering.php + + - + message: "#^Variable \\$sqls on left side of \\?\\? always exists and is not nullable\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php + + - + message: "#^Instantiated class Chill\\\\PersonBundle\\\\CRUD\\\\Controller\\\\BadMethodCallException not found\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php + + - + message: "#^Method Chill\\\\PersonBundle\\\\Command\\\\ChillPersonMoveCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php + + - + message: "#^Class Chill\\\\PersonBundle\\\\Entity\\\\Person constructor invoked with 1 parameter, 0 required\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php + + - + message: "#^Variable \\$headers might not be defined\\.$#" + count: 2 + path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php + + - + message: "#^Variable \\$rawHeaders might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php + + - + message: "#^Variable \\$street1Value might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php + + - + message: "#^Variable \\$accompanyingPeriods might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Controller/HouseholdController.php + + - + message: "#^Instantiated class Chill\\\\PersonBundle\\\\Controller\\\\BadRequestExceptions not found\\.$#" + 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: "#^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\\\\Entity\\\\AccompanyingPeriod\\:\\:\\$work\\.$#" + 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: "#^Variable \\$labels might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php + + - + message: "#^Variable \\$labels might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php + + - + message: "#^Anonymous function has an unused use \\$key\\.$#" + 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: "#^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\\\\PersonBundle\\\\Household\\\\MembersEditorFactory\\:\\:\\$validator\\.$#" + count: 2 + path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php + + - + message: "#^Method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\QueryBuilder\\.$#" + 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: "#^Class Chill\\\\PersonBundle\\\\Entity\\\\Household\\\\HouseholdMembers not found\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Repository/Household/HouseholdMembersRepository.php + + - + message: "#^Method Chill\\\\PersonBundle\\\\Search\\\\PersonSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php + + - + message: "#^Method Chill\\\\PersonBundle\\\\Search\\\\SimilarityPersonSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Search/SimilarityPersonSearch.php + + - + message: "#^Function Chill\\\\PersonBundle\\\\Serializer\\\\Normalizer\\\\ยท\\\\is_array not found\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php + + - + message: "#^Variable \\$entity might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.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: "#^Undefined variable\\: \\$choiceSlug$#" + count: 1 + path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php + + - + message: "#^Variable \\$scopes might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php + + - + message: "#^Variable \\$users might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php + + - + message: "#^Method Chill\\\\ReportBundle\\\\Security\\\\Authorization\\\\ReportVoter\\:\\:supports\\(\\) should return bool but return statement is missing\\.$#" + 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: "#^Parameter \\$em of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:getPersonParam\\(\\) has invalid type Chill\\\\TaskBundle\\\\Controller\\\\EntityManagerInterface\\.$#" + count: 1 + path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php + + - + message: "#^Parameter \\$em of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:getUserParam\\(\\) has invalid type Chill\\\\TaskBundle\\\\Controller\\\\EntityManagerInterface\\.$#" + count: 1 + path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php + + - + message: "#^Variable \\$person might not be defined\\.$#" + count: 4 + path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php + + - + message: "#^Undefined variable\\: \\$type$#" + count: 1 + path: src/Bundle/ChillTaskBundle/Controller/TaskController.php + + - + message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\SingleTaskTaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php + + - + message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\TaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php + + - + message: "#^Call to an undefined method Chill\\\\ThirdPartyBundle\\\\Form\\\\Type\\\\PickThirdPartyTypeCategoryType\\:\\:transform\\(\\)\\.$#" + count: 1 + path: src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php + + - + message: "#^Method Chill\\\\ThirdPartyBundle\\\\Search\\\\ThirdPartySearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php + diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 000000000..9721e72fd --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,146 @@ +parameters: + level: 1 + paths: + - src/Bundle/ChillActivityBundle/Controller + - src/Bundle/ChillActivityBundle/Entity + - src/Bundle/ChillActivityBundle/Export + - src/Bundle/ChillActivityBundle/Form + - src/Bundle/ChillActivityBundle/Menu + - src/Bundle/ChillActivityBundle/Notification + - src/Bundle/ChillActivityBundle/Repository + - src/Bundle/ChillActivityBundle/Security/Authorization + - src/Bundle/ChillActivityBundle/Timeline + - src/Bundle/ChillAsideActivityBundle/src/Controller + - src/Bundle/ChillAsideActivityBundle/src/Entity + - src/Bundle/ChillAsideActivityBundle/src/Form + - src/Bundle/ChillAsideActivityBundle/src/Menu + - src/Bundle/ChillAsideActivityBundle/src/Repository + - src/Bundle/ChillBudgetBundle/Calculator + - src/Bundle/ChillBudgetBundle/Config + - src/Bundle/ChillBudgetBundle/Controller + - src/Bundle/ChillBudgetBundle/Entity + - src/Bundle/ChillBudgetBundle/Form + - src/Bundle/ChillBudgetBundle/Menu + - src/Bundle/ChillBudgetBundle/Repository + - src/Bundle/ChillBudgetBundle/Security/Authorization + - src/Bundle/ChillBudgetBundle/Templating + - src/Bundle/ChillCalendarBundle/Controller + - src/Bundle/ChillCalendarBundle/Entity + - src/Bundle/ChillCalendarBundle/Event + - src/Bundle/ChillCalendarBundle/Form + - src/Bundle/ChillCalendarBundle/Menu + - src/Bundle/ChillCalendarBundle/Repository + - src/Bundle/ChillCalendarBundle/Controller + - src/Bundle/ChillCustomFieldsBundle/Command + - src/Bundle/ChillCustomFieldsBundle/Controller + - src/Bundle/ChillCustomFieldsBundle/CustomFields + - src/Bundle/ChillCustomFieldsBundle/Entity + - src/Bundle/ChillCustomFieldsBundle/Form + - src/Bundle/ChillCustomFieldsBundle/Service + - src/Bundle/ChillDocGeneratorBundle/Context + - src/Bundle/ChillDocGeneratorBundle/Controller + - src/Bundle/ChillDocGeneratorBundle/Entity + - src/Bundle/ChillDocGeneratorBundle/Form + - src/Bundle/ChillDocGeneratorBundle/Repository + - src/Bundle/ChillDocStoreBundle/Controller + - src/Bundle/ChillDocStoreBundle/Entity + - src/Bundle/ChillDocStoreBundle/EntityRepository + - src/Bundle/ChillDocStoreBundle/Form + - src/Bundle/ChillDocStoreBundle/Menu + - src/Bundle/ChillDocStoreBundle/Object + - src/Bundle/ChillDocStoreBundle/Repository + - src/Bundle/ChillDocStoreBundle/Security/Authorization + - src/Bundle/ChillEventBundle/Controller + - src/Bundle/ChillEventBundle/Entity + - src/Bundle/ChillEventBundle/Form + - src/Bundle/ChillEventBundle/Menu + - src/Bundle/ChillEventBundle/Repository + - src/Bundle/ChillEventBundle/Search + - src/Bundle/ChillEventBundle/Security/Authorization + - src/Bundle/ChillEventBundle/Timeline + - src/Bundle/ChillFamilyMembersBundle/Config + - src/Bundle/ChillFamilyMembersBundle/Controller + - src/Bundle/ChillFamilyMembersBundle/Entity + - src/Bundle/ChillFamilyMembersBundle/Form + - src/Bundle/ChillFamilyMembersBundle/Menu + - src/Bundle/ChillFamilyMembersBundle/Repository + - src/Bundle/ChillFamilyMembersBundle/Security + - src/Bundle/ChillFamilyMembersBundle/Templating + - src/Bundle/ChillMainBundle/Center + - src/Bundle/ChillMainBundle/Command + - src/Bundle/ChillMainBundle/Controller + - src/Bundle/ChillMainBundle/CRUD + - src/Bundle/ChillMainBundle/Doctrine + - src/Bundle/ChillMainBundle/Entity + - src/Bundle/ChillMainBundle/Export + - src/Bundle/ChillMainBundle/Form + - src/Bundle/ChillMainBundle/Notification + - src/Bundle/ChillMainBundle/Pagination + - src/Bundle/ChillMainBundle/Phonenumber + - src/Bundle/ChillMainBundle/Redis + - src/Bundle/ChillMainBundle/Repository + - src/Bundle/ChillMainBundle/Routing + - src/Bundle/ChillMainBundle/Search + - src/Bundle/ChillMainBundle/Security + - src/Bundle/ChillMainBundle/Serializer + - src/Bundle/ChillMainBundle/Templating + - src/Bundle/ChillMainBundle/Timeline + - src/Bundle/ChillMainBundle/Util + - src/Bundle/ChillMainBundle/Validation + - src/Bundle/ChillMainBundle/Validator/Constraints + - src/Bundle/ChillPersonBundle/AccompanyingPeriod + - src/Bundle/ChillPersonBundle/Actions + - src/Bundle/ChillPersonBundle/Command + - src/Bundle/ChillPersonBundle/Config + - src/Bundle/ChillPersonBundle/Controller + - src/Bundle/ChillPersonBundle/CRUD/Controller + - src/Bundle/ChillPersonBundle/Doctrine/DQL + - src/Bundle/ChillPersonBundle/Entity + - src/Bundle/ChillPersonBundle/EventListener + - src/Bundle/ChillPersonBundle/Export + - src/Bundle/ChillPersonBundle/Form + - src/Bundle/ChillPersonBundle/Household + - src/Bundle/ChillPersonBundle/Menu + - src/Bundle/ChillPersonBundle/Notification + - src/Bundle/ChillPersonBundle/Privacy + - src/Bundle/ChillPersonBundle/Repository + - src/Bundle/ChillPersonBundle/Search + - src/Bundle/ChillPersonBundle/Security/Authorization + - src/Bundle/ChillPersonBundle/Serializer/Normalizer + - src/Bundle/ChillPersonBundle/Service/Import + - src/Bundle/ChillPersonBundle/Templating/Entity + - src/Bundle/ChillPersonBundle/Timeline + - src/Bundle/ChillPersonBundle/Validator/Constraints + - src/Bundle/ChillPersonBundle/Widget + - src/Bundle/ChillReportBundle/Controller + - src/Bundle/ChillReportBundle/Entity + - src/Bundle/ChillReportBundle/Export + - src/Bundle/ChillReportBundle/Form + - src/Bundle/ChillReportBundle/Search + - src/Bundle/ChillReportBundle/Security/Authorization + - src/Bundle/ChillReportBundle/Timeline + - src/Bundle/ChillTaskBundle/Controller + - src/Bundle/ChillTaskBundle/Entity + - src/Bundle/ChillTaskBundle/Event + - src/Bundle/ChillTaskBundle/Form + - src/Bundle/ChillTaskBundle/Menu + - src/Bundle/ChillTaskBundle/Repository + - src/Bundle/ChillTaskBundle/Security/Authorization + - src/Bundle/ChillTaskBundle/Templating + - src/Bundle/ChillTaskBundle/Timeline + - src/Bundle/ChillTaskBundle/Workflow + - src/Bundle/ChillThirdPartyBundle/Controller + - src/Bundle/ChillThirdPartyBundle/Entity + - src/Bundle/ChillThirdPartyBundle/Form + - src/Bundle/ChillThirdPartyBundle/Menu + - src/Bundle/ChillThirdPartyBundle/Repository + - src/Bundle/ChillThirdPartyBundle/Search + - src/Bundle/ChillThirdPartyBundle/Security/Voter + - src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer + - src/Bundle/ChillThirdPartyBundle/Templating/Entity + - src/Bundle/ChillThirdPartyBundle/ThirdPartyType + - src/Bundle/ChillWopiBundle/src +includes: + - phpstan-baseline.neon + + diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index a62963e07..03a6188a1 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -97,9 +97,9 @@ class CalendarController extends AbstractController 'calendarItems' => $calendarItems, 'user' => $user ]); + } - } elseif ($accompanyingPeriod instanceof AccompanyingPeriod) { - + if ($accompanyingPeriod instanceof AccompanyingPeriod) { $total = $this->calendarRepository->countByAccompanyingPeriod($accompanyingPeriod); $paginator = $this->paginator->create($total); $calendarItems = $this->calendarRepository->findBy( @@ -117,6 +117,8 @@ class CalendarController extends AbstractController 'paginator' => $paginator ]); } + + throw new \Exception('Unable to list actions.'); } /** diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 93068de3f..d82d8a0a7 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -145,5 +145,7 @@ class DocGeneratorTemplateController extends AbstractController } catch (TransferException $e) { throw $e; } + + throw new \Exception('Unable to generate document.'); } } diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index 359ff0384..e3717f654 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -504,6 +504,8 @@ class ApiController extends AbstractCRUDController $this->getContextForSerializationPostAlter($action, $request, $_format, $entity, [$postedData]) ); } + + throw new \Exception('Unable to handle such request method.'); } /** diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php index 2e6f83a69..20b59fbb7 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -4,13 +4,9 @@ namespace Chill\MainBundle\Doctrine\Model; use \JsonSerializable; -/** - * Description of Point - * - */ class Point implements JsonSerializable { - private ?float $lat = null; - private ?float $lon = null; + private ?float $lat; + private ?float $lon; public static string $SRID = '4326'; private function __construct(?float $lon, ?float $lat) @@ -22,6 +18,7 @@ class Point implements JsonSerializable { public function toGeoJson(): string { $array = $this->toArrayGeoJson(); + return \json_encode($array); } @@ -33,60 +30,53 @@ class Point implements JsonSerializable { public function toArrayGeoJson(): array { return [ - "type" => "Point", - "coordinates" => [ $this->lon, $this->lat ] + 'type' => 'Point', + 'coordinates' => [$this->lon, $this->lat], ]; } - /** - * - * @return string - */ public function toWKT(): string { - return 'SRID='.self::$SRID.';POINT('.$this->lon.' '.$this->lat.')'; + return sprintf("SRID=%s;POINT(%s %s)", self::$SRID, $this->lon, $this->lat); } - /** - * - * @param type $geojson - * @return Point - */ - public static function fromGeoJson(string $geojson): Point + public static function fromGeoJson(string $geojson): self { $a = json_decode($geojson); - //check if the geojson string is correct - if (NULL === $a or !isset($a->type) or !isset($a->coordinates)){ + + if (null === $a) { throw PointException::badJsonString($geojson); } - if ($a->type != 'Point'){ + if (null === $a->type || null === $a->coordinates) { + throw PointException::badJsonString($geojson); + } + + if ($a->type !== 'Point'){ throw PointException::badGeoType(); } - $lat = $a->coordinates[1]; - $lon = $a->coordinates[0]; + [$lon, $lat] = $a->coordinates; return Point::fromLonLat($lon, $lat); } - public static function fromLonLat(float $lon, float $lat): Point + public static function fromLonLat(float $lon, float $lat): self { - if (($lon > -180 && $lon < 180) && ($lat > -90 && $lat < 90)) - { + if (($lon > -180 && $lon < 180) && ($lat > -90 && $lat < 90)) { return new Point($lon, $lat); - } else { - throw PointException::badCoordinates($lon, $lat); } + + throw PointException::badCoordinates($lon, $lat); } - public static function fromArrayGeoJson(array $array): Point + public static function fromArrayGeoJson(array $array): self { - if ($array['type'] == 'Point' && - isset($array['coordinates'])) - { + if ($array['type'] === 'Point' && isset($array['coordinates'])) { return self::fromLonLat($array['coordinates'][0], $array['coordinates'][1]); } + + throw new \Exception('Unable to build a point from input data.'); } public function getLat(): float diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php index 324f76b02..b6ba03621 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php @@ -98,5 +98,7 @@ class PasswordRecoverVoter extends Voter return true; } + + return false; } }