Skip to content

Commit 23b541e

Browse files
author
DKravtsov
committed
Updated dependencies, refactoring.
1 parent 46ce1b8 commit 23b541e

File tree

107 files changed

+1062
-1578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1062
-1578
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ ifeq ($(INSIDE_DOCKER_CONTAINER), 1)
356356
@echo "\033[32mRunning PHPStan - PHP Static Analysis Tool\033[39m"
357357
@bin/console cache:clear --env=test
358358
@./vendor/bin/phpstan --version
359-
@./vendor/bin/phpstan analyze src tests --xdebug
359+
@./vendor/bin/phpstan analyze src tests
360360
else
361361
@make exec cmd="make phpstan"
362362
endif

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"Elasticsearch"
1515
],
1616
"homepage": "https://github.com/systemsdk/docker-symfony-api",
17-
"version": "v1.4.5",
17+
"version": "v1.4.6",
1818
"license": "MIT",
1919
"authors": [
2020
{
@@ -41,7 +41,6 @@
4141
"ext-pdo": "*",
4242
"ext-pdo_mysql": "*",
4343
"beberlei/doctrineextensions": "^1.3",
44-
"doctrine/annotations": "^1.14",
4544
"doctrine/doctrine-bundle": "^2.9",
4645
"doctrine/doctrine-migrations-bundle": "^3.2",
4746
"doctrine/orm": "^2.14",

composer.lock

Lines changed: 283 additions & 280 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/services.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ services:
4949
- '../src/DependencyInjection/'
5050
- '../src/*/Domain/Entity/'
5151
- '../src/*/Transport/EventListener/'
52-
- '../src/General/Application/Utils/Tests/'
5352
- '../src/Kernel.php'
5453

5554
# controllers are imported separately to make sure services can be injected
@@ -84,19 +83,19 @@ when@dev:
8483
autoconfigure: true
8584

8685
App\ApiKey\Infrastructure\DataFixtures\:
87-
resource: '../src/ApiKey/Infrastructure/DataFixtures/'
86+
resource: '../src/ApiKey/Infrastructure/DataFixtures/*'
8887

8988
App\Role\Infrastructure\DataFixtures\:
90-
resource: '../src/Role/Infrastructure/DataFixtures/'
89+
resource: '../src/Role/Infrastructure/DataFixtures/*'
9190

9291
App\User\Infrastructure\DataFixtures\:
93-
resource: '../src/User/Infrastructure/DataFixtures/'
92+
resource: '../src/User/Infrastructure/DataFixtures/*'
9493

95-
App\General\Transport\Utils\Tests\:
96-
resource: '../src/General/Transport/Utils/Tests'
94+
App\Tests\TestCase\:
95+
resource: '../tests/TestCase/*'
9796

98-
App\General\Application\Utils\Tests\:
99-
resource: '../src/General/Application/Utils/Tests'
97+
App\Tests\Utils\:
98+
resource: '../tests/Utils/*'
10099

101100
ProxyManager\Factory\AccessInterceptorValueHolderFactory:
102101
class: ProxyManager\Factory\AccessInterceptorValueHolderFactory
@@ -121,16 +120,16 @@ when@test:
121120
public: true
122121

123122
App\ApiKey\Infrastructure\DataFixtures\:
124-
resource: '../src/ApiKey/Infrastructure/DataFixtures/'
123+
resource: '../src/ApiKey/Infrastructure/DataFixtures/*'
125124

126125
App\Role\Infrastructure\DataFixtures\:
127-
resource: '../src/Role/Infrastructure/DataFixtures/'
126+
resource: '../src/Role/Infrastructure/DataFixtures/*'
128127

129128
App\User\Infrastructure\DataFixtures\:
130-
resource: '../src/User/Infrastructure/DataFixtures/'
129+
resource: '../src/User/Infrastructure/DataFixtures/*'
131130

132-
App\General\Transport\Utils\Tests\:
133-
resource: '../src/General/Transport/Utils/Tests'
131+
App\Tests\TestCase\:
132+
resource: '../tests/TestCase/*'
134133

135-
App\General\Application\Utils\Tests\:
136-
resource: '../src/General/Application/Utils/Tests'
134+
App\Tests\Utils\:
135+
resource: '../tests/Utils/*'

phpunit.xml.dist

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="tools/01_phpunit/vendor/phpunit/phpunit/phpunit.xsd"
55
backupGlobals="false"
66
bootstrap="tests/bootstrap.php"
77
colors="true"
88
testdox="true"
99
beStrictAboutTestsThatDoNotTestAnything="true"
1010
beStrictAboutOutputDuringTests="true"
1111
processIsolation="false"
12+
stopOnError="true"
1213
stopOnFailure="false"
14+
stopOnDefect="false"
1315
displayDetailsOnTestsThatTriggerDeprecations="true"
1416
displayDetailsOnTestsThatTriggerNotices="true"
1517
displayDetailsOnTestsThatTriggerWarnings="true"
1618
displayDetailsOnTestsThatTriggerErrors="true"
1719
cacheDirectory=".phpunit.cache"
1820
>
19-
<coverage>
21+
<coverage/>
22+
<source>
2023
<include>
2124
<directory suffix=".php">./src</directory>
2225
</include>
@@ -33,7 +36,7 @@
3336
<directory>./src/User/Infrastructure/DataFixtures</directory>
3437
<file>./src/Kernel.php</file>
3538
</exclude>
36-
</coverage>
39+
</source>
3740
<php>
3841
<ini name="error_reporting" value="-1" />
3942
<ini name="display_errors" value="On" />

src/ApiKey/Application/Security/ApiKeyUser.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use App\Role\Domain\Enum\Role;
1010
use Symfony\Component\Security\Core\User\UserInterface;
1111

12-
use function array_merge;
1312
use function array_unique;
1413

1514
/**
@@ -19,13 +18,13 @@
1918
*/
2019
class ApiKeyUser implements ApiKeyUserInterface, UserInterface
2120
{
22-
private string $identifier;
23-
private string $apiKeyIdentifier;
21+
private readonly string $identifier;
22+
private readonly string $apiKeyIdentifier;
2423

2524
/**
2625
* @var array<int, string>
2726
*/
28-
private array $roles;
27+
private readonly array $roles;
2928

3029
/**
3130
* {@inheritdoc}
@@ -34,7 +33,7 @@ public function __construct(ApiKey $apiKey, array $roles)
3433
{
3534
$this->identifier = $apiKey->getToken();
3635
$this->apiKeyIdentifier = $apiKey->getId();
37-
$this->roles = array_unique(array_merge($roles, [Role::API->value]));
36+
$this->roles = array_unique([...$roles, Role::API->value]);
3837
}
3938

4039
public function getUserIdentifier(): string

src/ApiKey/Domain/Entity/ApiKey.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use Throwable;
2727

2828
use function array_map;
29-
use function array_merge;
3029
use function array_unique;
3130
use function array_values;
3231

@@ -204,12 +203,12 @@ public function getRoles(): array
204203
array_map(
205204
'\strval',
206205
array_unique(
207-
array_merge(
208-
[RoleEnum::API->value],
209-
$this->userGroups
206+
[
207+
RoleEnum::API->value,
208+
...$this->userGroups
210209
->map(static fn (UserGroup $userGroup): string => $userGroup->getRole()->getId())
211210
->toArray(),
212-
),
211+
],
213212
),
214213
),
215214
);

src/ApiKey/Infrastructure/DataFixtures/ORM/LoadApiKeyData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace App\ApiKey\Infrastructure\DataFixtures\ORM;
66

77
use App\ApiKey\Domain\Entity\ApiKey;
8-
use App\General\Application\Utils\Tests\PhpUnitUtil;
98
use App\General\Domain\Rest\UuidHelper;
109
use App\Role\Application\Security\Interfaces\RolesServiceInterface;
10+
use App\Tests\Utils\PhpUnitUtil;
1111
use App\User\Domain\Entity\UserGroup;
1212
use Doctrine\Bundle\FixturesBundle\Fixture;
1313
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;

src/ApiKey/Transport/Command/ApiKey/ChangeTokenCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ChangeTokenCommand extends Command
2727
{
2828
use SymfonyStyleTrait;
2929

30-
public const NAME = 'api-key:change-token';
30+
final public const NAME = 'api-key:change-token';
3131

3232
/**
3333
* Constructor

src/ApiKey/Transport/Command/ApiKey/CreateApiKeyCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CreateApiKeyCommand extends Command
3838
use ApiKeyUserManagementHelperTrait;
3939
use SymfonyStyleTrait;
4040

41-
public const NAME = 'api-key:create';
41+
final public const NAME = 'api-key:create';
4242

4343
/**
4444
* @var array<int, array<string, string>>

src/ApiKey/Transport/Command/ApiKey/EditApiKeyCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EditApiKeyCommand extends Command
3030
{
3131
use SymfonyStyleTrait;
3232

33-
public const NAME = 'api-key:edit';
33+
final public const NAME = 'api-key:edit';
3434

3535
/**
3636
* Constructor

src/ApiKey/Transport/Command/ApiKey/ListApiKeysCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)]
3333
class ListApiKeysCommand extends Command
3434
{
35-
public const NAME = 'api-key:list';
35+
final public const NAME = 'api-key:list';
3636

3737
/**
3838
* Constructor

src/ApiKey/Transport/Command/ApiKey/RemoveApiKeyCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RemoveApiKeyCommand extends Command
2727
{
2828
use SymfonyStyleTrait;
2929

30-
public const NAME = 'api-key:remove';
30+
final public const NAME = 'api-key:remove';
3131

3232
/**
3333
* Constructor

src/General/Application/Validator/Constraints/EntityReferenceExists.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
2424
class EntityReferenceExists extends Constraint
2525
{
26-
public const ENTITY_REFERENCE_EXISTS_ERROR = '64888b5e-bded-449b-82ed-0cc1f73df14d';
27-
public const MESSAGE_SINGLE = 'Invalid id value "{{ id }}" given for entity "{{ entity }}".';
28-
public const MESSAGE_MULTIPLE = 'Invalid id values "{{ id }}" given for entity "{{ entity }}".';
26+
final public const ENTITY_REFERENCE_EXISTS_ERROR = '64888b5e-bded-449b-82ed-0cc1f73df14d';
27+
final public const MESSAGE_SINGLE = 'Invalid id value "{{ id }}" given for entity "{{ entity }}".';
28+
final public const MESSAGE_MULTIPLE = 'Invalid id values "{{ id }}" given for entity "{{ entity }}".';
2929

3030
/**
3131
* {@inheritdoc}

src/General/Domain/Doctrine/DBAL/Types/EnumLocaleType.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,15 @@
44

55
namespace App\General\Domain\Doctrine\DBAL\Types;
66

7+
use App\General\Domain\Enum\Locale;
8+
79
/**
810
* Class EnumLocaleType
911
*
1012
* @package App\General
1113
*/
12-
class EnumLocaleType extends EnumType
14+
class EnumLocaleType extends RealEnumType
1315
{
14-
public const LOCALE_EN = 'en';
15-
public const LOCALE_RU = 'ru';
16-
public const LOCALE_UA = 'ua';
17-
public const LOCALE_FI = 'fi';
18-
1916
protected static string $name = Types::ENUM_LOCALE;
20-
21-
/**
22-
* @var array<int, string>
23-
*/
24-
protected static array $values = [
25-
self::LOCALE_EN,
26-
self::LOCALE_RU,
27-
self::LOCALE_UA,
28-
self::LOCALE_FI,
29-
];
17+
protected static string $enum = Locale::class;
3018
}

src/General/Domain/Doctrine/DBAL/Types/EnumLogLoginType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
*/
1212
class EnumLogLoginType extends EnumType
1313
{
14-
public const TYPE_FAILURE = 'failure';
15-
public const TYPE_SUCCESS = 'success';
14+
final public const TYPE_FAILURE = 'failure';
15+
final public const TYPE_SUCCESS = 'success';
1616

1717
protected static string $name = Types::ENUM_LOG_LOGIN;
1818

src/General/Domain/Doctrine/DBAL/Types/Types.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class Types
1313
{
14-
public const ENUM_LANGUAGE = 'EnumLanguage';
15-
public const ENUM_LOCALE = 'EnumLocale';
16-
public const ENUM_LOG_LOGIN = 'EnumLogLogin';
14+
final public const ENUM_LANGUAGE = 'EnumLanguage';
15+
final public const ENUM_LOCALE = 'EnumLocale';
16+
final public const ENUM_LOG_LOGIN = 'EnumLogLogin';
1717
}

src/General/Domain/Doctrine/DBAL/Types/UTCDateTimeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class UTCDateTimeType extends DateTimeType
2222
{
23-
private static ?DateTimeZone $utc;
23+
private static ?DateTimeZone $utc = null;
2424

2525
/**
2626
* {@inheritdoc}

src/General/Domain/Enum/Language.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use App\General\Domain\Enum\Traits\GetValues;
99

1010
/**
11-
* Language Role
11+
* Language
1212
*
1313
* @package App\General
1414
*/

src/General/Domain/Enum/Locale.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\General\Domain\Enum;
6+
7+
use App\General\Domain\Enum\Interfaces\DatabaseEnumInterface;
8+
use App\General\Domain\Enum\Traits\GetValues;
9+
10+
/**
11+
* Locale
12+
*
13+
* @package App\General
14+
*/
15+
enum Locale: string implements DatabaseEnumInterface
16+
{
17+
use GetValues;
18+
19+
case EN = 'en';
20+
case RU = 'ru';
21+
case UA = 'ua';
22+
case FI = 'fi';
23+
24+
public static function getDefault(): self
25+
{
26+
return self::EN;
27+
}
28+
}

src/General/Domain/Utils/JSON.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ class JSON
2727
* JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT,
2828
* JSON_PRESERVE_ZERO_FRACTION, JSON_UNESCAPED_UNICODE, JSON_PARTIAL_OUTPUT_ON_ERROR.
2929
* The behaviour of these constants is described on the JSON constants page.
30-
* @param int|null $depth Set the maximum depth. Must be greater than zero.
31-
*
32-
* @phpstan-param int<1, max>|null $depth
30+
* @param int<1, 2147483647>|null $depth Set the maximum depth. Must be greater than zero.
3331
*
3432
* @throws JsonException
3533
*/
@@ -50,12 +48,10 @@ public static function encode(mixed $input, ?int $options = null, ?int $depth =
5048
*
5149
* @param string $json the json string being decoded
5250
* @param bool|null $assoc when TRUE, returned objects will be converted into associative arrays
53-
* @param int|null $depth user specified recursion depth
51+
* @param int<1, 2147483647>|null $depth Set the maximum depth. Must be greater than zero.
5452
* @param int|null $options Bitmask of JSON decode options. Currently only JSON_BIGINT_AS_STRING is supported
5553
* (default is to cast large integers as floats)
5654
*
57-
* @phpstan-param int<1, max>|null $depth
58-
*
5955
* @throws JsonException
6056
*/
6157
public static function decode(string $json, ?bool $assoc = null, ?int $depth = null, ?int $options = null): mixed

src/General/Infrastructure/Repository/BaseRepository.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
1515

1616
use function array_map;
17-
use function array_merge;
1817
use function array_unshift;
1918
use function implode;
2019
use function in_array;
@@ -172,7 +171,7 @@ public function addInnerJoin(array $parameters): self
172171
public function addCallback(callable $callable, ?array $args = null): self
173172
{
174173
$args ??= [];
175-
$hash = sha1(serialize(array_merge([spl_object_hash((object)$callable)], $args)));
174+
$hash = sha1(serialize([spl_object_hash((object)$callable), ...$args]));
176175

177176
if (!in_array($hash, self::$processedCallbacks, true)) {
178177
self::$callbacks[] = [$callable, $args];

0 commit comments

Comments
 (0)