Skip to content

Commit 14b5de4

Browse files
authored
Merge pull request #553 from samsonasik/use-structarmed-on-qa
Use StructArmed on QA
2 parents 3b5d001 + 09c5017 commit 14b5de4

15 files changed

Lines changed: 53 additions & 14 deletions

‎composer.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"zircote/swagger-php": "^6.0.0"
8484
},
8585
"require-dev": {
86+
"boundwize/structarmed": "^0.17.12",
8687
"dotkernel/dot-maker": "^2.0.0",
8788
"laminas/laminas-coding-standard": "^3.0.1",
8889
"laminas/laminas-development-mode": "^3.13.0",

‎src/App/src/Factory/ProblemDetailsDelegatorFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __invoke(
4141
$errorHandler = $container->get(ErrorHandlerInterface::class);
4242
assert($errorHandler instanceof LogErrorHandler);
4343

44-
$listener = function (Throwable $throwable, RequestInterface $request) use ($errorHandler) {
44+
$listener = static function (Throwable $throwable, RequestInterface $request) use ($errorHandler) {
4545
assert($request instanceof ServerRequestInterface);
4646
$errorHandler->handleThrowable($throwable, $request);
4747
};

‎src/App/src/Factory/UserIdentityFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class UserIdentityFactory
1212
{
1313
public function __invoke(ContainerInterface $container): callable
1414
{
15-
return function (string $identity, array $roles = [], array $details = []): UserInterface {
15+
return static function (string $identity, array $roles = [], array $details = []): UserInterface {
1616
/** @var non-empty-string $identity */
1717
return new UserIdentity($identity, $roles, $details);
1818
};

‎src/App/src/Middleware/AuthorizationMiddleware.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
7575
}
7676

7777
$defaultUser->setRoles(
78-
array_map(fn (RoleInterface $role): string => (string) $role->getName()->value, $user->getRoles())
78+
array_map(static fn (RoleInterface $role): string => (string) $role->getName()->value, $user->getRoles())
7979
);
8080

8181
$request = $request->withAttribute(UserInterface::class, $defaultUser);

‎src/App/src/Middleware/ContentNegotiationMiddleware.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private function parseAcceptHeader(string $header): array
128128
}
129129

130130
// Sort by quality in descending order
131-
usort($types, fn ($a, $b) => $b['quality'] <=> $a['quality']);
131+
usort($types, static fn ($a, $b) => $b['quality'] <=> $a['quality']);
132132

133133
return $types;
134134
}

‎src/App/src/Middleware/DeprecationMiddleware.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ private function getAttribute(array $attributes): ?array
8686
return array_values(
8787
array_filter(
8888
$attributes,
89-
fn (array $attribute): bool => $attribute['deprecationType'] === self::RESOURCE_DEPRECATION_ATTRIBUTE
89+
static fn (array $attribute): bool
90+
=> $attribute['deprecationType'] === self::RESOURCE_DEPRECATION_ATTRIBUTE
9091
)
9192
)[0] ?? null;
9293
}

‎src/Core/src/Admin/src/Entity/Admin.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ public function getArrayCopy(): array
241241
'firstName' => $this->firstName,
242242
'lastName' => $this->lastName,
243243
'status' => $this->status->value,
244-
'roles' => array_map(fn (RoleInterface $role): array => $role->getArrayCopy(), $this->roles->toArray()),
244+
'roles' => array_map(
245+
static fn (RoleInterface $role): array => $role->getArrayCopy(),
246+
$this->roles->toArray()
247+
),
245248
'created' => $this->created,
246249
'updated' => $this->updated,
247250
];

‎src/Core/src/Admin/src/Enum/AdminStatusEnum.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function values(): array
2525
*/
2626
public static function toArray(): array
2727
{
28-
return array_reduce(self::cases(), function (array $collector, self $enum): array {
28+
return array_reduce(self::cases(), static function (array $collector, self $enum): array {
2929
$collector[$enum->value] = $enum->name;
3030

3131
return $collector;

‎src/Core/src/App/src/DBAL/Types/AbstractEnumType.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st
2626
return 'TEXT';
2727
}
2828

29-
$values = array_map(fn($case) => "'$case->value'", $this->getEnumCases());
29+
$values = array_map(static fn($case) => "'$case->value'", $this->getEnumCases());
3030

3131
return sprintf('ENUM(%s)', implode(', ', $values));
3232
}

‎src/Core/src/User/src/Entity/User.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ public function getArrayCopy(): array
361361
'hash' => $this->hash,
362362
'identity' => $this->identity,
363363
'status' => $this->status->value,
364-
'roles' => array_map(fn (RoleInterface $role): array => $role->getArrayCopy(), $this->roles->toArray()),
364+
'roles' => array_map(
365+
static fn (RoleInterface $role): array => $role->getArrayCopy(),
366+
$this->roles->toArray()
367+
),
365368
'created' => $this->created,
366369
'updated' => $this->updated,
367370
];

0 commit comments

Comments
 (0)