From f398db0d534d39783b082e5ae7279b6ccaba56cf Mon Sep 17 00:00:00 2001 From: DKravtsov Date: Tue, 25 Jun 2024 20:20:36 +0300 Subject: [PATCH] Symfony 7.1, MySQL 8.4, updated docker docs, updated composer dependencies, refactoring. --- .circleci/config.yml | 2 +- .dockerignore | 8 +- .env | 8 +- .gitlab-ci.yml | 8 +- .idea/codeception.xml | 10 +- .idea/htdocs.iml | 48 +- .idea/php.xml | 611 ++-- .idea/phpspec.xml | 21 + .idea/phpunit.xml | 3 +- Dockerfile | 2 +- Makefile | 54 +- bin/console | 4 + docker-compose-prod.yml => compose-prod.yaml | 2 - ...ompose-staging.yml => compose-staging.yaml | 2 - ...ompose-test-ci.yml => compose-test-ci.yaml | 2 - docker-compose.yml => compose.yaml | 2 - composer.json | 83 +- composer.lock | 2941 ++++++++--------- config/bundles.php | 3 +- config/packages/doctrine.yaml | 2 + config/packages/doctrine_extensions.yaml | 3 +- config/packages/framework.yaml | 2 +- config/services.yaml | 5 +- docs/development.md | 4 +- docs/images/phpstorm_06.png | Bin 52103 -> 59952 bytes docs/images/phpstorm_07.png | Bin 38514 -> 0 bytes docs/images/phpstorm_08.png | Bin 30972 -> 0 bytes docs/images/phpstorm_09.png | Bin 34276 -> 0 bytes docs/images/phpstorm_10.png | Bin 31021 -> 0 bytes docs/images/phpstorm_11_1.png | Bin 72001 -> 0 bytes docs/images/phpstorm_11_2.png | Bin 73044 -> 0 bytes docs/images/phpstorm_php_code_sniffer_1.png | Bin 0 -> 54941 bytes docs/images/phpstorm_php_code_sniffer_2.png | Bin 0 -> 41201 bytes docs/images/phpstorm_php_cs_fixer_1.png | Bin 0 -> 50436 bytes docs/images/phpstorm_php_cs_fixer_2.png | Bin 0 -> 37349 bytes docs/images/phpstorm_phpmd_1.png | Bin 0 -> 57230 bytes docs/images/phpstorm_phpmd_2.png | Bin 0 -> 33151 bytes docs/images/phpstorm_phpstan_1.png | Bin 0 -> 54176 bytes docs/images/phpstorm_phpstan_2.png | Bin 0 -> 32980 bytes docs/phpstorm.md | 21 +- docs/testing.md | 10 +- ecs.php | 7 + migrations/Version20211001194001.php | 3 + phpstan.neon.dist | 2 +- phpunit.xml.dist | 4 +- readme.md | 18 +- .../DataFixtures/ORM/LoadApiKeyData.php | 2 - .../Resource/ResourceCollection.php | 2 + .../Rest/Interfaces/RestResourceInterface.php | 12 +- .../Doctrine/DBAL/Types/EnumLanguageType.php | 2 +- .../Doctrine/DBAL/Types/EnumLocaleType.php | 2 +- .../Doctrine/DBAL/Types/EnumLogLoginType.php | 13 +- .../Domain/Doctrine/DBAL/Types/EnumType.php | 52 +- .../Doctrine/DBAL/Types/RealEnumType.php | 95 - .../Transport/Command/HelperConfigure.php | 19 +- .../Transport/Rest/ControllerCollection.php | 4 +- .../LoginLoggerServiceInterface.php | 3 +- .../Service/LoginLoggerService.php | 5 +- src/Log/Domain/Entity/LogLogin.php | 5 +- src/Log/Domain/Enum/LogLogin.php | 19 + .../DataFixtures/ORM/LoadRoleData.php | 2 - ...TranslatedAuthenticationFailureHandler.php | 2 +- .../DataFixtures/ORM/LoadUserData.php | 2 - .../DataFixtures/ORM/LoadUserGroupData.php | 2 - .../AuthenticationFailureSubscriber.php | 9 +- .../AuthenticationSuccessSubscriber.php | 4 +- symfony.lock | 31 +- .../Api/v1/ApiKeyControllerTest.php | 2 +- .../Api/v2/ApiKeyCountControllerTest.php | 2 +- .../Api/v2/ApiKeyCreateControllerTest.php | 2 +- .../Api/v2/ApiKeyDeleteControllerTest.php | 4 +- .../Api/v2/ApiKeyIdsControllerTest.php | 2 +- .../Api/v2/ApiKeyListControllerTest.php | 2 +- .../Api/v2/ApiKeyPatchControllerTest.php | 4 +- .../Api/v2/ApiKeyUpdateControllerTest.php | 4 +- .../Api/v2/ApiKeyViewControllerTest.php | 2 +- .../Controller/Api/v2/Traits/ApiKeyHelper.php | 2 +- .../Controller/CommandSchedulerTest.php | 2 +- .../Controller/DocumentationTest.php | 2 +- .../Api/v1/Role/FindOneRoleControllerTest.php | 2 +- .../v1/Role/InheritedRolesControllerTest.php | 2 +- .../Api/v1/Role/RoleControllerTest.php | 2 +- .../Controller/Api/HealthControllerTest.php | 2 +- .../Controller/Api/IndexControllerTest.php | 2 +- .../Controller/Api/VersionControllerTest.php | 2 +- .../Localization/LanguageControllerTest.php | 2 +- .../v1/Localization/LocaleControllerTest.php | 2 +- .../Localization/TimeZoneControllerTest.php | 2 +- .../Api/v1/Auth/GetTokenControllerTest.php | 2 +- .../Api/v1/Profile/GroupsControllerTest.php | 2 +- .../Api/v1/Profile/IndexControllerTest.php | 2 +- .../Api/v1/Profile/RolesControllerTest.php | 2 +- .../Controller/Api/v1/Traits/UserHelper.php | 2 +- .../v1/User/AttachUserGroupControllerTest.php | 2 +- .../Api/v1/User/DeleteUserControllerTest.php | 2 +- .../v1/User/DetachUserGroupControllerTest.php | 2 +- .../Api/v1/User/UserControllerTest.php | 4 +- .../Api/v1/User/UserGroupsControllerTest.php | 2 +- .../Api/v1/User/UserRolesControllerTest.php | 2 +- .../v1/UserGroup/AttachUserControllerTest.php | 2 +- .../v1/UserGroup/DetachUserControllerTest.php | 2 +- .../v1/UserGroup/UserGroupControllerTest.php | 4 +- .../Api/v1/UserGroup/UsersControllerTest.php | 4 +- tests/Utils/PhpUnitUtil.php | 4 +- tools/01_phpunit/composer.json | 10 +- tools/01_phpunit/composer.lock | 674 ++-- tools/02_phpstan/composer.json | 6 +- tools/02_phpstan/composer.lock | 135 +- tools/03_ecs/composer.json | 4 +- tools/03_ecs/composer.lock | 1044 +++++- tools/04_php-coveralls/composer.lock | 299 +- tools/05_phpinsights/composer.lock | 1097 +++++- tools/06_phpmd/composer.lock | 260 +- tools/07_phpmetrics/composer.lock | 95 +- tools/08_rector/composer.json | 2 +- tools/08_rector/composer.lock | 121 +- tools/09_composer/composer.json | 4 +- tools/09_composer/composer.lock | 580 ++-- 118 files changed, 4904 insertions(+), 3697 deletions(-) rename docker-compose-prod.yml => compose-prod.yaml (99%) rename docker-compose-staging.yml => compose-staging.yaml (99%) rename docker-compose-test-ci.yml => compose-test-ci.yaml (99%) rename docker-compose.yml => compose.yaml (99%) delete mode 100644 docs/images/phpstorm_07.png delete mode 100644 docs/images/phpstorm_08.png delete mode 100644 docs/images/phpstorm_09.png delete mode 100644 docs/images/phpstorm_10.png delete mode 100644 docs/images/phpstorm_11_1.png delete mode 100644 docs/images/phpstorm_11_2.png create mode 100644 docs/images/phpstorm_php_code_sniffer_1.png create mode 100644 docs/images/phpstorm_php_code_sniffer_2.png create mode 100644 docs/images/phpstorm_php_cs_fixer_1.png create mode 100644 docs/images/phpstorm_php_cs_fixer_2.png create mode 100644 docs/images/phpstorm_phpmd_1.png create mode 100644 docs/images/phpstorm_phpmd_2.png create mode 100644 docs/images/phpstorm_phpstan_1.png create mode 100644 docs/images/phpstorm_phpstan_2.png delete mode 100644 src/General/Domain/Doctrine/DBAL/Types/RealEnumType.php create mode 100644 src/Log/Domain/Enum/LogLogin.php rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v1/ApiKeyControllerTest.php (99%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyCountControllerTest.php (96%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyCreateControllerTest.php (98%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyDeleteControllerTest.php (95%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyIdsControllerTest.php (96%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyListControllerTest.php (96%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyPatchControllerTest.php (95%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyUpdateControllerTest.php (95%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/ApiKeyViewControllerTest.php (96%) rename tests/{Functional => Application}/ApiKey/Transport/Controller/Api/v2/Traits/ApiKeyHelper.php (98%) rename tests/{Functional => Application}/Controller/CommandSchedulerTest.php (94%) rename tests/{Functional => Application}/Controller/DocumentationTest.php (95%) rename tests/{Functional => Application}/Role/Transport/Controller/Api/v1/Role/FindOneRoleControllerTest.php (97%) rename tests/{Functional => Application}/Role/Transport/Controller/Api/v1/Role/InheritedRolesControllerTest.php (97%) rename tests/{Functional => Application}/Role/Transport/Controller/Api/v1/Role/RoleControllerTest.php (98%) rename tests/{Functional => Application}/Tool/Transport/Controller/Api/HealthControllerTest.php (95%) rename tests/{Functional => Application}/Tool/Transport/Controller/Api/IndexControllerTest.php (92%) rename tests/{Functional => Application}/Tool/Transport/Controller/Api/VersionControllerTest.php (96%) rename tests/{Functional => Application}/Tool/Transport/Controller/Api/v1/Localization/LanguageControllerTest.php (95%) rename tests/{Functional => Application}/Tool/Transport/Controller/Api/v1/Localization/LocaleControllerTest.php (95%) rename tests/{Functional => Application}/Tool/Transport/Controller/Api/v1/Localization/TimeZoneControllerTest.php (96%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/Auth/GetTokenControllerTest.php (97%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/Profile/GroupsControllerTest.php (96%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/Profile/IndexControllerTest.php (97%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/Profile/RolesControllerTest.php (96%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/Traits/UserHelper.php (97%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/User/AttachUserGroupControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/User/DeleteUserControllerTest.php (97%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/User/DetachUserGroupControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/User/UserControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/User/UserGroupsControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/User/UserRolesControllerTest.php (97%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/UserGroup/AttachUserControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/UserGroup/DetachUserControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/UserGroup/UserGroupControllerTest.php (98%) rename tests/{Functional => Application}/User/Transport/Controller/Api/v1/UserGroup/UsersControllerTest.php (95%) diff --git a/.circleci/config.yml b/.circleci/config.yml index d7022c23..55d08679 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,7 +34,7 @@ jobs: make info - run: - name: Run unit/functional tests + name: Run unit/application tests command: | make phpunit diff --git a/.dockerignore b/.dockerignore index 195b0ab6..a80cdd10 100644 --- a/.dockerignore +++ b/.dockerignore @@ -24,7 +24,7 @@ ### Docker Dockerfile -docker-compose.yml -docker-compose-test-ci.yml -docker-compose-staging.yml -docker-compose-prod.yml +compose.yaml +compose-test-ci.yaml +compose-staging.yaml +compose-prod.yaml diff --git a/.env b/.env index 52fa053e..ca3caa9b 100644 --- a/.env +++ b/.env @@ -14,9 +14,9 @@ # Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration -###> docker-compose configuration ### +###> docker compose configuration ### COMPOSE_PROJECT_NAME=backend -###< docker-compose configuration ### +###< docker compose configuration ### ###> docker configuration that can be overridden in .env.local ### WEB_PORT_HTTP=80 @@ -25,8 +25,8 @@ WEB_PORT_SSL=443 XDEBUG_CONFIG=main # Sometimes we need to use different xdebug versions, list of versions can be found here - https://pecl.php.net/package/xdebug XDEBUG_VERSION=3.3.2 -# MySQL version, recommend values: 8.2|8.1|8.0 -MYSQL_VERSION=8.2 +# MySQL version, recommend values: 8.4|8.3|8.2|8.1|8.0 +MYSQL_VERSION=8.4 # MySQL INNODB_USE_NATIVE_AIO possible values: 1|0. Set to 0 when AIO interface is not supported on OSX. https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_use_native_aio INNODB_USE_NATIVE_AIO=1 # Sometimes AWS MySQL RDS has SQL_MODE="NO_ENGINE_SUBSTITUTION" (https://github.com/awsdocs/amazon-rds-user-guide/issues/160) but MySQL default described here - https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2e6d990..65f5bb41 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,9 +57,9 @@ push_staging_images: stage: deploy script: - make build-staging - # TODO: set necessary image name in docker-compose-staging.yml according to your registry and edit lines bellow + # TODO: set necessary image name in compose-staging.yaml according to your registry and edit lines bellow #- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - #- docker-compose -f docker-compose-staging.yml push + #- docker compose -f compose-staging.yaml push only: - master - develop @@ -69,9 +69,9 @@ push_prod_images: stage: deploy script: - make build-prod - # TODO: set necessary image name in docker-compose-prod.yml according to your registry and edit lines bellow + # TODO: set necessary image name in compose-prod.yaml according to your registry and edit lines bellow #- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - #- docker-compose -f docker-compose-prod.yml push + #- docker compose -f compose-prod.yaml push only: - master - /^release.*$/ diff --git a/.idea/codeception.xml b/.idea/codeception.xml index c888143b..0f6bbaf0 100644 --- a/.idea/codeception.xml +++ b/.idea/codeception.xml @@ -49,10 +49,16 @@