Skip to content

Commit 37b847d

Browse files
committed
chore: add docblocks for command methods
1 parent 61b2da3 commit 37b847d

13 files changed

Lines changed: 257 additions & 60 deletions

File tree

src/Console/Command/System/CheckCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public function __construct(
4141
}
4242

4343
/**
44-
* {@inheritdoc}
44+
* Configure command.
45+
*
46+
* @return void
4547
*/
4648
protected function configure(): void
4749
{
@@ -51,7 +53,11 @@ protected function configure(): void
5153
}
5254

5355
/**
54-
* {@inheritdoc}
56+
* Execute command.
57+
*
58+
* @param InputInterface $input
59+
* @param OutputInterface $output
60+
* @return int
5561
*/
5662
protected function executeCommand(InputInterface $input, OutputInterface $output): int
5763
{

src/Console/Command/System/VersionCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public function __construct(
2929
}
3030

3131
/**
32-
* {@inheritdoc}
32+
* Configure command.
33+
*
34+
* @return void
3335
*/
3436
protected function configure(): void
3537
{
@@ -39,7 +41,11 @@ protected function configure(): void
3941
}
4042

4143
/**
42-
* {@inheritdoc}
44+
* Execute command.
45+
*
46+
* @param InputInterface $input
47+
* @param OutputInterface $output
48+
* @return int
4349
*/
4450
protected function executeCommand(InputInterface $input, OutputInterface $output): int
4551
{

src/Console/Command/Theme/BuildCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public function __construct(
3939
}
4040

4141
/**
42-
* {@inheritdoc}
42+
* Configure command.
43+
*
44+
* @return void
4345
*/
4446
protected function configure(): void
4547
{
@@ -54,7 +56,11 @@ protected function configure(): void
5456
}
5557

5658
/**
57-
* {@inheritdoc}
59+
* Execute command.
60+
*
61+
* @param InputInterface $input
62+
* @param OutputInterface $output
63+
* @return int
5864
*/
5965
protected function executeCommand(InputInterface $input, OutputInterface $output): int
6066
{

src/Console/Command/Theme/CleanCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public function __construct(
3737
}
3838

3939
/**
40-
* {@inheritdoc}
40+
* Configure command.
41+
*
42+
* @return void
4143
*/
4244
protected function configure(): void
4345
{
@@ -64,7 +66,11 @@ protected function configure(): void
6466
}
6567

6668
/**
67-
* {@inheritdoc}
69+
* Execute command.
70+
*
71+
* @param InputInterface $input
72+
* @param OutputInterface $output
73+
* @return int
6874
*/
6975
protected function executeCommand(InputInterface $input, OutputInterface $output): int
7076
{

src/Console/Command/Theme/ListCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function __construct(
2626
}
2727

2828
/**
29-
* {@inheritdoc}
29+
* Configure command.
30+
*
31+
* @return void
3032
*/
3133
protected function configure(): void
3234
{
@@ -36,7 +38,11 @@ protected function configure(): void
3638
}
3739

3840
/**
39-
* {@inheritdoc}
41+
* Execute command.
42+
*
43+
* @param InputInterface $input
44+
* @param OutputInterface $output
45+
* @return int
4046
*/
4147
protected function executeCommand(InputInterface $input, OutputInterface $output): int
4248
{

src/Console/Command/Theme/TokensCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public function __construct(
4242
}
4343

4444
/**
45-
* {@inheritdoc}
45+
* Configure command.
46+
*
47+
* @return void
4648
*/
4749
protected function configure(): void
4850
{
@@ -57,7 +59,11 @@ protected function configure(): void
5759
}
5860

5961
/**
60-
* {@inheritdoc}
62+
* Execute command.
63+
*
64+
* @param InputInterface $input
65+
* @param OutputInterface $output
66+
* @return int
6167
*/
6268
protected function executeCommand(InputInterface $input, OutputInterface $output): int
6369
{

src/Console/Command/Theme/WatchCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ public function __construct(
3636
}
3737

3838
/**
39-
* {@inheritdoc}
39+
* Configure command.
40+
*
41+
* @return void
4042
*/
41-
protected function configure()
43+
protected function configure(): void
4244
{
4345
$this->setName($this->getCommandName('theme', 'watch'))
4446
->setDescription('Watches theme files for changes and rebuilds them automatically')
@@ -57,7 +59,11 @@ protected function configure()
5759
}
5860

5961
/**
60-
* {@inheritdoc}
62+
* Execute command.
63+
*
64+
* @param InputInterface $input
65+
* @param OutputInterface $output
66+
* @return int
6167
*/
6268
protected function executeCommand(InputInterface $input, OutputInterface $output): int
6369
{

src/Service/Hyva/CompatibilityChecker.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ public function check(
5858
'hasIncompatibilities' => false,
5959
];
6060

61-
$io->text(sprintf('Scanning %d modules for Hyvä compatibility...', count($modules)));
61+
$io->text(sprintf(
62+
'Scanning %d modules for Hyvä compatibility...',
63+
count($modules)
64+
));
6265
$io->newLine();
6366

6467
foreach ($modules as $moduleName => $modulePath) {

src/Service/Inspector/Cache/BlockCacheCollector.php

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,33 @@
1212
*
1313
* Measures render time and extracts cache configuration with strict type safety (PHPStan Level 8).
1414
*
15+
* @phpstan-type CacheInfo array{
16+
* cacheable: bool,
17+
* lifetime: int|null,
18+
* cacheKey: string,
19+
* cacheTags: array<int, string>,
20+
* pageCacheable: bool
21+
* }
22+
* @phpstan-type RenderMetrics array{
23+
* renderTimeMs: float,
24+
* startTime: int,
25+
* endTime: int
26+
* }
27+
* @phpstan-type PerformanceExport array{
28+
* renderTime: string,
29+
* timestamp: int
30+
* }
31+
* @phpstan-type CacheExport array{
32+
* cacheable: bool,
33+
* lifetime: int|null,
34+
* key: string,
35+
* tags: array<int, string>,
36+
* pageCacheable: bool
37+
* }
38+
* @phpstan-type FormattedMetrics array{
39+
* performance: PerformanceExport,
40+
* cache: CacheExport
41+
* }
1542
*/
1643
class BlockCacheCollector
1744
{
@@ -22,14 +49,16 @@ public function __construct(
2249
private readonly LayoutInterface $layout
2350
) {
2451
}
52+
2553
/**
2654
* Get cache information from block
2755
*
2856
* Safely extracts cache lifetime, key, and tags with explicit type checking
2957
* to satisfy PHPStan Level 8 requirements.
3058
*
3159
* @param BlockInterface $block
32-
* @return array{cacheable: bool, lifetime: int|null, cacheKey: string, cacheTags: array<int, string>, pageCacheable: bool}
60+
* @return array<string, mixed>
61+
* @phpstan-return CacheInfo
3362
*/
3463
public function getCacheInfo(BlockInterface $block): array
3564
{
@@ -167,8 +196,8 @@ private function resolveCacheTags(BlockInterface $block): array
167196
/**
168197
* Check if current page is cacheable
169198
*
170-
* Checks layout configuration to determine if page has cacheable="false" attribute.
171-
* If ANY block on the page is marked as non-cacheable in layout XML, the entire page is non-cacheable.
199+
* Checks layout configuration to determine if page has cacheable="false" attribute.
200+
* If any block on the page is marked as non-cacheable in layout XML, the page is non-cacheable.
172201
*
173202
* @return bool True if page is cacheable, false otherwise
174203
*/
@@ -207,16 +236,22 @@ private function isPageCacheable(): bool
207236
/**
208237
* Format metrics for JSON export to frontend
209238
*
210-
* @param array{renderTimeMs: float, startTime: int, endTime: int} $renderMetrics
211-
* @param array{cacheable: bool, lifetime: int|null, cacheKey: string, cacheTags: array<int, string>, pageCacheable: bool} $cacheMetrics
212-
* @return array{performance: array{renderTime: string, timestamp: int}, cache: array{cacheable: bool, lifetime: int|null, key: string, tags: array<int, string>, pageCacheable: bool}}
239+
* @param array<string, mixed> $renderMetrics
240+
* @param array<string, mixed> $cacheMetrics
241+
* @return array<string, mixed>
242+
* @phpstan-param RenderMetrics $renderMetrics
243+
* @phpstan-param CacheInfo $cacheMetrics
244+
* @phpstan-return FormattedMetrics
213245
*/
214246
public function formatMetricsForJson(array $renderMetrics, array $cacheMetrics): array
215247
{
248+
$timestamp = (int) ($renderMetrics['startTime'] / 1_000_000_000);
249+
216250
return [
217251
'performance' => [
218252
'renderTime' => number_format($renderMetrics['renderTimeMs'], 2),
219-
'timestamp' => (int)($renderMetrics['startTime'] / 1_000_000_000), // Convert ns to seconds
253+
// Convert ns to seconds.
254+
'timestamp' => $timestamp,
220255
],
221256
'cache' => [
222257
'cacheable' => $cacheMetrics['cacheable'],

src/Service/ThemeBuilder/BuilderInterface.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ public function detect(string $themePath): bool;
2727
* @param bool $isVerbose
2828
* @return bool
2929
*/
30-
public function build(string $themeCode, string $themePath, SymfonyStyle $io, OutputInterface $output, bool $isVerbose): bool;
30+
public function build(
31+
string $themeCode,
32+
string $themePath,
33+
SymfonyStyle $io,
34+
OutputInterface $output,
35+
bool $isVerbose
36+
): bool;
3137

3238
/**
3339
* Get the builder name used for registration.
@@ -45,7 +51,12 @@ public function getName(): string;
4551
* @param bool $isVerbose
4652
* @return bool
4753
*/
48-
public function autoRepair(string $themePath, SymfonyStyle $io, OutputInterface $output, bool $isVerbose): bool;
54+
public function autoRepair(
55+
string $themePath,
56+
SymfonyStyle $io,
57+
OutputInterface $output,
58+
bool $isVerbose
59+
): bool;
4960

5061
/**
5162
* Run the theme watch process.
@@ -57,5 +68,11 @@ public function autoRepair(string $themePath, SymfonyStyle $io, OutputInterface
5768
* @param bool $isVerbose
5869
* @return bool
5970
*/
60-
public function watch(string $themeCode, string $themePath, SymfonyStyle $io, OutputInterface $output, bool $isVerbose): bool;
71+
public function watch(
72+
string $themeCode,
73+
string $themePath,
74+
SymfonyStyle $io,
75+
OutputInterface $output,
76+
bool $isVerbose
77+
): bool;
6178
}

0 commit comments

Comments
 (0)