Skip to content

Commit a5ce1ef

Browse files
committed
fix: remove unused constants and simplify returns
1 parent 6feb082 commit a5ce1ef

7 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/Console/Command/Dev/InspectorCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
116116
'enable' => $this->enableInspector(),
117117
'disable' => $this->disableInspector(),
118118
'status' => $this->showStatus(),
119-
default => Cli::RETURN_FAILURE,
120119
};
121120
}
122121

src/Console/Command/System/VersionCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
class VersionCommand extends AbstractCommand
1818
{
1919
private const API_URL = 'https://api.github.com/repos/openforgeproject/mageforge/releases/latest';
20-
private const PACKAGE_NAME = 'openforgeproject/mageforge';
2120
private const UNKNOWN_VERSION = 'Unknown';
2221

2322
/**

src/Console/Command/Theme/TokensCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private function validateHyvaTheme(string $themeCode, OutputInterface $output):
125125

126126
// If no theme was selected, exit
127127
if ($correctedTheme === null) {
128-
return Cli::RETURN_FAILURE;
128+
return null;
129129
}
130130

131131
// Use the corrected theme code
@@ -135,7 +135,7 @@ private function validateHyvaTheme(string $themeCode, OutputInterface $output):
135135
// Double-check the corrected theme exists
136136
if ($themePath === null) {
137137
$this->io->error("Theme $themeCode is not installed.");
138-
return Cli::RETURN_FAILURE;
138+
return null;
139139
}
140140

141141
$this->io->info("Using theme: $themeCode");

src/Model/TemplateEngine/Decorator/InspectorHints.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public function render(BlockInterface $block, $templateFile, array $dictionary =
6262
{
6363
$result = $this->subject->render($block, $templateFile, $dictionary);
6464

65+
if (!$this->showBlockHints) {
66+
return $result;
67+
}
68+
6569
// Only inject attributes if there's actual HTML content
6670
if (empty(trim($result))) {
6771
return $result;

src/Model/ThemePath.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66

77
use Magento\Framework\Component\ComponentRegistrar;
88
use Magento\Framework\Component\ComponentRegistrarInterface;
9-
use Magento\Theme\Model\ResourceModel\Theme\Collection as ThemeCollection;
109

1110
class ThemePath
1211
{
1312
public function __construct(
14-
private readonly ThemeList $themeList,
15-
private readonly ComponentRegistrarInterface $componentRegistrar,
16-
private readonly ThemeCollection $themeCollection
13+
private readonly ComponentRegistrarInterface $componentRegistrar
1714
) {
1815
}
1916

src/Service/Hyva/CompatibilityChecker.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class CompatibilityChecker
1919
{
2020
public function __construct(
2121
private readonly ComponentRegistrarInterface $componentRegistrar,
22-
private readonly ModuleScanner $moduleScanner,
23-
private readonly IncompatibilityDetector $incompatibilityDetector
22+
private readonly ModuleScanner $moduleScanner
2423
) {
2524
}
2625

src/Service/StaticContentCleaner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function cleanIfNeeded(
6161
$cleanedStatic = $this->themeCleaner->cleanPubStatic($themeCode, $io, false, $isVerbose);
6262
$cleanedPreprocessed = $this->themeCleaner->cleanViewPreprocessed($themeCode, $io, false, $isVerbose);
6363

64-
return ($cleanedStatic > 0 || $cleanedPreprocessed > 0) || !$this->themeCleaner->hasStaticFiles($themeCode);
64+
return ($cleanedStatic > 0 || $cleanedPreprocessed > 0);
6565
} catch (\Exception $e) {
6666
$io->error('Failed to check/clean static content: ' . $e->getMessage());
6767
return false;

0 commit comments

Comments
 (0)