From 701968be5245415170dd45bf85f661b2fcf5de33 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 29 Sep 2022 19:17:43 +0200 Subject: [PATCH 1/5] Allow to disable Server Side Rendering by config --- .env.dist | 3 +++ docker-compose.yml | 1 + src/webapp/nuxt.config.js | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.dist b/.env.dist index 9d6fb2a2..0babf2b5 100644 --- a/.env.dist +++ b/.env.dist @@ -20,6 +20,9 @@ STORAGE_SUBDOMAIN=minio # API APP_SECRET=$ecretf0rt3st +# WEBAPP +NUXT_SSR=1 + # MySQL MYSQL_ROOT_PASSWORD=super-secret MYSQL_DATABASE=symfony-boilerplate diff --git a/docker-compose.yml b/docker-compose.yml index 7dacd333..1434f4ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -65,6 +65,7 @@ services: # LogRocket. # LOGROCKET_ID # LOGROCKET_DEV_MODE_ALLOWED + NUXT_SSR: "${NUXT_SSR:-1}" volumes: - ./src/webapp:/usr/src/app diff --git a/src/webapp/nuxt.config.js b/src/webapp/nuxt.config.js index bf3e1297..5b651b30 100644 --- a/src/webapp/nuxt.config.js +++ b/src/webapp/nuxt.config.js @@ -7,7 +7,7 @@ export default { /* ** SSR Feature (server side rendering) */ - ssr: true, + ssr: process.env.NUXT_SSR === '1', /* ** Headers of the page ** See https://nuxtjs.org/api/configuration-head From 48eaf85257fc3582e22ba7c42fd8daf26ac1c804 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 29 Sep 2022 19:19:19 +0200 Subject: [PATCH 2/5] Add rector and apply some refactor --- src/api/composer.json | 1 + src/api/composer.lock | 89 +++++++++++++++---- src/api/config/services.yaml | 2 +- src/api/phpcs.xml.dist | 1 - src/api/rector.php | 56 ++++++++++++ .../Domain/Constraint/UnicityValidator.php | 13 ++- src/api/src/Domain/Dao/UserDao.php | 5 +- src/api/src/Domain/Enum/Filter/SortOrder.php | 6 ++ .../src/Domain/Enum/Filter/UsersSortBy.php | 9 ++ src/api/src/Domain/Enum/Locale.php | 6 ++ src/api/src/Domain/Enum/Role.php | 6 ++ .../src/Domain/Model/Proxy/PasswordProxy.php | 16 +--- .../src/Domain/Model/Storable/Storable.php | 10 +-- src/api/src/Domain/Model/User.php | 32 +++---- src/api/src/Domain/Storage/PrivateStorage.php | 2 +- src/api/src/Domain/Storage/PublicStorage.php | 2 +- src/api/src/Domain/Storage/Storage.php | 13 +-- .../Command/DevFixturesCommand.php | 10 +-- .../Command/InitializeS3StorageCommand.php | 30 ++----- .../User/UserProfilePictureController.php | 8 +- .../User/UsersXLSXExportController.php | 11 +-- .../EventSubscriber/LocaleSubscriber.php | 8 +- .../Infrastructure/Fixtures/AppFixtures.php | 10 +-- .../src/Infrastructure/S3/CreateBucket.php | 8 +- .../Infrastructure/Security/UserProvider.php | 8 +- .../Security/Voter/AppVoter.php | 8 +- .../Security/Voter/UserVoter.php | 6 ++ src/api/src/UseCase/CreateEmail.php | 17 +--- src/api/src/UseCase/CreateXLSXExport.php | 5 +- src/api/src/UseCase/User/CreateUser.php | 13 +-- src/api/src/UseCase/User/DeleteUser.php | 9 +- src/api/src/UseCase/User/GetUsers.php | 8 +- .../CreateResetPasswordEmail.php | 9 +- .../User/ResetPassword/ResetPassword.php | 17 +--- src/api/src/UseCase/User/UpdateLocale.php | 8 +- src/api/src/UseCase/User/UpdatePassword.php | 13 +-- .../src/UseCase/User/UpdateProfilePicture.php | 9 +- src/api/src/UseCase/User/UpdateUser.php | 9 +- .../VerifyResetPasswordToken.php | 8 +- src/api/symfony.lock | 3 + 40 files changed, 252 insertions(+), 252 deletions(-) create mode 100644 src/api/rector.php diff --git a/src/api/composer.json b/src/api/composer.json index 9c16327c..511cf341 100644 --- a/src/api/composer.json +++ b/src/api/composer.json @@ -66,6 +66,7 @@ "phpstan/phpstan": "^1.0", "phpunit/phpunit": "^9.0", "qossmic/deptrac-shim": "^0.11.1", + "rector/rector": "^0.14.4", "squizlabs/php_codesniffer": "^3.6", "symfony/debug-bundle": "^5.4", "symfony/phpunit-bridge": "^6.0", diff --git a/src/api/composer.lock b/src/api/composer.lock index 3fd24ea6..3cbe0d74 100644 --- a/src/api/composer.lock +++ b/src/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9f64400e013d4f2f2f9770f5cae9db63", + "content-hash": "7c585f22db5cb904e5baae3dea45cf4a", "packages": [ { "name": "aws/aws-crt-php", @@ -12849,20 +12849,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.3.1", + "version": "1.8.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c3e7a5837829b3cd5907b895da73a4da084a9f8f" + "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c3e7a5837829b3cd5907b895da73a4da084a9f8f", - "reference": "c3e7a5837829b3cd5907b895da73a4da084a9f8f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c386ab2741e64cc9e21729f891b28b2b10fe6618", + "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -12872,11 +12872,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -12887,9 +12882,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.3.1" + "source": "https://github.com/phpstan/phpstan/tree/1.8.6" }, "funding": [ { @@ -12900,16 +12899,12 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-01-04T17:12:37+00:00" + "time": "2022-09-23T09:54:39+00:00" }, { "name": "phpunit/php-code-coverage", @@ -13380,6 +13375,64 @@ }, "time": "2021-02-09T07:29:49+00:00" }, + { + "name": "rector/rector", + "version": "0.14.4", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "149764b07abdbfd23e98c4bb33fa6c49e2ad57cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/149764b07abdbfd23e98c4bb33fa6c49e2ad57cc", + "reference": "149764b07abdbfd23e98c4bb33fa6c49e2ad57cc", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.8.3" + }, + "conflict": { + "rector/rector-cakephp": "*", + "rector/rector-doctrine": "*", + "rector/rector-laravel": "*", + "rector/rector-php-parser": "*", + "rector/rector-phpoffice": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.14-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.14.4" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-09-27T23:39:09+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.1", @@ -14877,5 +14930,5 @@ "ext-iconv": "*" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/src/api/config/services.yaml b/src/api/config/services.yaml index ac8e3c77..9322bbff 100644 --- a/src/api/config/services.yaml +++ b/src/api/config/services.yaml @@ -63,7 +63,7 @@ services: # Commands. App\Infrastructure\Command\InitializeS3StorageCommand: arguments: - $s3Client: '@s3.client' + $client: '@s3.client' $publicBucket: '%app.storage_public_bucket%' $privateBucket: '%app.storage_private_bucket%' $publicSource: '%app.storage_public_source%' diff --git a/src/api/phpcs.xml.dist b/src/api/phpcs.xml.dist index 0131c48b..7fff8be0 100644 --- a/src/api/phpcs.xml.dist +++ b/src/api/phpcs.xml.dist @@ -27,7 +27,6 @@ src/Domain/Model/Generated/** - src/Domain/Assert/** src/Domain/Dao/Generated/** src/Domain/ResultIterator/Generated/** src/Kernel.php diff --git a/src/api/rector.php b/src/api/rector.php new file mode 100644 index 00000000..610eeaae --- /dev/null +++ b/src/api/rector.php @@ -0,0 +1,56 @@ +paths([ + __DIR__ . '/src', + ]); + + // register a single rule + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + // define sets of rules + $rectorConfig->sets([ + // Update to php 8.0 standards + SetList::PHP_80, + LevelSetList::UP_TO_PHP_74, + // Update to symfony 5.4 standard + SymfonySetList::SYMFONY_54, + SymfonySetList::SYMFONY_CODE_QUALITY, + SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, + ]); + $rectorConfig->rules([ + // Code style + Use_\SeparateMultiUseImportsRector::class, + ClassConst\SplitGroupedConstantsAndPropertiesRector::class, + String_\SymplifyQuoteEscapeRector::class, + String_\UseClassKeywordForClassNameResolutionRector::class, + ClassConst\VarConstantCommentRector::class, + Encapsed\WrapEncapsedVariableInCurlyBracesRector::class, + // Dead code + Cast\RecastingRemovalRector::class, + ]); + $rectorConfig->skip([ + // Ignore TDBM generated + __DIR__ . '/src/Domain/Model/Generated', + __DIR__ . '/src/Domain/Dao/Generated', + __DIR__ . '/src/Domain/ResultIterator/Generated', + // Ignore recommended symfony configuration for "Define Commands as Services" (abstract do not use php 7 standards) + Class_\MakeCommandLazyRector::class, + ]); + $rectorConfig->phpVersion(PhpVersion::PHP_80); +}; diff --git a/src/api/src/Domain/Constraint/UnicityValidator.php b/src/api/src/Domain/Constraint/UnicityValidator.php index 899f5f3f..fac92cc3 100644 --- a/src/api/src/Domain/Constraint/UnicityValidator.php +++ b/src/api/src/Domain/Constraint/UnicityValidator.php @@ -15,11 +15,9 @@ final class UnicityValidator extends ConstraintValidator { - private TDBMService $tdbmService; - - public function __construct(TDBMService $tdbmService) - { - $this->tdbmService = $tdbmService; + public function __construct( + private TDBMService $tdbmService, + ) { } public function validate(mixed $value, Constraint $constraint): void @@ -50,7 +48,7 @@ public function validate(mixed $value, Constraint $constraint): void $existingObject = $this->tdbmService->findObject( mainTable : $constraint->table, filter : [$constraint->column . ' = :value'], - parameters : ['value' => $value->$getterValue(),], + parameters : ['value' => $value->$getterValue()], additionalTablesFetch: [], className : $constraint->className, resultIteratorClass : ResultIterator::class @@ -67,7 +65,6 @@ className : $constraint->className, $this->context ->buildViolation($constraint->message) ->atPath($constraint->column) - ->addViolation() - ; + ->addViolation(); } } diff --git a/src/api/src/Domain/Dao/UserDao.php b/src/api/src/Domain/Dao/UserDao.php index c58137c8..80d648cd 100644 --- a/src/api/src/Domain/Dao/UserDao.php +++ b/src/api/src/Domain/Dao/UserDao.php @@ -27,11 +27,8 @@ */ class UserDao extends BaseUserDao { - private ValidatorInterface $validator; - - public function __construct(TDBMService $tdbmService, ValidatorInterface $validator) + public function __construct(TDBMService $tdbmService, private ValidatorInterface $validator) { - $this->validator = $validator; parent::__construct(tdbmService: $tdbmService); } diff --git a/src/api/src/Domain/Enum/Filter/SortOrder.php b/src/api/src/Domain/Enum/Filter/SortOrder.php index 7cdd2c14..7629d86c 100644 --- a/src/api/src/Domain/Enum/Filter/SortOrder.php +++ b/src/api/src/Domain/Enum/Filter/SortOrder.php @@ -14,6 +14,12 @@ #[GraphQLite\EnumType] final class SortOrder extends Enum { + /** + * @var string + */ private const ASC = 'ASC'; + /** + * @var string + */ private const DESC = 'DESC'; } diff --git a/src/api/src/Domain/Enum/Filter/UsersSortBy.php b/src/api/src/Domain/Enum/Filter/UsersSortBy.php index 70c5cd3f..78ac2566 100644 --- a/src/api/src/Domain/Enum/Filter/UsersSortBy.php +++ b/src/api/src/Domain/Enum/Filter/UsersSortBy.php @@ -15,7 +15,16 @@ #[GraphQLite\EnumType] final class UsersSortBy extends Enum { + /** + * @var string + */ private const FIRST_NAME = 'first_name'; + /** + * @var string + */ private const LAST_NAME = 'last_name'; + /** + * @var string + */ private const EMAIL = 'email'; } diff --git a/src/api/src/Domain/Enum/Locale.php b/src/api/src/Domain/Enum/Locale.php index 49701a6e..99cca29d 100644 --- a/src/api/src/Domain/Enum/Locale.php +++ b/src/api/src/Domain/Enum/Locale.php @@ -14,7 +14,13 @@ #[GraphQLite\EnumType] final class Locale extends Enum { + /** + * @var string + */ private const EN = 'en'; + /** + * @var string + */ private const FR = 'fr'; /** diff --git a/src/api/src/Domain/Enum/Role.php b/src/api/src/Domain/Enum/Role.php index df3f2a66..6b548a64 100644 --- a/src/api/src/Domain/Enum/Role.php +++ b/src/api/src/Domain/Enum/Role.php @@ -14,7 +14,13 @@ #[GraphQLite\EnumType] final class Role extends Enum { + /** + * @var string + */ private const ADMINISTRATOR = 'ADMINISTRATOR'; + /** + * @var string + */ private const USER = 'USER'; /** diff --git a/src/api/src/Domain/Model/Proxy/PasswordProxy.php b/src/api/src/Domain/Model/Proxy/PasswordProxy.php index 16f5c861..c525f36d 100644 --- a/src/api/src/Domain/Model/Proxy/PasswordProxy.php +++ b/src/api/src/Domain/Model/Proxy/PasswordProxy.php @@ -8,20 +8,8 @@ final class PasswordProxy { - #[Assert\NotBlank(message: 'not_blank')] - #[Assert\Length(min: 8, minMessage: 'min_length_8')] - #[Assert\NotCompromisedPassword(message: 'user.not_compromised_password')] - private string $newPassword; - - #[Assert\Expression(expression: 'this.getNewPassword() === this.getPasswordConfirmation()', message: 'user.wrong_password_confirmation')] - private string $passwordConfirmation; - - public function __construct( - string $newPassword, - string $passwordConfirmation - ) { - $this->newPassword = $newPassword; - $this->passwordConfirmation = $passwordConfirmation; + public function __construct(#[Assert\NotBlank(message: 'not_blank')] #[Assert\Length(min: 8, minMessage: 'min_length_8')] #[Assert\NotCompromisedPassword(message: 'user.not_compromised_password')] private string $newPassword, #[Assert\Expression(expression: 'this.getNewPassword() === this.getPasswordConfirmation()', message: 'user.wrong_password_confirmation')] private string $passwordConfirmation) + { } public function getNewPassword(): string diff --git a/src/api/src/Domain/Model/Storable/Storable.php b/src/api/src/Domain/Model/Storable/Storable.php index b2793a7c..e7f193d9 100644 --- a/src/api/src/Domain/Model/Storable/Storable.php +++ b/src/api/src/Domain/Model/Storable/Storable.php @@ -4,7 +4,6 @@ namespace App\Domain\Model\Storable; -use App\Domain\Constraint as DomainAssert; use Psr\Http\Message\UploadedFileInterface; use Ramsey\Uuid\Uuid; use RuntimeException; @@ -16,23 +15,16 @@ abstract class Storable { protected SplFileInfo $fileInfo; private string $filename; - /** - * @var resource $resource - * @DomainAssert\IsResource - */ - private $resource; /** * @param resource $resource */ - final public function __construct(string $filename, $resource, bool $overrideFilename = true) + final public function __construct(string $filename, private $resource, bool $overrideFilename = true) { $this->fileInfo = new SplFileInfo($filename); $this->filename = $overrideFilename === true ? Uuid::uuid4()->toString() : $filename; - - $this->resource = $resource; } public function getFilename(): string diff --git a/src/api/src/Domain/Model/User.php b/src/api/src/Domain/Model/User.php index f5dc411a..ff898707 100644 --- a/src/api/src/Domain/Model/User.php +++ b/src/api/src/Domain/Model/User.php @@ -48,40 +48,34 @@ public function __construct( string $lastName, string $email, Locale $locale, - Role $role + Role $role, ) { parent::__construct( firstName: $firstName, lastName : $lastName, email : $email, locale : strval($locale), - role : strval($role) + role : strval($role), ); } - /** - * @Assert\NotBlank(message="not_blank") - * @Assert\Length(max=255, maxMessage="max_length_255") - */ + #[Assert\NotBlank(message: 'not_blank')] + #[Assert\Length(max: 255, maxMessage: 'max_length_255')] public function getFirstName(): string { return parent::getFirstName(); } - /** - * @Assert\NotBlank(message="not_blank") - * @Assert\Length(max=255, maxMessage="max_length_255") - */ + #[Assert\NotBlank(message: 'not_blank')] + #[Assert\Length(max: 255, maxMessage: 'max_length_255')] public function getLastName(): string { return parent::getLastName(); } - /** - * @Assert\NotBlank(message="not_blank") - * @Assert\Length(max=255, maxMessage="max_length_255") - * @Assert\Email(message="invalid_email") - */ + #[Assert\NotBlank(message: 'not_blank')] + #[Assert\Length(max: 255, maxMessage: 'max_length_255')] + #[Assert\Email(message: 'invalid_email')] public function getEmail(): string { return parent::getEmail(); @@ -98,17 +92,13 @@ public function setPassword(?string $password): void parent::setPassword(password_hash($password, PASSWORD_DEFAULT)); } - /** - * @Assert\Choice(callback={"App\Domain\Enum\Locale", "valuesAsArray"}, message="user.invalid_locale") - */ + #[Assert\Choice(callback: [Locale::class, 'valuesAsArray'], message: 'user.invalid_locale')] public function getLocale(): string { return parent::getLocale(); } - /** - * @Assert\Choice(callback={"App\Domain\Enum\Role", "valuesAsArray"}, message="user.invalid_role") - */ + #[Assert\Choice(callback: [Role::class, 'valuesAsArray'], message: 'user.invalid_role')] public function getRole(): string { return parent::getRole(); diff --git a/src/api/src/Domain/Storage/PrivateStorage.php b/src/api/src/Domain/Storage/PrivateStorage.php index 8272b39f..879f387e 100644 --- a/src/api/src/Domain/Storage/PrivateStorage.php +++ b/src/api/src/Domain/Storage/PrivateStorage.php @@ -13,7 +13,7 @@ abstract class PrivateStorage extends Storage public function __construct( ParameterBagInterface $parameters, ValidatorInterface $validator, - FilesystemOperator $privateStorage + FilesystemOperator $privateStorage, ) { parent::__construct($parameters, $validator, $privateStorage); } diff --git a/src/api/src/Domain/Storage/PublicStorage.php b/src/api/src/Domain/Storage/PublicStorage.php index 9cfb41bb..55e7ab3f 100644 --- a/src/api/src/Domain/Storage/PublicStorage.php +++ b/src/api/src/Domain/Storage/PublicStorage.php @@ -13,7 +13,7 @@ abstract class PublicStorage extends Storage public function __construct( ParameterBagInterface $parameters, ValidatorInterface $validator, - FilesystemOperator $publicStorage + FilesystemOperator $publicStorage, ) { parent::__construct(parameters: $parameters, validator: $validator, storage: $publicStorage); } diff --git a/src/api/src/Domain/Storage/Storage.php b/src/api/src/Domain/Storage/Storage.php index 531925d8..a23b62fb 100644 --- a/src/api/src/Domain/Storage/Storage.php +++ b/src/api/src/Domain/Storage/Storage.php @@ -13,18 +13,11 @@ abstract class Storage { - protected ParameterBagInterface $parameters; - protected ValidatorInterface $validator; - protected FilesystemOperator $storage; - public function __construct( - ParameterBagInterface $parameters, - ValidatorInterface $validator, - FilesystemOperator $storage + protected ParameterBagInterface $parameters, + protected ValidatorInterface $validator, + protected FilesystemOperator $storage, ) { - $this->parameters = $parameters; - $this->validator = $validator; - $this->storage = $storage; } abstract protected function getDirectoryName(): string; diff --git a/src/api/src/Infrastructure/Command/DevFixturesCommand.php b/src/api/src/Infrastructure/Command/DevFixturesCommand.php index 8a3578ce..85d99070 100644 --- a/src/api/src/Infrastructure/Command/DevFixturesCommand.php +++ b/src/api/src/Infrastructure/Command/DevFixturesCommand.php @@ -14,16 +14,10 @@ final class DevFixturesCommand extends Command { - private KernelInterface $kernel; - private AppFixtures $fixtures; - public function __construct( - KernelInterface $kernel, - AppFixtures $fixtures + private KernelInterface $kernel, + private AppFixtures $fixtures ) { - $this->kernel = $kernel; - $this->fixtures = $fixtures; - parent::__construct('app:fixtures:dev'); } diff --git a/src/api/src/Infrastructure/Command/InitializeS3StorageCommand.php b/src/api/src/Infrastructure/Command/InitializeS3StorageCommand.php index 9147ef69..387e9a0a 100644 --- a/src/api/src/Infrastructure/Command/InitializeS3StorageCommand.php +++ b/src/api/src/Infrastructure/Command/InitializeS3StorageCommand.php @@ -15,25 +15,13 @@ final class InitializeS3StorageCommand extends Command { - private S3MultiRegionClient $client; - private string $publicBucket; - private string $privateBucket; - private string $publicSource; - private string $privateSource; - public function __construct( - S3MultiRegionClient $s3Client, - string $publicBucket, - string $privateBucket, - string $publicSource, - string $privateSource + private S3MultiRegionClient $client, + private string $publicBucket, + private string $privateBucket, + private string $publicSource, + private string $privateSource ) { - $this->client = $s3Client; - $this->publicBucket = $publicBucket; - $this->privateBucket = $privateBucket; - $this->publicSource = $publicSource; - $this->privateSource = $privateSource; - parent::__construct('app:init-storage:s3'); } @@ -46,15 +34,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $createPublicBucket = new CreatePublicBucket($this->client); if (! $createPublicBucket->create($this->publicBucket)) { $output->writeln( - 'Bucket "' . - $this->publicBucket . - '" already exists' + 'Bucket "' . $this->publicBucket . '" already exists' ); } else { $output->writeln( - 'Bucket "' . - $this->publicBucket . - '" created' + 'Bucket "' . $this->publicBucket . '" created' ); } diff --git a/src/api/src/Infrastructure/Controller/User/UserProfilePictureController.php b/src/api/src/Infrastructure/Controller/User/UserProfilePictureController.php index af2ca207..45521c50 100644 --- a/src/api/src/Infrastructure/Controller/User/UserProfilePictureController.php +++ b/src/api/src/Infrastructure/Controller/User/UserProfilePictureController.php @@ -13,11 +13,9 @@ #[Route(path: '/users')] final class UserProfilePictureController extends DownloadController { - private ProfilePictureStorage $profilePictureStorage; - - public function __construct(ProfilePictureStorage $profilePictureStorage) - { - $this->profilePictureStorage = $profilePictureStorage; + public function __construct( + private ProfilePictureStorage $profilePictureStorage, + ) { } #[Route(path: '/profile-picture/{filename}', methods: ['GET'])] diff --git a/src/api/src/Infrastructure/Controller/User/UsersXLSXExportController.php b/src/api/src/Infrastructure/Controller/User/UsersXLSXExportController.php index 5a27e811..c684c45d 100644 --- a/src/api/src/Infrastructure/Controller/User/UsersXLSXExportController.php +++ b/src/api/src/Infrastructure/Controller/User/UsersXLSXExportController.php @@ -20,13 +20,10 @@ final class UsersXLSXExportController extends DownloadXLSXController { - private GetUsers $getUsers; - private CreateUsersXLSXExport $createUsersXLSXExport; - - public function __construct(GetUsers $getUsers, CreateUsersXLSXExport $createUsersXLSXExport) - { - $this->getUsers = $getUsers; - $this->createUsersXLSXExport = $createUsersXLSXExport; + public function __construct( + private GetUsers $getUsers, + private CreateUsersXLSXExport $createUsersXLSXExport, + ) { } #[Route(path: '/users/xlsx', methods: ['GET'])] diff --git a/src/api/src/Infrastructure/EventSubscriber/LocaleSubscriber.php b/src/api/src/Infrastructure/EventSubscriber/LocaleSubscriber.php index 5a93f8b7..ebafeb5d 100644 --- a/src/api/src/Infrastructure/EventSubscriber/LocaleSubscriber.php +++ b/src/api/src/Infrastructure/EventSubscriber/LocaleSubscriber.php @@ -12,11 +12,9 @@ final class LocaleSubscriber implements EventSubscriberInterface { - private string $defaultLocale; - - public function __construct(string $defaultLocale) - { - $this->defaultLocale = $defaultLocale; + public function __construct( + private string $defaultLocale, + ) { } public function onKernelRequest(RequestEvent $event): void diff --git a/src/api/src/Infrastructure/Fixtures/AppFixtures.php b/src/api/src/Infrastructure/Fixtures/AppFixtures.php index 588a76dd..39947b09 100644 --- a/src/api/src/Infrastructure/Fixtures/AppFixtures.php +++ b/src/api/src/Infrastructure/Fixtures/AppFixtures.php @@ -13,16 +13,10 @@ final class AppFixtures extends Fixtures { - private UserDao $userDao; - private DeleteUser $deleteUser; - public function __construct( - UserDao $userDao, - DeleteUser $deleteUser + private UserDao $userDao, + private DeleteUser $deleteUser ) { - $this->userDao = $userDao; - $this->deleteUser = $deleteUser; - parent::__construct(); } diff --git a/src/api/src/Infrastructure/S3/CreateBucket.php b/src/api/src/Infrastructure/S3/CreateBucket.php index e99c1fa3..88986eb5 100644 --- a/src/api/src/Infrastructure/S3/CreateBucket.php +++ b/src/api/src/Infrastructure/S3/CreateBucket.php @@ -10,11 +10,9 @@ class CreateBucket { - protected S3MultiRegionClient $client; - - public function __construct(S3MultiRegionClient $client) - { - $this->client = $client; + public function __construct( + protected S3MultiRegionClient $client, + ) { } public function create(string $bucketName): bool diff --git a/src/api/src/Infrastructure/Security/UserProvider.php b/src/api/src/Infrastructure/Security/UserProvider.php index 645c2d56..31bff909 100644 --- a/src/api/src/Infrastructure/Security/UserProvider.php +++ b/src/api/src/Infrastructure/Security/UserProvider.php @@ -16,11 +16,9 @@ final class UserProvider implements UserProviderInterface { - private UserDao $userDao; - - public function __construct(UserDao $userDao) - { - $this->userDao = $userDao; + public function __construct( + private UserDao $userDao, + ) { } public function loadUserByUsername(string $username): UserInterface diff --git a/src/api/src/Infrastructure/Security/Voter/AppVoter.php b/src/api/src/Infrastructure/Security/Voter/AppVoter.php index 06b6be2e..346dcc1b 100644 --- a/src/api/src/Infrastructure/Security/Voter/AppVoter.php +++ b/src/api/src/Infrastructure/Security/Voter/AppVoter.php @@ -9,10 +9,8 @@ abstract class AppVoter extends Voter { - protected Security $security; - - public function __construct(Security $security) - { - $this->security = $security; + public function __construct( + protected Security $security, + ) { } } diff --git a/src/api/src/Infrastructure/Security/Voter/UserVoter.php b/src/api/src/Infrastructure/Security/Voter/UserVoter.php index b2cab17d..fccb69c1 100644 --- a/src/api/src/Infrastructure/Security/Voter/UserVoter.php +++ b/src/api/src/Infrastructure/Security/Voter/UserVoter.php @@ -14,7 +14,13 @@ final class UserVoter extends AppVoter { + /** + * @var string + */ public const GET_USER = 'GET_USER'; + /** + * @var string + */ public const DELETE_USER = 'DELETE_USER'; protected function supports(string $attribute, mixed $subject): bool diff --git a/src/api/src/UseCase/CreateEmail.php b/src/api/src/UseCase/CreateEmail.php index 28bce930..ec05f1a7 100644 --- a/src/api/src/UseCase/CreateEmail.php +++ b/src/api/src/UseCase/CreateEmail.php @@ -11,21 +11,12 @@ abstract class CreateEmail { - private TranslatorInterface $translator; - private string $mailTitle; - private string $mailFromAddress; - private string $mailFromName; - public function __construct( - TranslatorInterface $translator, - string $mailTitle, - string $mailFromAddress, - string $mailFromName + private TranslatorInterface $translator, + private string $mailTitle, + private string $mailFromAddress, + private string $mailFromName, ) { - $this->translator = $translator; - $this->mailTitle = $mailTitle; - $this->mailFromAddress = $mailFromAddress; - $this->mailFromName = $mailFromName; } /** diff --git a/src/api/src/UseCase/CreateXLSXExport.php b/src/api/src/UseCase/CreateXLSXExport.php index 41a1ec20..ab630465 100644 --- a/src/api/src/UseCase/CreateXLSXExport.php +++ b/src/api/src/UseCase/CreateXLSXExport.php @@ -12,12 +12,9 @@ abstract class CreateXLSXExport { - protected TranslatorInterface $translator; - public function __construct( - TranslatorInterface $translator + protected TranslatorInterface $translator, ) { - $this->translator = $translator; } /** diff --git a/src/api/src/UseCase/User/CreateUser.php b/src/api/src/UseCase/User/CreateUser.php index 0bc071d8..2f7a45d1 100644 --- a/src/api/src/UseCase/User/CreateUser.php +++ b/src/api/src/UseCase/User/CreateUser.php @@ -19,18 +19,11 @@ final class CreateUser { - private UserDao $userDao; - private UpdateProfilePicture $updateProfilePicture; - private ResetPassword $resetPassword; - public function __construct( - UserDao $userDao, - UpdateProfilePicture $updateProfilePicture, - ResetPassword $resetPassword + private UserDao $userDao, + private UpdateProfilePicture $updateProfilePicture, + private ResetPassword $resetPassword, ) { - $this->userDao = $userDao; - $this->updateProfilePicture = $updateProfilePicture; - $this->resetPassword = $resetPassword; } /** diff --git a/src/api/src/UseCase/User/DeleteUser.php b/src/api/src/UseCase/User/DeleteUser.php index 4b4e446a..cff74fab 100644 --- a/src/api/src/UseCase/User/DeleteUser.php +++ b/src/api/src/UseCase/User/DeleteUser.php @@ -13,15 +13,10 @@ final class DeleteUser { - private UserDao $userDao; - private ProfilePictureStorage $profilePictureStorage; - public function __construct( - UserDao $userDao, - ProfilePictureStorage $profilePictureStorage + private UserDao $userDao, + private ProfilePictureStorage $profilePictureStorage, ) { - $this->userDao = $userDao; - $this->profilePictureStorage = $profilePictureStorage; } #[Mutation] diff --git a/src/api/src/UseCase/User/GetUsers.php b/src/api/src/UseCase/User/GetUsers.php index 25079728..b3430cc1 100644 --- a/src/api/src/UseCase/User/GetUsers.php +++ b/src/api/src/UseCase/User/GetUsers.php @@ -16,11 +16,9 @@ final class GetUsers { - private UserDao $userDao; - - public function __construct(UserDao $userDao) - { - $this->userDao = $userDao; + public function __construct( + private UserDao $userDao, + ) { } /** diff --git a/src/api/src/UseCase/User/ResetPassword/CreateResetPasswordEmail.php b/src/api/src/UseCase/User/ResetPassword/CreateResetPasswordEmail.php index 62a0ae9a..b83b2859 100644 --- a/src/api/src/UseCase/User/ResetPassword/CreateResetPasswordEmail.php +++ b/src/api/src/UseCase/User/ResetPassword/CreateResetPasswordEmail.php @@ -14,20 +14,15 @@ final class CreateResetPasswordEmail extends CreateEmail { - private string $mailWebappURL; - private string $mailWebappUpdatePasswordRouteFormat; - public function __construct( TranslatorInterface $translator, string $mailTitle, string $mailFromAddress, string $mailFromName, - string $mailWebappURL, - string $mailWebappUpdatePasswordRouteFormat + private string $mailWebappURL, + private string $mailWebappUpdatePasswordRouteFormat ) { parent::__construct($translator, $mailTitle, $mailFromAddress, $mailFromName); - $this->mailWebappURL = $mailWebappURL; - $this->mailWebappUpdatePasswordRouteFormat = $mailWebappUpdatePasswordRouteFormat; } public function createEmail( diff --git a/src/api/src/UseCase/User/ResetPassword/ResetPassword.php b/src/api/src/UseCase/User/ResetPassword/ResetPassword.php index de369331..64c7fcd9 100644 --- a/src/api/src/UseCase/User/ResetPassword/ResetPassword.php +++ b/src/api/src/UseCase/User/ResetPassword/ResetPassword.php @@ -17,21 +17,12 @@ final class ResetPassword { - private UserDao $userDao; - private ResetPasswordTokenDao $resetPasswordTokenDao; - private CreateResetPasswordEmail $createResetPasswordEmail; - private MailerInterface $mailer; - public function __construct( - UserDao $userDao, - ResetPasswordTokenDao $resetPasswordTokenDao, - CreateResetPasswordEmail $createResetPasswordEmail, - MailerInterface $mailer + private UserDao $userDao, + private ResetPasswordTokenDao $resetPasswordTokenDao, + private CreateResetPasswordEmail $createResetPasswordEmail, + private MailerInterface $mailer, ) { - $this->userDao = $userDao; - $this->resetPasswordTokenDao = $resetPasswordTokenDao; - $this->createResetPasswordEmail = $createResetPasswordEmail; - $this->mailer = $mailer; } /** diff --git a/src/api/src/UseCase/User/UpdateLocale.php b/src/api/src/UseCase/User/UpdateLocale.php index 52747765..b8432212 100644 --- a/src/api/src/UseCase/User/UpdateLocale.php +++ b/src/api/src/UseCase/User/UpdateLocale.php @@ -16,11 +16,9 @@ final class UpdateLocale { - private UserDao $userDao; - - public function __construct(UserDao $userDao) - { - $this->userDao = $userDao; + public function __construct( + private UserDao $userDao, + ) { } /** diff --git a/src/api/src/UseCase/User/UpdatePassword.php b/src/api/src/UseCase/User/UpdatePassword.php index ae2b5f1a..9b1a09fd 100644 --- a/src/api/src/UseCase/User/UpdatePassword.php +++ b/src/api/src/UseCase/User/UpdatePassword.php @@ -18,18 +18,11 @@ final class UpdatePassword { - private VerifyResetPasswordToken $verifyResetPasswordToken; - private ResetPasswordTokenDao $resetPasswordTokenDao; - private UserDao $userDao; - public function __construct( - VerifyResetPasswordToken $verifyResetPasswordToken, - ResetPasswordTokenDao $resetPasswordTokenDao, - UserDao $userDao + private VerifyResetPasswordToken $verifyResetPasswordToken, + private ResetPasswordTokenDao $resetPasswordTokenDao, + private UserDao $userDao, ) { - $this->verifyResetPasswordToken = $verifyResetPasswordToken; - $this->resetPasswordTokenDao = $resetPasswordTokenDao; - $this->userDao = $userDao; } /** diff --git a/src/api/src/UseCase/User/UpdateProfilePicture.php b/src/api/src/UseCase/User/UpdateProfilePicture.php index bff938fe..e6de4532 100644 --- a/src/api/src/UseCase/User/UpdateProfilePicture.php +++ b/src/api/src/UseCase/User/UpdateProfilePicture.php @@ -17,15 +17,10 @@ final class UpdateProfilePicture { - private UserDao $userDao; - private ProfilePictureStorage $profilePictureStorage; - public function __construct( - UserDao $userDao, - ProfilePictureStorage $profilePictureStorage + private UserDao $userDao, + private ProfilePictureStorage $profilePictureStorage, ) { - $this->userDao = $userDao; - $this->profilePictureStorage = $profilePictureStorage; } /** diff --git a/src/api/src/UseCase/User/UpdateUser.php b/src/api/src/UseCase/User/UpdateUser.php index fcff318b..060e1850 100644 --- a/src/api/src/UseCase/User/UpdateUser.php +++ b/src/api/src/UseCase/User/UpdateUser.php @@ -20,15 +20,10 @@ final class UpdateUser { - private UserDao $userDao; - private UpdateProfilePicture $updateProfilePicture; - public function __construct( - UserDao $userDao, - UpdateProfilePicture $updateProfilePicture + private UserDao $userDao, + private UpdateProfilePicture $updateProfilePicture, ) { - $this->userDao = $userDao; - $this->updateProfilePicture = $updateProfilePicture; } /** diff --git a/src/api/src/UseCase/User/VerifyResetPasswordToken/VerifyResetPasswordToken.php b/src/api/src/UseCase/User/VerifyResetPasswordToken/VerifyResetPasswordToken.php index 0554ea84..b93104dc 100644 --- a/src/api/src/UseCase/User/VerifyResetPasswordToken/VerifyResetPasswordToken.php +++ b/src/api/src/UseCase/User/VerifyResetPasswordToken/VerifyResetPasswordToken.php @@ -13,11 +13,9 @@ final class VerifyResetPasswordToken { - private ResetPasswordTokenDao $resetPasswordTokenDao; - - public function __construct(ResetPasswordTokenDao $resetPasswordTokenDao) - { - $this->resetPasswordTokenDao = $resetPasswordTokenDao; + public function __construct( + private ResetPasswordTokenDao $resetPasswordTokenDao, + ) { } /** diff --git a/src/api/symfony.lock b/src/api/symfony.lock index e8b7b875..6fdcddaa 100644 --- a/src/api/symfony.lock +++ b/src/api/symfony.lock @@ -384,6 +384,9 @@ "ramsey/uuid": { "version": "4.2.3" }, + "rector/rector": { + "version": "0.14.4" + }, "sebastian/cli-parser": { "version": "1.0.1" }, From 531a55648ab7ad498d45cc07c6ba6cba6412994a Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Fri, 30 Sep 2022 10:24:47 +0200 Subject: [PATCH 3/5] Add Makefile cmd for top/ps --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 436c46b6..2fe88d61 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,14 @@ include .env up: .env ## Start the Docker Compose stack. docker-compose up -d +ps: .env ## Status of running containers + docker-compose ps + +top-lazy: .env ## Use lazy docker to show a docker compose interface + @if ! type lazydocker > /dev/null 2>&1; then \ + curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash; \ + fi + lazydocker down: ## Stop the Docker Compose stack. docker-compose down From ac49d8661c22ef5b38fc5436ee1e2c483139b02d Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Fri, 30 Sep 2022 10:36:53 +0200 Subject: [PATCH 4/5] Version idea with fine tuning --- .idea/.gitignore | 11 +++ .idea/.name | 1 + .idea/Symfony Boilerplate.iml | 15 ++++ .idea/codeStyles/Project.xml | 74 +++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 ++ .idea/modules.xml | 8 ++ .idea/php-test-framework.xml | 15 ++++ .idea/php.xml | 117 +++++++++++++++++++++++++++ .idea/scopes/API.xml | 3 + .idea/scopes/CI_Stack.xml | 3 + .idea/scopes/Docs.xml | 3 + .idea/scopes/WEBAPP.xml | 3 + .idea/symfony2.xml | 9 +++ .idea/vcs.xml | 6 ++ 14 files changed, 273 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/Symfony Boilerplate.iml create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php-test-framework.xml create mode 100644 .idea/php.xml create mode 100644 .idea/scopes/API.xml create mode 100644 .idea/scopes/CI_Stack.xml create mode 100644 .idea/scopes/Docs.xml create mode 100644 .idea/scopes/WEBAPP.xml create mode 100644 .idea/symfony2.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..2531ab82 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,11 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Dictionaries +/dictionaries/ +/GitLink.xml \ No newline at end of file diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..0846b2a7 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Symfony Boilerplate \ No newline at end of file diff --git a/.idea/Symfony Boilerplate.iml b/.idea/Symfony Boilerplate.iml new file mode 100644 index 00000000..52aa1350 --- /dev/null +++ b/.idea/Symfony Boilerplate.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..67bdaa21 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,74 @@ + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..8053b295 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml new file mode 100644 index 00000000..ea3c7576 --- /dev/null +++ b/.idea/php-test-framework.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000..b7fb2c22 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + /etc/php/8.0/cli/conf.d/10-mysqlnd.ini, /etc/php/8.0/cli/conf.d/10-opcache.ini, /etc/php/8.0/cli/conf.d/10-pdo.ini, /etc/php/8.0/cli/conf.d/15-xml.ini, /etc/php/8.0/cli/conf.d/20-apcu.ini, /etc/php/8.0/cli/conf.d/20-calendar.ini, /etc/php/8.0/cli/conf.d/20-ctype.ini, /etc/php/8.0/cli/conf.d/20-curl.ini, /etc/php/8.0/cli/conf.d/20-dom.ini, /etc/php/8.0/cli/conf.d/20-exif.ini, /etc/php/8.0/cli/conf.d/20-fileinfo.ini, /etc/php/8.0/cli/conf.d/20-ftp.ini, /etc/php/8.0/cli/conf.d/20-gd.ini, /etc/php/8.0/cli/conf.d/20-gettext.ini, /etc/php/8.0/cli/conf.d/20-iconv.ini, /etc/php/8.0/cli/conf.d/20-igbinary.ini, /etc/php/8.0/cli/conf.d/20-intl.ini, /etc/php/8.0/cli/conf.d/20-mbstring.ini, /etc/php/8.0/cli/conf.d/20-mysqli.ini, /etc/php/8.0/cli/conf.d/20-pdo_mysql.ini, /etc/php/8.0/cli/conf.d/20-phar.ini, /etc/php/8.0/cli/conf.d/20-posix.ini, /etc/php/8.0/cli/conf.d/20-readline.ini, /etc/php/8.0/cli/conf.d/20-redis.ini, /etc/php/8.0/cli/conf.d/20-shmop.ini, /etc/php/8.0/cli/conf.d/20-simplexml.ini, /etc/php/8.0/cli/conf.d/20-soap.ini, /etc/php/8.0/cli/conf.d/20-sockets.ini, /etc/php/8.0/cli/conf.d/20-sysvmsg.ini, /etc/php/8.0/cli/conf.d/20-sysvsem.ini, /etc/php/8.0/cli/conf.d/20-sysvshm.ini, /etc/php/8.0/cli/conf.d/20-tokenizer.ini, /etc/php/8.0/cli/conf.d/20-xdebug.ini, /etc/php/8.0/cli/conf.d/20-xmlreader.ini, /etc/php/8.0/cli/conf.d/20-xmlwriter.ini, /etc/php/8.0/cli/conf.d/20-xsl.ini, /etc/php/8.0/cli/conf.d/20-zip.ini, /etc/php/8.0/cli/conf.d/generated_conf.ini + /etc/php/8.0/cli/php.ini + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/API.xml b/.idea/scopes/API.xml new file mode 100644 index 00000000..f92be096 --- /dev/null +++ b/.idea/scopes/API.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/CI_Stack.xml b/.idea/scopes/CI_Stack.xml new file mode 100644 index 00000000..82864dbc --- /dev/null +++ b/.idea/scopes/CI_Stack.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/Docs.xml b/.idea/scopes/Docs.xml new file mode 100644 index 00000000..f27a674c --- /dev/null +++ b/.idea/scopes/Docs.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/WEBAPP.xml b/.idea/scopes/WEBAPP.xml new file mode 100644 index 00000000..18f8e34c --- /dev/null +++ b/.idea/scopes/WEBAPP.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/symfony2.xml b/.idea/symfony2.xml new file mode 100644 index 00000000..e6bc3ec4 --- /dev/null +++ b/.idea/symfony2.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 1e2d20eba411b7d669750001cf62dd5d34e1cba2 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Fri, 30 Sep 2022 10:37:21 +0200 Subject: [PATCH 5/5] Version xDebug configuration (with helper) --- .idea/runConfigurations/XDebug.xml | 7 +++++++ .idea/runConfigurations/Xdebug_helper.xml | 10 ++++++++++ Makefile | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .idea/runConfigurations/XDebug.xml create mode 100644 .idea/runConfigurations/Xdebug_helper.xml diff --git a/.idea/runConfigurations/XDebug.xml b/.idea/runConfigurations/XDebug.xml new file mode 100644 index 00000000..54806db3 --- /dev/null +++ b/.idea/runConfigurations/XDebug.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Xdebug_helper.xml b/.idea/runConfigurations/Xdebug_helper.xml new file mode 100644 index 00000000..94271738 --- /dev/null +++ b/.idea/runConfigurations/Xdebug_helper.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Makefile b/Makefile index 2fe88d61..21075553 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,24 @@ lint-webapp: ## Launch linter in webapp docker-compose exec webapp yarn lint:fix docker-compose exec webapp yarn lint +.PHONY: xdebug-start +xdebug-start: up ## Activate x-debug + @if ! (docker-compose exec -T api php -m | grep -qi xdebug); then \ + echo "php-xdebug is not activated"; \ + echo "Ensure env \`PHP_EXTENSION_XDEBUG=1\`"; \ + exit 1; \ + fi; + @if [ "$(FROM_PHPSTORM)" != "1" ]; then echo "From phpstorm type MAJ+F9"; fi + @echo "- For browser debug" + @echo " - To Enable go onto this url from your browser (do not forget to place yours breakpoints)" + @echo " http://$(API_SUBDOMAIN).$(DOMAIN)/ping?XDEBUG_SESSION_START=1" + @echo " - To Disable go onto this url from your browser (or just stop listen from phpstorm)" + @echo " http://$(API_SUBDOMAIN).$(DOMAIN)/ping?XDEBUG_SESSION_STOP=1" + @echo " - Disable Server Side Rendering if required (on you .env, change to \`NUXT_SSR=0\`)" + @echo "- For cli debug : " + @echo " - type on api container : \`XDEBUG_SESSION=1 php ./my-script.php\`" + @echo " - type on api container : \`XDEBUG_SESSION=1 ./bin/console app:my-script\`" + .PHONY: help help: ## This help. @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)