Skip to content

Commit 522b338

Browse files
committed
refactor: unify symfony bundles architecture
1 parent 4630d21 commit 522b338

20 files changed

Lines changed: 2584 additions & 2553 deletions

File tree

mago.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ includes = [
2121
# Symfony
2222
"src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/FlowFilesystemBundle.php",
2323
"src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/FlowPostgreSqlBundle.php",
24-
"src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/DependencyInjection/Configuration.php",
24+
"src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/FlowTelemetryBundle.php",
2525
]
2626
excludes = [
2727
"src/**/vendor/**",

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ parameters:
144144
message: '#Dom\\(CharacterData|HTMLDocument|HTMLElement|Element)#i'
145145
identifier: class.notFound
146146
-
147-
path: src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/DependencyInjection/FlowTelemetryExtension.php
147+
path: src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/FlowTelemetryBundle.php
148148
identifier: offsetAccess.nonOffsetAccessible
149149
-
150-
path: src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/DependencyInjection/FlowTelemetryExtension.php
150+
path: src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/FlowTelemetryBundle.php
151151
identifier: cast.string
152152
-
153153
path: src/bridge/symfony/filesystem-cache/src/Flow/Bridge/Symfony/FilesystemCache/FlowFilesystemCacheAdapter.php

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/Command/FstabResolver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ private static function normalizePath(string $path): string
9696
$normalized[] = $part;
9797
}
9898

99-
return ($isAbsolute ? '/' : '') . implode('/', array_map(static fn (mixed $s): string => (string) $s, $normalized));
99+
return (
100+
($isAbsolute ? '/' : '') . implode('/', array_map(static fn(mixed $s): string => (string) $s, $normalized))
101+
);
100102
}
101103
}

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/BuildFstabsPass.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ public function process(ContainerBuilder $container): void
9494
$telemetryRaw = $fstabConfig['telemetry'] ?? [];
9595
$telemetryArray = is_array($telemetryRaw) ? $telemetryRaw : [];
9696

97-
$telemetryReference = $this->buildTelemetryConfigReference(
98-
$container,
99-
$fstabNameStr,
100-
$telemetryArray,
101-
);
97+
$telemetryReference = $this->buildTelemetryConfigReference($container, $fstabNameStr, $telemetryArray);
10298

10399
$definition = new Definition(FilesystemTable::class);
104100
$definition->setFactory([FstabBuilder::class, 'build']);
@@ -192,7 +188,12 @@ private function collectAvailableTypes(ContainerBuilder $container): array
192188
foreach ($container->findTaggedServiceIds(RegisterFilesystemFactoriesPass::TAG) as $serviceId => $tags) {
193189
// @mago-expect analysis:mixed-assignment
194190
foreach ($tags as $tag) {
195-
if (is_array($tag) && array_key_exists('type', $tag) && is_string($tag['type']) && $tag['type'] !== '') {
191+
if (
192+
is_array($tag)
193+
&& array_key_exists('type', $tag)
194+
&& is_string($tag['type'])
195+
&& $tag['type'] !== ''
196+
) {
196197
$types[$tag['type']] = $serviceId;
197198
}
198199
}

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/RegisterFilesystemFactoriesPass.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ public function process(ContainerBuilder $container): void
3232
foreach ($container->findTaggedServiceIds(self::TAG) as $serviceId => $tags) {
3333
// @mago-expect analysis:mixed-assignment
3434
foreach ($tags as $tag) {
35-
if (!is_array($tag) || !array_key_exists('type', $tag) || !is_string($tag['type']) || $tag['type'] === '') {
35+
if (
36+
!is_array($tag)
37+
|| !array_key_exists('type', $tag)
38+
|| !is_string($tag['type'])
39+
|| $tag['type'] === ''
40+
) {
3641
throw new LogicException(sprintf(
3742
'Service "%s" is tagged with "%s" but is missing a non-empty "type" attribute.',
3843
$serviceId,

src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/CachePoolRegistrationTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public function test_cache_pool_with_marshaller_service_id_injects_marshaller():
7474

7575
static::assertSame(
7676
$container->get('test.marshaller'),
77-
(new ReflectionObject($adapter))->getProperty('marshaller')->getValue($adapter),
77+
(new ReflectionObject($adapter))
78+
->getProperty('marshaller')
79+
->getValue($adapter),
7880
);
7981
}
8082

src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Command/DiffCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6767
return Command::FAILURE;
6868
}
6969

70-
$directory = $configuration->migrationsDirectory . '/' . (string) $version . ($name !== null ? '_' . $name : '');
70+
$directory =
71+
$configuration->migrationsDirectory . '/' . (string) $version . ($name !== null ? '_' . $name : '');
7172
$realDirectory = realpath($directory) ?: $directory;
7273
$migrationPath = $realDirectory . '/' . $configuration->migrationFileName;
7374
$rollbackPath = $realDirectory . '/' . $configuration->rollbackFileName;

src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Command/GenerateCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5454

5555
$version = $generator->generateDataMigration($name);
5656

57-
$directory = $configuration->migrationsDirectory . '/' . (string) $version . ($name !== null ? '_' . $name : '');
57+
$directory =
58+
$configuration->migrationsDirectory . '/' . (string) $version . ($name !== null ? '_' . $name : '');
5859
$realDirectory = realpath($directory) ?: $directory;
5960

6061
$io->success(sprintf('Generated migration: %s', $version));

src/bridge/symfony/postgresql-cache/src/Flow/Bridge/Symfony/PostgreSQLCache/FlowPostgreSqlCacheAdapter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ protected function doFetch(array $ids): iterable
232232

233233
$rowData = is_string($row[$this->dataCol] ?? null)
234234
? $row[$this->dataCol]
235-
: throw CacheException::unexpectedRowShape($this->dataCol, get_debug_type($row[$this->dataCol] ?? null));
235+
: throw CacheException::unexpectedRowShape(
236+
$this->dataCol,
237+
get_debug_type($row[$this->dataCol] ?? null),
238+
);
236239

237240
yield $rowId => $this->marshaller->unmarshall($rowData);
238241
}

src/bridge/symfony/postgresql-messenger/src/Flow/Bridge/Symfony/PostgreSQLMessenger/Connection.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ public function get(): ?array
117117

118118
$rowId = is_int($row['id'] ?? null)
119119
? (int) $row['id']
120-
: (is_string($row['id'] ?? null)
121-
? $row['id']
122-
: throw TransportException::unexpectedRowShape('id', get_debug_type($row['id'] ?? null)));
120+
: (
121+
is_string($row['id'] ?? null)
122+
? $row['id']
123+
: throw TransportException::unexpectedRowShape('id', get_debug_type($row['id'] ?? null))
124+
);
123125

124126
$client->execute(
125127
update()
@@ -207,9 +209,11 @@ public function send(string $body, array $headers, int $delay = 0): string
207209

208210
$rowId = is_int($row['id'] ?? null)
209211
? $row['id']
210-
: (is_string($row['id'] ?? null)
211-
? $row['id']
212-
: throw TransportException::unexpectedRowShape('id', get_debug_type($row['id'] ?? null)));
212+
: (
213+
is_string($row['id'] ?? null)
214+
? $row['id']
215+
: throw TransportException::unexpectedRowShape('id', get_debug_type($row['id'] ?? null))
216+
);
213217

214218
return (string) $rowId;
215219
}

0 commit comments

Comments
 (0)