From a9188355c59c6aa937f1786476925f02148b44c7 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 30 Nov 2021 11:37:57 +0100 Subject: [PATCH] cs: Enable more risky rules. --- .php_cs.dist.php | 8 +++---- .../source/development/pagination/example.php | 2 +- .../widgets/ChillMainConfiguration.php | 2 +- ...ChillPersonAddAPersonListWidgetFactory.php | 2 +- .../widgets/ChillPersonAddAPersonWidget.php | 2 +- .../Controller/ActivityController.php | 1 + .../DataFixtures/ORM/LoadActivitytACL.php | 1 + .../DependencyInjection/Configuration.php | 1 + .../Aggregator/ActivityReasonAggregator.php | 2 ++ .../Export/Export/ListActivity.php | 2 ++ .../Export/Filter/ActivityReasonFilter.php | 2 ++ .../Export/Filter/ActivityTypeFilter.php | 1 + .../PersonHavingActivityBetweenDateFilter.php | 1 + .../ChillActivityBundle/Form/ActivityType.php | 1 + .../Menu/AdminMenuBuilder.php | 1 + .../Repository/ActivityACLAwareRepository.php | 1 + .../test/Fixtures/App/web/app_dev.php | 2 +- .../Controller/ActivityControllerTest.php | 2 ++ ...sonHavingActivityBetweenDateFilterTest.php | 1 + .../Constraints/ActivityValidityValidator.php | 1 + .../migrations/Version20210422073711.php | 1 + .../src/DependencyInjection/Configuration.php | 1 + .../src/Form/AsideActivityFormType.php | 1 + .../src/Menu/AdminMenuBuilder.php | 1 + .../AsideActivityControllerTest.php | 2 +- .../Controller/AbstractElementController.php | 1 + .../Controller/ElementController.php | 1 + .../Controller/CalendarRangeAPIController.php | 1 + .../ChillCalendarBundle/Entity/Calendar.php | 1 + .../Event/ListenToActivityCreate.php | 1 + .../Command/CreateFieldsOnGroupCommand.php | 1 + .../CustomFieldsGroupController.php | 1 + .../CustomFields/CustomFieldChoice.php | 8 +++++-- .../CustomFields/CustomFieldLongChoice.php | 3 +++ .../CustomFields/CustomFieldText.php | 1 + .../Form/CustomFieldsGroupType.php | 1 + .../CustomFieldsGroupToIdTransformer.php | 1 + .../JsonCustomFieldToArrayTransformer.php | 1 + .../Form/Extension/PostTextExtension.php | 1 + .../test/Fixtures/App/web/app_dev.php | 2 +- .../CustomFieldControllerTest_TODO.php | 2 +- .../CustomFields/CustomFieldsNumberTest.php | 1 + .../HouseholdMemberSelectionContext.php | 2 ++ .../Normalizer/DocGenObjectNormalizer.php | 2 ++ .../DataFixtures/ORM/LoadDocumentACL.php | 1 + .../Controller/EventController.php | 1 + .../Controller/ParticipationController.php | 1 + .../DataFixtures/ORM/LoadRolesACL.php | 1 + .../ChillEventBundle/Entity/Participation.php | 1 + .../Form/ChoiceLoader/EventChoiceLoader.php | 1 + .../Form/Type/PickEventType.php | 2 ++ .../ChillEventBundle/Search/EventSearch.php | 1 + .../Security/Authorization/EventVoter.php | 4 +++- .../Authorization/ParticipationVoter.php | 4 +++- .../ParticipationControllerTest.php | 2 ++ .../Tests/Search/EventSearchTest.php | 1 + .../Timeline/TimelineEventProvider.php | 1 + .../Config/ConfigRepository.php | 2 ++ .../CRUD/Routing/CRUDRoutesLoader.php | 1 + .../Command/ChillImportUsersCommand.php | 1 + .../Command/LoadAndUpdateLanguagesCommand.php | 1 + .../Command/LoadPostalCodesCommand.php | 1 + .../Controller/ExportController.php | 1 + .../Controller/PermissionsGroupController.php | 1 + .../Controller/SearchController.php | 3 ++- .../Controller/TimelineCenterController.php | 1 + .../Controller/UserController.php | 2 +- .../DataFixtures/ORM/LoadLanguages.php | 1 + .../ChillMainExtension.php | 1 + .../ConfigConsistencyCompilerPass.php | 1 + .../Widget/AbstractWidgetsCompilerPass.php | 5 ++++ .../Widget/AddWidgetConfigurationTrait.php | 3 +++ .../Doctrine/Type/NativeDateIntervalType.php | 3 ++- src/Bundle/ChillMainBundle/Entity/User.php | 1 + .../ChillMainBundle/Export/ExportManager.php | 7 +++++- .../Export/Formatter/CSVFormatter.php | 5 ++++ .../Export/Formatter/CSVListFormatter.php | 1 + .../Formatter/CSVPivotedListFormatter.php | 1 + .../Export/Formatter/SpreadSheetFormatter.php | 3 +++ .../Formatter/SpreadsheetListFormatter.php | 1 + .../Form/PermissionsGroupType.php | 1 + .../Form/Type/ComposedRoleScopeType.php | 1 + .../DataTransformer/CenterTransformer.php | 1 + .../Form/Type/DateIntervalType.php | 2 ++ .../Form/Type/Export/PickCenterType.php | 1 + .../Form/Type/Listing/FilterOrderType.php | 1 + .../Form/Type/PickCenterType.php | 1 + .../Form/Type/ScopePickerType.php | 1 + .../Form/Type/TranslatableStringFormType.php | 1 + .../Phonenumber/PhonenumberHelper.php | 1 + .../Repository/UserRepository.php | 1 + .../ChillMainBundle/Routing/MenuComposer.php | 3 ++- .../ChillMainBundle/Search/AbstractSearch.php | 1 + .../ChillMainBundle/Search/SearchApi.php | 1 + .../ChillMainBundle/Search/SearchApiQuery.php | 1 + .../ChillMainBundle/Search/SearchProvider.php | 2 ++ .../Utils/ExtractPhonenumberFromPattern.php | 1 + .../Authorization/AuthorizationHelper.php | 1 + .../Security/ParentRoleHelper.php | 3 ++- .../PasswordRecover/PasswordRecoverVoter.php | 1 + .../Resolver/CenterResolverManager.php | 1 + .../ChillMainBundle/Security/RoleProvider.php | 2 +- .../Serializer/Normalizer/DateNormalizer.php | 3 ++- .../DiscriminatedObjectDenormalizer.php | 1 + .../DoctrineExistingEntityNormalizer.php | 1 + .../Serializer/Normalizer/PointNormalizer.php | 2 ++ .../Templating/Listing/FilterOrderHelper.php | 1 + .../Templating/TranslatableStringHelper.php | 1 + .../Templating/Widget/WidgetRenderingTwig.php | 1 + .../Test/Export/AbstractAggregatorTest.php | 5 ++++ .../Test/Export/AbstractExportTest.php | 5 ++++ .../Test/Export/AbstractFilterTest.php | 4 ++++ .../Tests/Doctrine/Model/PointTest.php | 2 +- .../Tests/Export/ExportManagerTest.php | 1 + .../Tests/Form/Type/PickCenterTypeTest.php | 2 +- .../Tests/Pagination/PaginatorTest.php | 1 + .../Authorization/AuthorizationHelperTest.php | 1 + .../Resolver/ScopeResolverDispatcherTest.php | 2 +- .../Timeline/TimelineBuilder.php | 2 ++ .../ChillMainBundle/Util/CountriesInfo.php | 1 + .../Util/DateRangeCovering.php | 1 + .../Validator/RoleScopeScopePresence.php | 1 + .../migrations/Version20150821105642.php | 1 + .../Actions/Remove/PersonMove.php | 4 ++-- .../Command/ImportPeopleFromCSVCommand.php | 14 +++++++---- .../Config/ConfigPersonAltNamesHelper.php | 2 ++ .../AccompanyingCourseApiController.php | 1 + .../AccompanyingPeriodController.php | 1 + .../Controller/HouseholdController.php | 2 ++ .../Controller/HouseholdMemberController.php | 1 + .../Controller/PersonAddressController.php | 1 + .../Controller/PersonController.php | 1 + .../Controller/PersonDuplicateController.php | 1 + .../SocialWorkSocialActionApiController.php | 1 + .../ORM/LoadAccompanyingPeriodWork.php | 1 + .../DataFixtures/ORM/LoadPeople.php | 11 +++++---- .../DataFixtures/ORM/LoadRelationships.php | 3 ++- .../ChillPersonExtension.php | 1 + .../Entity/AccompanyingPeriod.php | 2 ++ .../Entity/Household/Household.php | 1 + .../ChillPersonBundle/Entity/Person.php | 2 ++ .../Export/Export/ListPerson.php | 4 +++- .../Export/Filter/GenderFilter.php | 2 ++ .../Form/ChoiceLoader/PersonChoiceLoader.php | 1 + .../DataMapper/PersonAltNameDataMapper.php | 1 + .../Form/Type/PickPersonType.php | 2 ++ .../Privacy/PrivacyEvent.php | 1 + .../AccompanyingPeriodACLAwareRepository.php | 1 + .../Repository/PersonACLAwareRepository.php | 1 + .../Repository/PersonRepository.php | 1 + .../test/Fixtures/App/web/app_dev.php | 2 +- .../Search/SearchPersonApiProvider.php | 1 + .../Search/SimilarPersonMatcher.php | 1 + .../AccompanyingPeriodResourceNormalizer.php | 1 + .../Service/Import/SocialWorkMetadata.php | 1 + .../AccompanyingCourseApiControllerTest.php | 1 + .../AccompanyingCourseControllerTest.php | 1 + .../AccompanyingPeriodControllerTest.php | 1 + .../HouseholdMemberControllerTest.php | 1 + .../Controller/PersonControllerCreateTest.php | 2 ++ ...rsonControllerViewWithHiddenFieldsTest.php | 2 +- .../SocialIssueApiControllerTest.php | 1 + .../Tests/Entity/AccompanyingPeriodTest.php | 1 + .../Tests/Form/Type/PickPersonTypeTest.php | 1 + .../Tests/Household/MembersEditorTest.php | 3 ++- .../ParticipationOverlapValidator.php | 1 + .../ResourceDuplicateCheckValidator.php | 1 + ...HouseholdMembershipSequentialValidator.php | 1 + .../Constraints/Person/BirthdateValidator.php | 3 +++ .../Widget/PersonListWidget.php | 1 + .../migrations/Version20160422000000.php | 1 + .../Controller/ReportController.php | 2 ++ .../DataFixtures/ORM/LoadCustomField.php | 1 + .../DataFixtures/ORM/LoadReportACL.php | 1 + .../DataFixtures/ORM/LoadReports.php | 2 ++ .../Export/Export/ReportList.php | 24 ++++++++++--------- .../ChillReportBundle/Search/ReportSearch.php | 1 + .../Controller/ReportControllerNextTest.php | 1 + .../Tests/Controller/ReportControllerTest.php | 2 ++ .../Tests/Timeline/TimelineProviderTest.php | 1 + .../Timeline/TimelineReportProvider.php | 13 ++++++---- .../DataFixtures/ORM/LoadTaskACL.php | 1 + .../Form/SingleTaskListType.php | 1 + .../SingleTaskAclAwareRepository.php | 1 + .../Repository/SingleTaskRepository.php | 1 + .../TaskLifeCycleEventTimelineProvider.php | 3 ++- .../Workflow/TaskWorkflowManager.php | 1 + .../DataFixtures/ORM/LoadThirdParty.php | 5 ++-- .../Entity/ThirdParty.php | 1 + .../Form/Type/PickThirdPartyType.php | 1 + .../Type/PickThirdPartyTypeCategoryType.php | 2 ++ .../Security/Voter/ThirdPartyVoter.php | 1 + .../src/Service/Wopi/ChillDocumentManager.php | 1 + 193 files changed, 306 insertions(+), 63 deletions(-) diff --git a/.php_cs.dist.php b/.php_cs.dist.php index 936664f92..162fea55c 100644 --- a/.php_cs.dist.php +++ b/.php_cs.dist.php @@ -35,9 +35,9 @@ $riskyRules = [ 'php_unit_test_annotation' => false, 'php_unit_no_expectation_annotation' => false, 'declare_strict_types' => false, - 'function_to_constant' => false, + // 'function_to_constant' => false, // 'is_null' => false, - 'native_function_invocation' => false, + // 'native_function_invocation' => false, 'ternary_to_elvis_operator' => false, // 'no_trailing_whitespace_in_string' => false, 'no_unreachable_default_argument_value' => false, @@ -56,7 +56,7 @@ $riskyRules = [ 'ordered_traits' => false, 'php_unit_mock_short_will_return' => false, 'php_unit_set_up_tear_down_visibility' => false, - 'set_type_to_cast' => false, + // 'set_type_to_cast' => false, // 'string_line_ending' => false, 'ordered_interfaces' => false, 'php_unit_expectation' => false, @@ -65,7 +65,7 @@ $riskyRules = [ 'random_api_migration' => false, 'static_lambda' => false, 'php_unit_construct' => false, - 'psr_autoloading' => false, + // 'psr_autoloading' => false, 'php_unit_dedicate_assert' => false, ]; diff --git a/docs/source/development/pagination/example.php b/docs/source/development/pagination/example.php index cd71649c9..f86cd5bb2 100644 --- a/docs/source/development/pagination/example.php +++ b/docs/source/development/pagination/example.php @@ -11,7 +11,7 @@ namespace Chill\MyBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class ItemController extends Controller +class example extends Controller { public function yourAction() { diff --git a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php index 7d8964903..4bdde88cd 100644 --- a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php +++ b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php @@ -17,7 +17,7 @@ namespace Chill\MainBundle\DependencyInjection; /** * Configure the main bundle. */ - class Configuration implements ConfigurationInterface + class ChillMainConfiguration implements ConfigurationInterface { use AddWidgetConfigurationTrait; diff --git a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php index 16020bd78..d8d2d6ca5 100644 --- a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php +++ b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; /** * add configuration for the person_list widget. */ -class PersonListWidgetFactory extends AbstractWidgetFactory +class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory { /* * append the option to the configuration diff --git a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php index d74c7936b..44f1d2983 100644 --- a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php +++ b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php @@ -27,7 +27,7 @@ use Twig_Environment; * * The configuration is defined by `PersonListWidgetFactory` */ -class PersonListWidget implements WidgetInterface +class ChillPersonAddAPersonWidget implements WidgetInterface { /** * the authorization helper. diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index ae7cdfa59..863190a9f 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -39,6 +39,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Serializer\SerializerInterface; +use function array_key_exists; final class ActivityController extends AbstractController { diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php index 4893a87b3..3ebf2f6fe 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\RoleScope; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function in_array; /** * Add a role CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE for all groups except administrative, diff --git a/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php index dd23a9b8b..037a51c6a 100644 --- a/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php @@ -11,6 +11,7 @@ namespace Chill\ActivityBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +use function is_int; /** * This is the class that validates and merges configuration from your app/config files. diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index f48645c38..56306d90a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -25,6 +25,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function array_key_exists; +use function count; class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php index 3409980e1..a3282d534 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php @@ -28,6 +28,8 @@ use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Context\ExecutionContextInterface; use function array_key_exists; +use function count; +use function in_array; class ListActivity implements ListInterface { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php index b16d75837..a8dfdc15e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php @@ -25,6 +25,8 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function array_key_exists; +use function count; class ActivityReasonFilter implements FilterInterface, ExportElementValidatedInterface { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 78ebd794a..e8d1f2377 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -24,6 +24,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function count; class ActivityTypeFilter implements FilterInterface, ExportElementValidatedInterface { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php index 32fd8e76f..f16756911 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php @@ -31,6 +31,7 @@ use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormInterface; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function count; class PersonHavingActivityBetweenDateFilter implements FilterInterface, ExportElementValidatedInterface { diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 5c72e3556..cd60b5879 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -46,6 +46,7 @@ use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use function in_array; class ActivityType extends AbstractType { diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index e4edb97fe..f734ff6a0 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; +use function in_array; final class AdminMenuBuilder implements LocalMenuBuilderInterface { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index eb53a6217..84763c491 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -22,6 +22,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Security; +use function count; use function in_array; final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface diff --git a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php index 7f60a5a15..5f3d50682 100644 --- a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php index 493fac584..d28012ce4 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php @@ -12,6 +12,8 @@ namespace Chill\ActivityBundle\Tests\Controller; use RuntimeException; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Security\Core\Role\Role; +use function count; +use function in_array; /** * @internal diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php index a20b5d3e1..d422957f4 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php @@ -11,6 +11,7 @@ namespace Chill\ActivityBundle\Tests\Filter; use Chill\MainBundle\Test\Export\AbstractFilterTest; use DateTime; +use function array_slice; /** * @internal diff --git a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php index b67ba8ac4..a0537319f 100644 --- a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php +++ b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php @@ -16,6 +16,7 @@ use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; use function array_merge; +use function count; class ActivityValidityValidator extends ConstraintValidator { diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php b/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php index dfb3a9cc7..8501767b2 100644 --- a/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php +++ b/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php @@ -13,6 +13,7 @@ namespace Chill\Migrations\Activity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; +use function count; /** * Auto-generated Migration: Please modify to your needs! diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php index bcfc0b9a4..000a9ad87 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php @@ -11,6 +11,7 @@ namespace Chill\AsideActivityBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +use function is_int; class Configuration implements ConfigurationInterface { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index d0ce5773c..05ab3c4be 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -30,6 +30,7 @@ use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use function in_array; final class AsideActivityFormType extends AbstractType { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php index 3ca65be28..c878821e2 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php @@ -11,6 +11,7 @@ namespace Chill\AsideActivityBundle\Menu; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; +use function in_array; final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php b/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php index a0ad9828f..a905ebff4 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php @@ -20,7 +20,7 @@ use function shuffle; * @internal * @coversNothing */ -class AccompanyingCourseControllerTest extends WebTestCase +class AsideActivityControllerTest extends WebTestCase { use PrepareClientTrait; diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php index cc019676e..8b8dafc6b 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php @@ -19,6 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Translation\TranslatorInterface; +use function get_class; abstract class AbstractElementController extends Controller { diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index ee0fc30d0..affe9e605 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -21,6 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Translation\TranslatorInterface; use function array_merge; +use function count; class ElementController extends Controller { diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index fe33777aa..19e72099c 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -14,6 +14,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +use function count; class CalendarRangeAPIController extends ApiController { diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index ff6259c62..d1facc4a5 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -26,6 +26,7 @@ use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Mapping\ClassMetadata; +use function in_array; /** * @ORM\Table(name="chill_calendar.calendar") diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php index ab06ac71f..b0b473250 100644 --- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php +++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php @@ -12,6 +12,7 @@ namespace Chill\CalendarBundle\Event; use Chill\ActivityBundle\Entity\Activity; use Doctrine\Persistence\Event\LifecycleEventArgs; use Symfony\Component\HttpFoundation\RequestStack; +use function array_key_exists; class ListenToActivityCreate { diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index 13bdaba74..a15f74efb 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -23,6 +23,7 @@ use Symfony\Component\Console\Question\Question; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Yaml\Parser; +use function count; /** * Class for the command 'chill:custom_fields:populate_group' that diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 7c356f76d..7caa9e1ba 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\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; use Symfony\Contracts\Translation\TranslatorInterface; +use function in_array; /** * Class CustomFieldsGroupController. diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 595dd594b..65786eb44 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -21,6 +21,10 @@ use Symfony\Bridge\Twig\TwigEngine; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; +use function array_key_exists; +use function count; +use function in_array; +use function is_array; use function LogicException; class CustomFieldChoice extends AbstractCustomField @@ -229,10 +233,10 @@ class CustomFieldChoice extends AbstractCustomField if ($cf->getOptions()[self::MULTIPLE]) { if ($cf->getOptions()[self::ALLOW_OTHER]) { - return \in_array($choiceSlug, $this->deserialize($data, $cf)['_choices']); + return in_array($choiceSlug, $this->deserialize($data, $cf)['_choices']); } - return \in_array($choiceSlug, $this->deserialize($data, $cf)); + return in_array($choiceSlug, $this->deserialize($data, $cf)); } if ($cf->getOptions()[self::ALLOW_OTHER]) { diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index 233b11ed0..2a5d5d7ee 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -21,6 +21,9 @@ use LogicException; use Symfony\Bridge\Twig\TwigEngine; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; +use function get_class; +use function gettype; +use function is_object; class CustomFieldLongChoice extends AbstractCustomField { diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php index 897fbd353..cb8c955ea 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php @@ -18,6 +18,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\RequestStack; +use function array_key_exists; class CustomFieldText extends AbstractCustomField { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php index 3055e64d2..ba0192138 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php @@ -18,6 +18,7 @@ use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Translation\TranslatorInterface; +use function count; class CustomFieldsGroupType extends AbstractType { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index b09427e54..448327826 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -13,6 +13,7 @@ use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup; use Doctrine\Persistence\ObjectManager; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; +use function gettype; class CustomFieldsGroupToIdTransformer implements DataTransformerInterface { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php index b41586c99..dd0e32da2 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php @@ -14,6 +14,7 @@ namespace Chill\CustomFieldsBundle\Form\DataTransformer; use Chill\CustomFieldsBundle\Entity\CustomField; use Doctrine\Persistence\ObjectManager; use Symfony\Component\Form\DataTransformerInterface; +use function array_key_exists; class JsonCustomFieldToArrayTransformer implements DataTransformerInterface { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php index ce6c9b65f..1ac9f3d4b 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; +use function array_key_exists; /** * This extension create the possibility to add some text diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php index 7f60a5a15..5f3d50682 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php index b88f0b6a5..c3e13435c 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php @@ -15,7 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; * @internal * @coversNothing */ -class CustomFieldControllerTest extends WebTestCase +class CustomFieldControllerTest_TODO extends WebTestCase { /* public function testCompleteScenario() diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php index d7fc89859..8fd3f255e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php @@ -12,6 +12,7 @@ namespace Chill\CustomFieldsBundle\Tests; use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber; use Chill\CustomFieldsBundle\Entity\CustomField; use Symfony\Component\Form\FormBuilderInterface; +use function count; /** * Test CustomFieldsNumber. diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php b/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php index 41d56c3e1..1342a3d23 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php @@ -13,6 +13,8 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Exception; +use function count; +use function get_class; /** * Context that display a form to select a member of a houseHold. diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php index 81ddd97ca..b46296550 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php @@ -25,9 +25,11 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use function array_filter; use function array_key_exists; use function array_merge; +use function get_class; use function implode; use function in_array; use function is_array; +use function is_object; class DocGenObjectNormalizer implements NormalizerInterface, NormalizerAwareInterface { diff --git a/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php b/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php index cda071963..a48221f29 100644 --- a/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php +++ b/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\RoleScope; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function in_array; /** * Adding acl for person document. diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index 7c519432a..2ea1f58d1 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -37,6 +37,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Translation\TranslatorInterface; +use function count; /** * Class EventController. diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 4ddaf7cae..9941a0ec5 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use function count; /** * Class ParticipationController. diff --git a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php index a9b437cba..66f41cc45 100644 --- a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php +++ b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\RoleScope; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function in_array; /** * Add roles to existing groups. diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index fb8ffeaed..ffdd72c2d 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -19,6 +19,7 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use RuntimeException; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function in_array; /** * Class Participation. diff --git a/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php b/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php index 807660b9e..0e172feb0 100644 --- a/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php +++ b/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php @@ -15,6 +15,7 @@ use RuntimeException; use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use function call_user_func; +use function count; use function in_array; /** diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php index 11d9dbef3..27210b91e 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php @@ -27,6 +27,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Translation\TranslatorInterface; +use function in_array; +use function is_array; /** * Class PickEventType. diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 7bd1e8731..28a6ed4d3 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -19,6 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Templating\EngineInterface as TemplatingEngine; +use function count; /** * Search within Events. diff --git a/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php b/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php index bbd93228e..afd12a252 100644 --- a/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php +++ b/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php @@ -20,6 +20,8 @@ use Psr\Log\LoggerInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; use Symfony\Component\Security\Core\Role\Role; +use function count; +use function in_array; /** * Description of EventVoter. @@ -86,7 +88,7 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter public function supports($attribute, $subject) { return ($subject instanceof Event && in_array($attribute, self::ROLES)) - || ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE])) + || ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE])) || (null === $subject && self::SEE === $attribute); } diff --git a/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php b/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php index aff66dbdb..71f177fab 100644 --- a/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php +++ b/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php @@ -20,6 +20,8 @@ use Psr\Log\LoggerInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; use Symfony\Component\Security\Core\Role\Role; +use function count; +use function in_array; class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { @@ -83,7 +85,7 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar public function supports($attribute, $subject) { return ($subject instanceof Participation && in_array($attribute, self::ROLES)) - || ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE])) + || ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE])) || (null === $subject && self::SEE === $attribute); } diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php index ee896a0af..99bc2fbe3 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php @@ -10,6 +10,8 @@ namespace Chill\EventBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use function count; +use function in_array; /** * Test the creation of participation controller. diff --git a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php index a7000050e..65096e0d3 100644 --- a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php @@ -13,6 +13,7 @@ use Chill\EventBundle\Entity\Event; use Chill\EventBundle\Search\EventSearch; use DateTime; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use function in_array; /** * Test the EventSearch class. diff --git a/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php b/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php index c2169d5a9..214b0c376 100644 --- a/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php +++ b/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php @@ -22,6 +22,7 @@ use LogicException; use RuntimeException; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; +use function count; /** * Class TimelineEventProvider. diff --git a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php index 6bce386ed..968ec32d2 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php +++ b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php @@ -9,6 +9,8 @@ namespace Chill\AMLI\FamilyMembersBundle\Config; +use function count; + class ConfigRepository { /** diff --git a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php index 8a6d316e5..5cc1ddd93 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php +++ b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php @@ -19,6 +19,7 @@ use Symfony\Component\Routing\RouteCollection; use function array_filter; use function array_keys; use function array_search; +use function count; use function in_array; class CRUDRoutesLoader extends Loader diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index 9bed468e4..ca5da3b7f 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -36,6 +36,7 @@ use function array_key_exists; use function array_keys; use function array_merge; use function bin2hex; +use function count; use function implode; use function random_bytes; use function trim; diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index d1a3c3cdb..075a1a942 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Intl\Intl; +use function in_array; /* * Load or update the languages entities command diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index e99a47673..4145e375e 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -24,6 +24,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Validator\Validator\ValidatorInterface; +use function count; class LoadPostalCodesCommand extends Command { diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 0ef79cf7a..51cc89a51 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Translation\TranslatorInterface; +use function count; use function serialize; use function unserialize; diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 9d9a9f70a..6be3d9927 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -24,6 +24,7 @@ use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\RoleHierarchy; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\Translation\TranslatorInterface; +use function array_key_exists; /** * Class PermissionsGroupController. diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index ddd55237d..fd4c0bc12 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -25,6 +25,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Contracts\Translation\TranslatorInterface; +use function count; use function key; use function reset; @@ -105,7 +106,7 @@ class SearchController extends AbstractController $advancedSearchProviders = $searchProvider ->getHasAdvancedFormSearchServices(); - if (\count($advancedSearchProviders) === 1) { + if (count($advancedSearchProviders) === 1) { reset($advancedSearchProviders); return $this->redirectToRoute('chill_main_advanced_search', [ diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index 55b809265..731e2b3a6 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Security; +use function count; class TimelineCenterController extends AbstractController { diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 4167bb173..716b13bc5 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -87,7 +87,7 @@ class UserController extends CRUDController return $this->redirect($this->generateUrl( 'chill_crud_admin_user_edit', - \array_merge(['id' => $uid], $returnPathParams) + array_merge(['id' => $uid], $returnPathParams) )); } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php index cfa149411..403ebd6de 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php @@ -16,6 +16,7 @@ use Doctrine\Persistence\ObjectManager; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Intl\Intl; +use function in_array; /** * Load languages into database. diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 4fc4fb752..41c731ec6 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -42,6 +42,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use function count; /** * Class ChillMainExtension diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php index 17a9a0422..5b3e4723b 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php @@ -13,6 +13,7 @@ use LogicException; use RuntimeException; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use function count; /** * Description of ConfigConsistencyCompilerPass. diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php index ad0957253..cbad0f954 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php @@ -19,6 +19,11 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use UnexpectedValueException; +use function array_key_exists; +use function count; +use function get_class; +use function in_array; +use function is_array; /** * Compile the configurations and inject required service into container. diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php index 8e377880f..7bf0d2777 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php @@ -14,7 +14,10 @@ use Generator; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\DependencyInjection\ContainerBuilder; +use function array_key_exists; +use function count; use function implode; +use function in_array; /** * This trait allow to add automatic configuration for widget inside your config. diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php index 1d90fe382..964d17c31 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php @@ -14,6 +14,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\ConversionException; use Doctrine\DBAL\Types\DateIntervalType; use Exception; +use function count; use function current; use function preg_match; use function reset; @@ -84,7 +85,7 @@ class NativeDateIntervalType extends DateIntervalType $current = current($strings); if (is_numeric($current)) { - $next = \next($strings); + $next = next($strings); switch ($next) { case 'year': diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index a1d4b72c7..1891ac525 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -16,6 +16,7 @@ use RuntimeException; use Symfony\Component\Security\Core\User\AdvancedUserInterface; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function in_array; /** * User. diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index d9562304f..aa721621b 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -24,6 +24,11 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use UnexpectedValueException; +use function array_key_exists; +use function count; +use function get_class; +use function gettype; +use function in_array; /** * Collects all agregators, filters and export from @@ -192,7 +197,7 @@ class ExportManager } elseif ($element instanceof FormatterInterface) { $this->addFormatter($element, $alias); } else { - throw new LogicException('This element ' . \get_class($element) . ' ' + throw new LogicException('This element ' . get_class($element) . ' ' . 'is not an instance of export element'); } } diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php index fb16d285f..d2435bf50 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php @@ -20,6 +20,11 @@ use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\Translation\TranslatorInterface; +use function array_key_exists; +use function array_slice; +use function call_user_func; +use function count; +use function is_array; /** * Command to get the report with curl: diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php index 193cc0feb..1d49322a7 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php @@ -20,6 +20,7 @@ use Symfony\Component\Translation\TranslatorInterface; use function array_key_exists; use function array_keys; use function array_map; +use function count; use function implode; // command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php index ccdfcb97a..24a4fb7ba 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Translation\TranslatorInterface; use function array_map; +use function count; /** * Create a CSV List for the export where the header are printed on the diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php index 3646c9610..1a6bd494e 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php @@ -22,7 +22,10 @@ use function array_map; use function array_merge; use function array_multisort; use function array_unique; +use function call_user_func; +use function count; use function fopen; +use function is_array; use function stream_get_contents; use function sys_get_temp_dir; use function tempnam; diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php index 17bb8380e..cfcf3acdc 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php @@ -25,6 +25,7 @@ use Symfony\Component\Translation\TranslatorInterface; use function array_key_exists; use function array_keys; use function array_map; +use function count; use function fopen; use function implode; use function stream_get_contents; diff --git a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php index 1fb0426b4..20a183055 100644 --- a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php +++ b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use function array_combine; use function array_merge; +use function count; class PermissionsGroupType extends AbstractType { diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php index bafdf627e..42a57f95a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php @@ -18,6 +18,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use function in_array; /** * Form to Edit/create a role scope. If the role scope does not diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php index a7deab29c..0dfe5eb34 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -16,6 +16,7 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Traversable; +use function count; class CenterTransformer implements DataTransformerInterface { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php b/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php index 442d82608..4287337fe 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php @@ -19,7 +19,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\GreaterThan; use function array_diff; use function array_values; +use function count; use function implode; +use function is_array; /** * Show a dateInterval type. diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php index 3bedc9a3d..2d19aede2 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -25,6 +25,7 @@ use function array_intersect; use function array_key_exists; use function array_merge; use function array_unique; +use function count; use function in_array; /** diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index ff8820f4d..1bd4c5d4c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -19,6 +19,7 @@ use Symfony\Component\Form\FormView; use Symfony\Component\HttpFoundation\RequestStack; use function array_combine; use function array_map; +use function count; final class FilterOrderType extends \Symfony\Component\Form\AbstractType { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php index 9a5be7bc6..5c7fa6616 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php @@ -25,6 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Security; use function array_merge; use function array_values; +use function count; /** * Pick a center. diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 95c262575..44bbb48ef 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -28,6 +28,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Security; use function array_map; +use function count; /** * Allow to pick amongst available scope for the current diff --git a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php index 3a5f8c8fb..711c2acf0 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Translation\Translator; +use function in_array; class TranslatableStringFormType extends AbstractType { diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index f6c62dff1..f3faa2bec 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -19,6 +19,7 @@ use function array_key_exists; use function in_array; use function json_decode; use function preg_replace; +use function strlen; /** * Helper to some task linked to phonenumber. diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepository.php b/src/Bundle/ChillMainBundle/Repository/UserRepository.php index 388088fa7..00556702e 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserRepository.php @@ -17,6 +17,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; +use function count; final class UserRepository implements ObjectRepository { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php index 94a6970c8..a94cf41f3 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php @@ -16,6 +16,7 @@ use Knp\Menu\ItemInterface; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Translation\TranslatorInterface; +use function array_key_exists; use function array_merge; use function array_values; @@ -128,7 +129,7 @@ class MenuComposer */ public function hasLocalMenuBuilder($menuId): bool { - return \array_key_exists($menuId, $this->localMenuBuilders); + return array_key_exists($menuId, $this->localMenuBuilders); } /** diff --git a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php index 3577c1300..5b7d6296d 100644 --- a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php +++ b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php @@ -10,6 +10,7 @@ namespace Chill\MainBundle\Search; use DateTime; +use function array_key_exists; use function strpos; /** diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php index d83af2825..a2a65cc96 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApi.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php @@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\ResultSetMappingBuilder; use function array_map; use function array_merge; +use function count; use function implode; use function strtr; diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php index a8a623573..e30d4d587 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php @@ -10,6 +10,7 @@ namespace Chill\MainBundle\Search; use function array_push; +use function count; use function implode; use function strtr; diff --git a/src/Bundle/ChillMainBundle/Search/SearchProvider.php b/src/Bundle/ChillMainBundle/Search/SearchProvider.php index c6f350b20..2acb759f1 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchProvider.php +++ b/src/Bundle/ChillMainBundle/Search/SearchProvider.php @@ -10,6 +10,8 @@ namespace Chill\MainBundle\Search; use function array_key_exists; +use function chr; +use function count; /** * a service which gather all search services defined into the bundles diff --git a/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php b/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php index 9f88ca588..b5b4dbabd 100644 --- a/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php +++ b/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php @@ -10,6 +10,7 @@ namespace Chill\MainBundle\Search\Utils; use LogicException; +use function count; use function implode; use function preg_match; use function str_split; diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index ab8506891..44f6d90c9 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -24,6 +24,7 @@ use Symfony\Component\Security\Core\User\UserInterface; use Traversable; use UnexpectedValueException; use function array_merge; +use function get_class; /** * Helper for authorizations. diff --git a/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php b/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php index b791e7bce..d2c84c9f6 100644 --- a/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php +++ b/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php @@ -13,6 +13,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; use function array_keys; +use function in_array; /** * Helper which traverse all role to find parents. @@ -54,7 +55,7 @@ class ParentRoleHelper foreach ($roles as $r) { $childRoles = $this->roleHierarchy->getReachableRoleNames([$r]); - if (\in_array($role, $childRoles)) { + if (in_array($role, $childRoles)) { $parentRoles[] = $r; } } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php index 01f091b73..4223ff1ca 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php @@ -13,6 +13,7 @@ use Chill\MainBundle\Entity\User; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\Voter; +use function in_array; class PasswordRecoverVoter extends Voter { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php index 1dd2994ea..2dfe1ecf2 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Security\Resolver; use Chill\MainBundle\Entity\Center; use UnexpectedValueException; +use function get_class; use function is_array; final class CenterResolverManager implements CenterResolverManagerInterface diff --git a/src/Bundle/ChillMainBundle/Security/RoleProvider.php b/src/Bundle/ChillMainBundle/Security/RoleProvider.php index 5a0db7239..cceabd9f7 100644 --- a/src/Bundle/ChillMainBundle/Security/RoleProvider.php +++ b/src/Bundle/ChillMainBundle/Security/RoleProvider.php @@ -106,7 +106,7 @@ class RoleProvider } } else { if ($provider->getRoles() !== null) { - $this->rolesTitlesCache = \array_merge( + $this->rolesTitlesCache = array_merge( $this->rolesTitlesCache, array_fill_keys($provider->getRoles(), null) ); diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index 4813203d7..de68e8c50 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use function array_key_exists; use function is_array; class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface @@ -98,7 +99,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt if ('docgen' === $format) { return $data instanceof DateTimeInterface || ( null === $data - && \array_key_exists('docgen:expects', $context) + && array_key_exists('docgen:expects', $context) && ( DateTimeInterface::class === $context['docgen:expects'] || DateTime::class === $context['docgen:expects'] diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php index dbd158229..77043855a 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php @@ -14,6 +14,7 @@ use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; +use function count; use function implode; /** diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index f33241cc7..f00388348 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -15,6 +15,7 @@ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use function array_key_exists; +use function count; use function is_array; class DoctrineExistingEntityNormalizer implements DenormalizerInterface diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php index e4c8a1737..fff38be5d 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php @@ -13,6 +13,8 @@ use Chill\MainBundle\Doctrine\Model\Point; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use function count; +use function is_array; class PointNormalizer implements DenormalizerInterface { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 66ad3aa39..4006e60e4 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -14,6 +14,7 @@ use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RequestStack; use function array_merge; +use function count; class FilterOrderHelper { diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php index 1673ce386..5da53f515 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Templating; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Contracts\Translation\TranslatorInterface; +use function array_key_exists; final class TranslatableStringHelper implements TranslatableStringHelperInterface { diff --git a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php index 05f219b4d..c1f275f63 100644 --- a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php @@ -14,6 +14,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Twig\Environment; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; +use function array_key_exists; use function ksort; /** diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index 89db24e88..d064283f8 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -13,6 +13,11 @@ use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\QueryBuilder; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Traversable; +use function call_user_func; +use function count; +use function is_array; +use function is_callable; +use function is_string; /** * Helper which creates a set of test for aggregators. diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index 643995757..3239bc7cb 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -17,6 +17,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Role\Role; use Traversable; +use function call_user_func; +use function count; +use function is_array; +use function is_callable; +use function is_string; /** * This class provide a set of tests for exports. diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index c86ec285a..b6ce61a94 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -12,6 +12,10 @@ namespace Chill\MainBundle\Test\Export; use Doctrine\ORM\QueryBuilder; use Exception; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use function count; +use function get_class; +use function is_array; +use function is_string; /** * Helper to test filters. diff --git a/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php b/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php index 045397ecc..995727151 100644 --- a/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php @@ -18,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; * @internal * @coversNothing */ -class ExportControllerTest extends KernelTestCase +class PointTest extends KernelTestCase { public function testFromArrayGeoJson() { diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php index 3f4edc17d..21dfefe7f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php @@ -21,6 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Role\Role; +use function count; /** * Test the export manager. diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php index 12a940d98..a6e0c98c8 100644 --- a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\Test\TypeTestCase; * @internal * @coversNothing */ -class CenterTypeTest extends TypeTestCase +class PickCenterTypeTest extends TypeTestCase { /** * Test that a user which can reach multiple center diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php index 9d35fc004..75c34d643 100644 --- a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php @@ -12,6 +12,7 @@ namespace Chill\MainBundle\Tests\Pagination; use Chill\MainBundle\Pagination\Paginator; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use function count; /** * Test the paginator class. diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php index 80a7af66a..8c07e2a8e 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php @@ -23,6 +23,7 @@ use Chill\MainBundle\Test\ProphecyTrait; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Security\Core\Role\Role; use function array_map; +use function in_array; /** * @internal diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php index 570138aea..d1b721975 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php @@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase; * @internal * @coversNothing */ -class DefaultScopeResolverDispatcherTest extends TestCase +class ScopeResolverDispatcherTest extends TestCase { private ScopeResolverDispatcher $scopeResolverDispatcher; diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php index 644bfdf9b..abba8715b 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php @@ -16,6 +16,8 @@ use Doctrine\ORM\Query; use Doctrine\ORM\Query\ResultSetMapping; use LogicException; use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use function array_key_exists; +use function is_string; /** * Build timeline. diff --git a/src/Bundle/ChillMainBundle/Util/CountriesInfo.php b/src/Bundle/ChillMainBundle/Util/CountriesInfo.php index 5577e4543..70f1e5fda 100644 --- a/src/Bundle/ChillMainBundle/Util/CountriesInfo.php +++ b/src/Bundle/ChillMainBundle/Util/CountriesInfo.php @@ -10,6 +10,7 @@ namespace Chill\MainBundle\Util; use UnexpectedValueException; +use function array_key_exists; /** * Get information about countries. diff --git a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php index d0165b302..b874339b1 100644 --- a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php +++ b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php @@ -20,6 +20,7 @@ use function array_key_exists; use function array_merge; use function array_unique; use function array_values; +use function count; use function ksort; /** diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php index bce230ebb..c32bc2000 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php @@ -17,6 +17,7 @@ use RuntimeException; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; +use function in_array; class RoleScopeScopePresence extends ConstraintValidator { diff --git a/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php b/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php index 846922d8f..d04dfa4e0 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php @@ -14,6 +14,7 @@ use Doctrine\Migrations\AbstractMigration; use Doctrine\ORM\Query\ResultSetMapping; use RuntimeException; use Symfony\Component\DependencyInjection\ContainerInterface; +use function count; /** * Migrate association from diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php index afd844610..8b6b1967a 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php @@ -127,7 +127,7 @@ class PersonMove $conditions[] = sprintf('%s = %d', $columns['name'], $from->getId()); } - return \sprintf( + return sprintf( 'DELETE FROM %s WHERE %s', $this->getTableName($metadata), implode(' AND ', $conditions) @@ -151,7 +151,7 @@ class PersonMove $conditions[] = sprintf('%s = %d', $columns['name'], $from->getId()); } - return \sprintf( + return sprintf( 'UPDATE %s SET %s WHERE %s', $this->getTableName($metadata), implode(' ', $sets), diff --git a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php index 6b4a60035..a935334c8 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php @@ -38,7 +38,11 @@ use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Form\FormFactory; use Symfony\Component\Form\FormFactoryInterface; use function array_key_exists; +use function count; use function file_get_contents; +use function get_class; +use function in_array; +use function is_array; use function json_decode; final class ImportPeopleFromCSVCommand extends Command @@ -352,7 +356,7 @@ final class ImportPeopleFromCSVCommand extends Command } // handle address - if (\in_array('postalcode', $headers)) { + if (in_array('postalcode', $headers)) { if (!empty($postalCodeValue)) { $address = new Address(); $postalCode = $this->guessPostalCode($postalCodeValue, $localityValue ?? ''); @@ -363,7 +367,7 @@ final class ImportPeopleFromCSVCommand extends Command $address->setPostcode($postalCode); - if (\in_array('street1', $headers)) { + if (in_array('street1', $headers)) { $address->setStreetAddress1($street1Value); } $address->setValidFrom(new DateTime('today')); @@ -516,13 +520,13 @@ final class ImportPeopleFromCSVCommand extends Command ->getResult(); if (count($centers) > 1) { - if (\strtolower($centers[0]->getName()) === \strtolower($centerName)) { + if (strtolower($centers[0]->getName()) === strtolower($centerName)) { return $centers[0]; } } $centersByName = []; - $names = \array_map(function (Center $c) use (&$centersByName) { + $names = array_map(function (Center $c) use (&$centersByName) { $n = $c->getName(); $centersByName[$n] = $c; @@ -605,7 +609,7 @@ final class ImportPeopleFromCSVCommand extends Command } $postalCodeByName = []; - $names = \array_map(function (PostalCode $pc) use (&$postalCodeByName) { + $names = array_map(function (PostalCode $pc) use (&$postalCodeByName) { $n = $pc->getName(); $postalCodeByName[$n] = $pc; diff --git a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php index dfbce37a7..46442c5de 100644 --- a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php +++ b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php @@ -9,6 +9,8 @@ namespace Chill\PersonBundle\Config; +use function count; + /** * Give help to interact with the config for alt names. */ diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index e5e8140ad..c8e0ec558 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -35,6 +35,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Workflow\Registry; use function array_values; +use function count; final class AccompanyingCourseApiController extends ApiController { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index 7691fd363..d3780a622 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -26,6 +26,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use function array_filter; +use function count; /** * Class AccompanyingPeriodController. diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index d743061c0..ecee951d3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -23,6 +23,8 @@ use Symfony\Component\Security\Core\Security; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; +use function array_key_exists; +use function count; /** * @Route("/{_locale}/person/household") diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index ef50057a0..c9821df06 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -25,6 +25,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Serializer\Exception; use Symfony\Component\Translation\TranslatorInterface; +use function count; class HouseholdMemberController extends ApiController { diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index e7d75af77..8b4add8c3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -16,6 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Validator\Validator\ValidatorInterface; +use function count; /** * Class PersonAddressController diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 82ab0a30f..d66815f61 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -30,6 +30,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Security; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use function count; use function hash; use function implode; use function in_array; diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index d1d9338aa..7f025323a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -27,6 +27,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Translation\TranslatorInterface; +use function count; class PersonDuplicateController extends Controller { diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php index 8a607f111..9791336b6 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Serializer\Model\Collection; use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use function count; class SocialWorkSocialActionApiController extends ApiController { diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php index 6b98ff574..6f4d2c1b4 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php @@ -19,6 +19,7 @@ use DateTimeImmutable; use Doctrine\Persistence\ObjectManager; use function array_pop; use function array_rand; +use function count; class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture implements \Doctrine\Common\DataFixtures\DependentFixtureInterface { diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php index 355dae785..38d8d05de 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php @@ -40,6 +40,7 @@ use Nelmio\Alice\Loader\NativeLoader; use Nelmio\Alice\ObjectSet; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\Workflow\Registry; +use function count; use function random_int; use function ucfirst; @@ -273,7 +274,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con $this->cacheCenters = $this->centerRepository->findAll(); } - return $this->cacheCenters[\array_rand($this->cacheCenters)]; + return $this->cacheCenters[array_rand($this->cacheCenters)]; } /** @@ -291,7 +292,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con return null; } - return $this->cacheCountries[\array_rand($this->cacheCountries)]; + return $this->cacheCountries[array_rand($this->cacheCountries)]; } /** @@ -475,7 +476,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con private function getPostalCode(): PostalCode { - $ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)]; + $ref = LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]; return $this->getReference($ref); } @@ -522,7 +523,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con $this->cacheSocialIssues = $this->socialIssueRepository->findAll(); } - return $this->cacheSocialIssues[\array_rand($this->cacheSocialIssues)]; + return $this->cacheSocialIssues[array_rand($this->cacheSocialIssues)]; } private function getRandomUser(): User @@ -531,7 +532,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con $this->cacheUsers = $this->userRepository->findAll(); } - return $this->cacheUsers[\array_rand($this->cacheUsers)]; + return $this->cacheUsers[array_rand($this->cacheUsers)]; } /* diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 3d52e9352..80f3e711d 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -20,6 +20,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ObjectManager; +use function count; class LoadRelationships extends Fixture implements DependentFixtureInterface { @@ -49,7 +50,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface ->setFromPerson($this->getRandomPerson($this->em)) ->setToPerson($this->getRandomPerson($this->em)) ->setRelation($this->getReference(LoadRelations::RELATION_KEY . - \random_int(0, count(LoadRelations::RELATIONS) - 1))) + random_int(0, count(LoadRelations::RELATIONS) - 1))) ->setReverse((bool) random_int(0, 1)) ->setCreatedBy($user) ->setUpdatedBy($user) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 0ad6c1fd6..69bd90f53 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -21,6 +21,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use function array_key_exists; /** * Class ChillPersonExtension diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index f3eb6538a..e9e2f1713 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -39,6 +39,8 @@ use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\GroupSequenceProviderInterface; use UnexpectedValueException; +use function count; +use function in_array; /** * AccompanyingPeriod Class. diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index 59e9f4149..3fb4b592a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -22,6 +22,7 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function count; /** * @ORM\Entity diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 14ee92cf2..e8dd981bf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -40,6 +40,8 @@ use Exception; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function count; +use function in_array; /** * Person Class. diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index cdca01fdd..6a0783325 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -36,6 +36,8 @@ use function addcslashes; use function array_key_exists; use function array_keys; use function array_merge; +use function count; +use function in_array; use function strtolower; use function uniqid; @@ -429,7 +431,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) { return function ($value) use ($cf, $cfType, $key) { $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; - $decoded = \json_decode($value, true); + $decoded = json_decode($value, true); if ('_header' === $value) { $label = $cfType->getChoices($cf)[$slugChoice]; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php index 93160690d..dc618f1b5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php @@ -19,8 +19,10 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use function array_filter; +use function count; use function implode; use function in_array; +use function is_array; class GenderFilter implements FilterInterface, diff --git a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php index dd26e3cd9..79e0bb225 100644 --- a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php +++ b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php @@ -15,6 +15,7 @@ use RuntimeException; use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use function call_user_func; +use function count; use function in_array; /** diff --git a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php index aaa346893..b817b960c 100644 --- a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php +++ b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php @@ -15,6 +15,7 @@ use Doctrine\Common\Collections\Collection; use Symfony\Component\Form\DataMapperInterface; use Symfony\Component\Form\Exception\UnexpectedTypeException; use function array_key_exists; +use function is_array; class PersonAltNameDataMapper implements DataMapperInterface { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php index 422a372db..414549b1e 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php @@ -26,6 +26,8 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Translation\TranslatorInterface; +use function in_array; +use function is_array; /** * This type allow to pick a person. diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php index 39595adbb..b74c5d250 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php @@ -31,6 +31,7 @@ namespace Chill\PersonBundle\Privacy; use Chill\PersonBundle\Entity\Person; use Symfony\Component\EventDispatcher\Event; +use function count; /** * Class PrivacyEvent. diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index f2e4af721..965231e3f 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; use Symfony\Component\Security\Core\Security; +use function count; final class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodACLAwareRepositoryInterface { diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index 2cb7f9b6a..60ddc1fa3 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -25,6 +25,7 @@ use function array_fill; use function array_map; use function array_merge; use function array_push; +use function count; use function explode; use function implode; diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index d9b858139..69c02c055 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -15,6 +15,7 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; use Exception; +use function count; use function in_array; use function str_replace; diff --git a/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php index 7f60a5a15..5f3d50682 100644 --- a/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); diff --git a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php index 3bcafae97..4aa611d23 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php @@ -18,6 +18,7 @@ use Chill\PersonBundle\Repository\PersonACLAwareRepositoryInterface; use Chill\PersonBundle\Repository\PersonRepository; use Symfony\Component\Security\Core\Security; use function array_map; +use function count; use function in_array; class SearchPersonApiProvider implements SearchApiInterface diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index 2afb7ef75..f62278882 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -17,6 +17,7 @@ use Chill\PersonBundle\Templating\Entity\PersonRender; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; +use function count; class SimilarPersonMatcher { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php index 0b6434a49..a3868607a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php @@ -21,6 +21,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait; use function array_key_exists; use function array_merge; +use function count; class AccompanyingPeriodResourceNormalizer implements DenormalizerInterface, DenormalizerAwareInterface { diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index 5ffaab2c6..3affec5b3 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -25,6 +25,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\Expr\Comparison; use Doctrine\Persistence\ObjectRepository; use Exception; +use function count; final class SocialWorkMetadata implements SocialWorkMetadataInterface { diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php index 3d92f8760..d58822f9c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php @@ -25,6 +25,7 @@ use Symfony\Component\HttpFoundation\Request; use function array_map; use function array_pop; use function array_rand; +use function count; use function json_decode; use function json_encode; diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php index b5a2266e9..babd55c53 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php @@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface; use Iterator; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use function array_pop; +use function count; use function preg_match; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php index 754d7d248..a086471cc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php @@ -15,6 +15,7 @@ use DateTime; use Doctrine\Common\Collections\Criteria; use LogicalException; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use function array_key_exists; /** * Test the creation or deletion of accompanying periods. diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php index 141fa2ded..9c9dcc294 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php @@ -22,6 +22,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use function array_pop; +use function count; use function json_decode; use function json_encode; use function random_int; diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php index d3eceb4b1..1fa4d4e4e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php @@ -14,6 +14,8 @@ use DateTime; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\DomCrawler\Form; +use function count; +use function in_array; /** * Test creation and deletion for persons. diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php index 76d5d124f..041075b4f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php @@ -16,7 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; * @internal * @coversNothing */ -class PersonControllerViewTestWithHiddenFields extends WebTestCase +class PersonControllerViewWithHiddenFieldsTest extends WebTestCase { /** * @var \Doctrine\ORM\EntityManagerInterface The entity manager diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/SocialIssueApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/SocialIssueApiControllerTest.php index f6b18582f..c60f12e58 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/SocialIssueApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/SocialIssueApiControllerTest.php @@ -13,6 +13,7 @@ use Chill\MainBundle\Test\PrepareClientTrait; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\Request; use function array_pop; +use function count; use function json_decode; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php index d790599ae..7bafd44be 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php @@ -16,6 +16,7 @@ use Chill\PersonBundle\Entity\Person; use Chill\ThirdPartyBundle\Entity\ThirdParty; use DateTime; use DateTimeInterface; +use function count; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php b/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php index 6c9832626..c9140e032 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php @@ -12,6 +12,7 @@ namespace Chill\PersonBundle\Tests\Form\Type; use Chill\PersonBundle\Form\Type\PickPersonType; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use function count; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php b/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php index 482cd44b3..8f4cc18b2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php @@ -16,6 +16,7 @@ use Chill\PersonBundle\Household\MembersEditorFactory; use DateTimeImmutable; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validator\ValidatorInterface; +use function count; /** * @internal @@ -91,7 +92,7 @@ class MembersEditorTest extends TestCase ); $persistables = $editor->getPersistable(); - $this->assertEquals(\count($persistables), 1); + $this->assertEquals(count($persistables), 1); $membership1 = $persistables[0]; $this->assertSame($household1, $membership1->getHousehold()); diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php index f0411c1b4..51014d16b 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php @@ -19,6 +19,7 @@ use Doctrine\Common\Collections\Collection; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use function count; class ParticipationOverlapValidator extends ConstraintValidator { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php index 6d21fb4a4..6c56c2f3d 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php @@ -18,6 +18,7 @@ use Doctrine\Common\Collections\Collection; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; +use function count; use function in_array; class ResourceDuplicateCheckValidator extends ConstraintValidator diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php index 48c1e2179..bedcb9621 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php @@ -15,6 +15,7 @@ use Chill\PersonBundle\Templating\Entity\PersonRender; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use function count; /** * Validate that a person does not belong to two household at diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php index f49a4b24e..25767c6c8 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php @@ -14,6 +14,9 @@ use DateTime; use LogicException; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; +use function get_class; +use function gettype; +use function is_object; class BirthdateValidator extends ConstraintValidator { diff --git a/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php b/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php index b95c17259..34a0bc9e8 100644 --- a/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php +++ b/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php @@ -26,6 +26,7 @@ use Symfony\Component\Security\Core\User\UserInterface; use Twig\Environment; use UnexpectedValueException; use function array_key_exists; +use function count; /** * add a widget with person list. diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php b/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php index 808dfa652..1b4d8f041 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php @@ -11,6 +11,7 @@ namespace Chill\Migrations\Person; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; +use function count; /** * Check if each person do not have multiple addresses with the same valideFrom. diff --git a/src/Bundle/ChillReportBundle/Controller/ReportController.php b/src/Bundle/ChillReportBundle/Controller/ReportController.php index f912d23bb..6760ff728 100644 --- a/src/Bundle/ChillReportBundle/Controller/ReportController.php +++ b/src/Bundle/ChillReportBundle/Controller/ReportController.php @@ -23,6 +23,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Role\Role; +use function count; +use function intval; /** * Class ReportController. diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php index 9ceedb160..ae709aacf 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php @@ -13,6 +13,7 @@ use Chill\CustomFieldsBundle\Entity\CustomField; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function count; /** * Load CustomField for Report into database. diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReportACL.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReportACL.php index 181d007bc..e9fa8f436 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReportACL.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReportACL.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\RoleScope; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function in_array; /** * Add a role CHILL_REPORT_UPDATE & CHILL_REPORT_CREATE for all groups except administrative, diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php index d7a030b75..48b81cc4f 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php @@ -19,6 +19,8 @@ use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; use Faker\Factory as FakerFactory; use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use function count; +use function in_array; /** * Load reports into DB. diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index 601ffab83..85c233992 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -40,6 +40,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; use function array_key_exists; use function array_keys; use function array_merge; +use function count; +use function in_array; use function strlen; use function strtolower; use function ucfirst; @@ -107,13 +109,13 @@ class ReportList implements ListInterface, ExportElementValidatedInterface return []; }, 'choice_label' => function (string $key, string $label): string { - switch (\substr($key, 0, 7)) { + switch (substr($key, 0, 7)) { case 'person_': - return $this->translator->trans(\substr($key, 7, strlen($key) - 7)) . + return $this->translator->trans(substr($key, 7, strlen($key) - 7)) . ' (' . $this->translator->trans('Person') . ')'; case 'report_': - return $this->translator->trans(ucfirst(\substr($key, 7, strlen($key) - 7))) . + return $this->translator->trans(ucfirst(substr($key, 7, strlen($key) - 7))) . ' (' . $this->translator->trans('Report') . ')'; default: @@ -342,7 +344,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface // process fields which are not custom fields foreach ($this->fields as $f) { // do not add fields which are not selected - if (!\in_array($f, $data['fields'])) { + if (!in_array($f, $data['fields'])) { continue; } @@ -350,7 +352,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface switch ($f) { case 'person_countryOfBirth': case 'person_nationality': - $suffix = \substr($f, 7); + $suffix = substr($f, 7); $qb->addSelect(sprintf('IDENTITY(person.%s) as %s', $suffix, $f)); break; @@ -363,7 +365,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface case 'person_address_country_name': case 'person_address_country_code': // remove 'person_' - $suffix = \substr($f, 7); + $suffix = substr($f, 7); $qb->addSelect(sprintf( 'GET_PERSON_ADDRESS_%s(person.id, :address_date) AS %s', @@ -386,8 +388,8 @@ class ReportList implements ListInterface, ExportElementValidatedInterface break; default: - $prefix = \substr($f, 0, 7); - $suffix = \substr($f, 7); + $prefix = substr($f, 0, 7); + $suffix = substr($f, 7); switch ($prefix) { case 'person_': @@ -410,7 +412,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface // process fields which are custom fields foreach ($this->getCustomFields() as $cf) { // do not add custom fields which are not selected - if (!\in_array($cf->getSlug(), $data['fields'])) { + if (!in_array($cf->getSlug(), $data['fields'])) { continue; } @@ -500,7 +502,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface */ private function getCustomFields() { - return \array_filter($this->customfieldsGroup + return array_filter($this->customfieldsGroup ->getCustomFields()->toArray(), function (CustomField $cf) { return $cf->getType() !== 'title'; }); @@ -528,7 +530,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) { return function ($value) use ($cf, $cfType, $key) { $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; - $decoded = \json_decode($value, true); + $decoded = json_decode($value, true); if ('_header' === $value) { $label = $cfType->getChoices($cf)[$slugChoice]; diff --git a/src/Bundle/ChillReportBundle/Search/ReportSearch.php b/src/Bundle/ChillReportBundle/Search/ReportSearch.php index b770d2fa3..69ad91a24 100644 --- a/src/Bundle/ChillReportBundle/Search/ReportSearch.php +++ b/src/Bundle/ChillReportBundle/Search/ReportSearch.php @@ -19,6 +19,7 @@ use RuntimeException; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; +use function array_key_exists; /** * Search amongst reports. diff --git a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php index 0030b2444..d5bfb781e 100644 --- a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php @@ -15,6 +15,7 @@ use DateTime; use RuntimeException; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\Client; +use function in_array; /** * This class is much well writtend than ReportControllerTest class, and will diff --git a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php index 4aa6d871b..626f6ae44 100644 --- a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php @@ -17,6 +17,8 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Form; use Symfony\Component\DomCrawler\Link; +use function count; +use function in_array; /** * Test the life cycles of controllers, according to diff --git a/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php b/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php index f49f42d3d..d0b1595d3 100644 --- a/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php @@ -15,6 +15,7 @@ use Chill\PersonBundle\Entity\Person; use Chill\ReportBundle\Entity\Report; use DateTime; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use function count; /** * Test a report is shown into timeline. diff --git a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php index 819d34c1a..c48ff21a4 100644 --- a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php +++ b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php @@ -22,8 +22,11 @@ use LogicException; use Symfony\Component\Security\Core\Security; use UnexpectedValueException; use function array_fill; +use function array_key_exists; use function array_merge; +use function count; use function implode; +use function in_array; use function strtr; /** @@ -236,7 +239,7 @@ break; $askedCenters = $args['centers']; foreach ($reachableCenters as $center) { - if (false === \in_array($center, $askedCenters)) { + if (false === in_array($center, $askedCenters)) { continue; } @@ -246,14 +249,14 @@ break; $scopeIds = []; foreach ($this->helper->getReachableScopes($this->security->getUser(), $role, $center) as $scope) { - if (\in_array($scope->getId(), $scopeIds)) { + if (in_array($scope->getId(), $scopeIds)) { continue; } $scopeIds[] = $scope->getId(); } $formattedClauses[] = strtr($centerScopesClause, [ - '{scopes_ids}' => implode(', ', array_fill(0, \count($scopeIds), '?')), + '{scopes_ids}' => implode(', ', array_fill(0, count($scopeIds), '?')), ]); // append $scopeIds to parameters $parameters = array_merge($parameters, $scopeIds); @@ -294,7 +297,7 @@ break; $scopes = $this->helper->getReachableScopes($this->security->getUser(), $role, $args['person']->getCenter()); foreach ($scopes as $scope) { - if (\in_array($scope->getId(), $parameters)) { + if (in_array($scope->getId(), $parameters)) { continue; } @@ -315,7 +318,7 @@ break; '{scopes_id}' => $reportScopeId, '{scopes_ids}' => implode( ', ', - array_fill(0, \count($parameters) - 1, '?') + array_fill(0, count($parameters) - 1, '?') ), ] ), diff --git a/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php b/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php index f51bb292a..378e33a48 100644 --- a/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php +++ b/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php @@ -16,6 +16,7 @@ use Chill\TaskBundle\Security\Authorization\TaskVoter; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function in_array; /** * Add a role UPDATE & CREATE for all groups except administrative, diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php index d4c230469..b6b90f4ee 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php @@ -29,6 +29,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt use Symfony\Component\Security\Core\Role\Role; use function array_combine; use function array_map; +use function count; class SingleTaskListType extends AbstractType { diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index 1a9002800..3880a0a48 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -23,6 +23,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; use LogicException; use Symfony\Component\Security\Core\Security; +use function count; use function substr; final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepositoryInterface diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php index 7014d68a2..d516da094 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php @@ -21,6 +21,7 @@ use LogicException; use Symfony\Component\Security\Core\Role\Role; use UnexpectedValueException; use function array_key_exists; +use function count; /** * Class SingleTaskRepository. diff --git a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php index 8dc8debe9..5884d073a 100644 --- a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php +++ b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php @@ -25,6 +25,7 @@ use UnexpectedValueException; use function array_combine; use function array_fill; use function array_map; +use function count; use function implode; use function in_array; use function strtr; @@ -221,7 +222,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface ); } - if (0 === \count($clauses)) { + if (0 === count($clauses)) { return ['FALSE = TRUE', []]; } diff --git a/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php b/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php index f69e3d0b0..36976db81 100644 --- a/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php +++ b/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php @@ -14,6 +14,7 @@ use LogicException; use Symfony\Component\Workflow\Event\Event; use Symfony\Component\Workflow\SupportStrategy\WorkflowSupportStrategyInterface; use Symfony\Component\Workflow\WorkflowInterface; +use function count; use function sprintf; class TaskWorkflowManager implements WorkflowSupportStrategyInterface diff --git a/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php b/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php index baa8b5349..d7feba8c5 100644 --- a/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php @@ -22,6 +22,7 @@ use Iterator; use Nelmio\Alice\Loader\NativeLoader; use Nelmio\Alice\ObjectSet; use function array_map; +use function count; class LoadThirdParty extends Fixture implements DependentFixtureInterface { @@ -79,7 +80,7 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface $number = random_int(1, count($references)); if (1 === $number) { - yield $this->getReference($references[\array_rand($references)]); + yield $this->getReference($references[array_rand($references)]); } else { foreach (array_rand($references, $number) as $index) { yield $this->getReference($references[$index]); @@ -89,7 +90,7 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface private function getPostalCode(): PostalCode { - $ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)]; + $ref = LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]; return $this->getReference($ref); } diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index a6ab4f849..fa4dd34e9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -31,6 +31,7 @@ use function array_map; use function array_merge; use function array_values; use function in_array; +use function is_string; use function spl_object_hash; /** diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyType.php index 56fbc5d73..cf0edc754 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyType.php @@ -23,6 +23,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Translation\TranslatorInterface; use function array_diff; use function array_merge; +use function count; use function is_array; class PickThirdPartyType extends AbstractType diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php index ac157d566..48cb195f5 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php @@ -19,6 +19,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Translation\TranslatorInterface; use function array_merge; use function implode; +use function is_array; +use function is_string; use function uasort; class PickThirdPartyTypeCategoryType extends \Symfony\Component\Form\AbstractType diff --git a/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php b/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php index 20f13cae8..62ed77eec 100644 --- a/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php +++ b/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php @@ -17,6 +17,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Role\Role; use function array_intersect; +use function count; use function in_array; /** diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php index 2a79e4282..4f6727598 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php @@ -30,6 +30,7 @@ use Symfony\Component\Mime\MimeTypes; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Contracts\HttpClient\HttpClientInterface; use Throwable; +use function strlen; final class ChillDocumentManager implements DocumentManagerInterface {