Skip to content

Commit 41011d3

Browse files
authored
Merge pull request #549 from samsonasik/use-structarmed-on-qa
Use StructArmed on QA
2 parents 5fdb495 + ce5d1dd commit 41011d3

7 files changed

Lines changed: 32 additions & 10 deletions

File tree

‎composer.json‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,18 @@
7373
"roave/psr-container-doctrine": "^5.2.2"
7474
},
7575
"require-dev": {
76+
"boundwize/structarmed": "^0.19.4",
7677
"filp/whoops": "^2.15.4",
7778
"laminas/laminas-coding-standard": "^3.0",
7879
"laminas/laminas-development-mode": "^3.12.0",
7980
"mezzio/mezzio-tooling": "^2.9.0",
80-
"phpunit/phpunit": "^10.5",
81-
"roave/security-advisories": "dev-master",
82-
"vincentlanglet/twig-cs-fixer": "^2.12",
8381
"phpstan/phpstan": "^2.0",
8482
"phpstan/phpstan-doctrine": "^2.0",
8583
"phpstan/phpstan-phpunit": "^2.0",
86-
"symfony/var-dumper": "^7.1"
84+
"phpunit/phpunit": "^10.5",
85+
"roave/security-advisories": "dev-master",
86+
"symfony/var-dumper": "^7.1",
87+
"vincentlanglet/twig-cs-fixer": "^2.12"
8788
},
8889
"autoload": {
8990
"psr-4": {

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

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

27-
$values = array_map(fn($case) => "'{$case->value}'", $this->getEnumValues());
27+
$values = array_map(static fn($case) => "'{$case->value}'", $this->getEnumValues());
2828

2929
return sprintf('ENUM(%s)', implode(', ', $values));
3030
}

‎src/Plugin/src/Factory/PluginManagerFactory.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public function __invoke(ContainerInterface $container): PluginManager
2525

2626
//register the built-in plugins, if the required component is present
2727
if ($container->has(UrlHelper::class)) {
28-
$pluginManager->setFactory('url', function (ContainerInterface $container) {
28+
$pluginManager->setFactory('url', static function (ContainerInterface $container) {
2929
return new UrlHelperPlugin($container->get(UrlHelper::class));
3030
});
3131
}
3232

3333
if ($container->has(TemplateRendererInterface::class)) {
34-
$pluginManager->setFactory('template', function (ContainerInterface $container) {
34+
$pluginManager->setFactory('template', static function (ContainerInterface $container) {
3535
return new TemplatePlugin($container->get(TemplateRendererInterface::class));
3636
});
3737
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function getArrayCopy(): array
276276
'avatar' => $this->getAvatar()?->getArrayCopy(),
277277
'identity' => $this->getIdentity(),
278278
'status' => $this->getStatus(),
279-
'roles' => $this->getRoles()->map(function (UserRole $userRole) {
279+
'roles' => $this->getRoles()->map(static function (UserRole $userRole) {
280280
return $userRole->getArrayCopy();
281281
})->toArray(),
282282
'created' => $this->getCreated(),

‎src/User/src/Entity/UserIdentity.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function fromEntity(UserIdentityInterface $user): self
5353
return new self(
5454
$user->getUuid()->toString(),
5555
$user->getIdentity(),
56-
$user->getRoles()->map(function (UserRole $userRole) {
56+
$user->getRoles()->map(static function (UserRole $userRole) {
5757
return $userRole->getName();
5858
})->toArray(),
5959
$user->getDetail()->getArrayCopy(),

‎structarmed.php‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Boundwize\StructArmed\Architecture;
6+
use Boundwize\StructArmed\Preset\Preset;
7+
8+
return Architecture::define()
9+
->withPresets(Preset::PSR4(), Preset::CODEQUALITY())
10+
->layer('Plugin', 'src/Plugin/src')
11+
->layer('App', 'src/App/src')
12+
->layer('User', 'src/User/src')
13+
->layer('Contact', 'src/Contact/src')
14+
->layer('Page', 'src/Page/src')
15+
->ruleset([
16+
'Plugin' => [],
17+
'App' => ['User'],
18+
'User' => ['+App', 'Plugin'],
19+
'Contact' => ['+User'],
20+
'Page' => [],
21+
]);

‎test/Unit/Plugin/FormsPluginTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function testWillRestoreState(): void
6262
->expects($this->exactly(2))
6363
->method('getData')
6464
->willReturnCallback(
65-
function (string $key) use ($newData, $newMessages) {
65+
static function (string $key) use ($newData, $newMessages) {
6666
return match ($key) {
6767
'loginForm_data' => $newData,
6868
'loginForm_messages' => $newMessages,

0 commit comments

Comments
 (0)