diff --git a/phpstan.neon b/phpstan.neon index 91e6453..6e451fa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,4 @@ parameters: - level: 5 + level: 6 paths: - src diff --git a/src/Block/Inspector.php b/src/Block/Inspector.php index d0c0da9..1e6b37f 100644 --- a/src/Block/Inspector.php +++ b/src/Block/Inspector.php @@ -19,6 +19,13 @@ class Inspector extends Template { private const XML_PATH_INSPECTOR_ENABLED = 'dev/mageforge_inspector/enabled'; + /** + * @param Context $context + * @param State $state + * @param ScopeConfigInterface $scopeConfig + * @param DevHelper $devHelper + * @param array $data + */ public function __construct( Context $context, private readonly State $state, diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index 5a00e6a..52aa505 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -30,12 +30,12 @@ abstract class AbstractCommand extends Command protected SymfonyStyle $io; /** - * @var array + * @var array */ private array $originalEnv = []; /** - * @var array + * @var array */ private array $secureEnvStorage = []; diff --git a/src/Console/Command/Hyva/CompatibilityCheckCommand.php b/src/Console/Command/Hyva/CompatibilityCheckCommand.php index 0dbe5d8..1114496 100644 --- a/src/Console/Command/Hyva/CompatibilityCheckCommand.php +++ b/src/Console/Command/Hyva/CompatibilityCheckCommand.php @@ -34,7 +34,10 @@ class CompatibilityCheckCommand extends AbstractCommand private const SCOPE_THIRD_PARTY = 'third-party'; private const SCOPE_ALL = 'all'; + /** @var array */ private array $originalEnv = []; + + /** @var array */ private array $secureEnvStorage = []; public function __construct( @@ -245,6 +248,9 @@ private function runScan( /** * Display compatibility check results + * + * @param array $results + * @param bool $showAll */ private function displayResults(array $results, bool $showAll): void { @@ -265,6 +271,8 @@ private function displayResults(array $results, bool $showAll): void /** * Display detailed file-level issues + * + * @param array $results */ private function displayDetailedIssues(array $results): void { @@ -303,6 +311,8 @@ private function displayDetailedIssues(array $results): void /** * Display summary statistics + * + * @param array $results */ private function displaySummary(array $results): void { diff --git a/src/Console/Command/Theme/BuildCommand.php b/src/Console/Command/Theme/BuildCommand.php index 1d807f3..0b2fbef 100644 --- a/src/Console/Command/Theme/BuildCommand.php +++ b/src/Console/Command/Theme/BuildCommand.php @@ -23,7 +23,10 @@ */ class BuildCommand extends AbstractCommand { + /** @var array */ private array $originalEnv = []; + + /** @var array */ private array $secureEnvStorage = []; /** @@ -136,7 +139,7 @@ private function displayAvailableThemes(SymfonyStyle $io): int /** * Process theme building * - * @param array $themeCodes + * @param array $themeCodes * @param SymfonyStyle $io * @param OutputInterface $output * @param bool $isVerbose @@ -247,7 +250,7 @@ private function validateAndCorrectTheme( * @param SymfonyStyle $io * @param OutputInterface $output * @param bool $isVerbose - * @param array $successList + * @param array $successList * @return bool */ private function buildValidatedTheme( @@ -287,7 +290,7 @@ private function buildValidatedTheme( * @param SymfonyStyle $io * @param OutputInterface $output * @param bool $isVerbose - * @param array $successList + * @param array $successList * @return bool */ private function processTheme( @@ -312,7 +315,7 @@ private function processTheme( * Display build summary * * @param SymfonyStyle $io - * @param array $successList + * @param array $successList * @param float $duration */ private function displayBuildSummary(SymfonyStyle $io, array $successList, float $duration): void @@ -386,6 +389,8 @@ private function getSecureEnvironmentValue(string $name): ?string /** * Cache and filter environment variables safely + * + * @return array */ private function getCachedEnvironmentVariables(): array { diff --git a/src/Console/Command/Theme/CleanCommand.php b/src/Console/Command/Theme/CleanCommand.php index 1ed6e0e..d7fe658 100644 --- a/src/Console/Command/Theme/CleanCommand.php +++ b/src/Console/Command/Theme/CleanCommand.php @@ -21,8 +21,11 @@ */ class CleanCommand extends AbstractCommand { + /** @var array|null */ private static ?array $cachedEnv = null; + /** @var array */ private array $originalEnv = []; + /** @var array */ private array $secureEnvStorage = []; /** @@ -96,7 +99,7 @@ protected function executeCommand(InputInterface $input, OutputInterface $output * * @param InputInterface $input * @param OutputInterface $output - * @return array|null Array of theme codes or null to exit + * @return array|null Array of theme codes or null to exit */ private function resolveThemeCodes(InputInterface $input, OutputInterface $output): ?array { @@ -117,7 +120,7 @@ private function resolveThemeCodes(InputInterface $input, OutputInterface $outpu /** * Get all theme codes * - * @return array|null + * @return array|null */ private function getAllThemeCodes(): ?array { @@ -138,7 +141,7 @@ private function getAllThemeCodes(): ?array * Select themes interactively * * @param OutputInterface $output - * @return array|null + * @return array|null */ private function selectThemesInteractively(OutputInterface $output): ?array { @@ -156,7 +159,7 @@ private function selectThemesInteractively(OutputInterface $output): ?array /** * Display available themes for non-interactive environments * - * @param array $themes + * @param array $themes * @return void */ private function displayAvailableThemes(array $themes): void @@ -181,9 +184,9 @@ private function displayAvailableThemes(array $themes): void /** * Prompt user to select themes * - * @param array $options - * @param array $themes - * @return array|null + * @param array $options + * @param array $themes + * @return array|null */ private function promptForThemes(array $options, array $themes): ?array { @@ -219,10 +222,10 @@ private function promptForThemes(array $options, array $themes): ?array /** * Process cleaning for all selected themes * - * @param array $themeCodes + * @param array $themeCodes * @param bool $dryRun * @param OutputInterface $output - * @return array [totalCleaned, failedThemes] + * @return array [totalCleaned, failedThemes] */ private function processThemes(array $themeCodes, bool $dryRun, OutputInterface $output): array { @@ -257,7 +260,7 @@ private function processThemes(array $themeCodes, bool $dryRun, OutputInterface * Validate theme exists * * @param string $themeName - * @param array &$failedThemes + * @param array $failedThemes * @param OutputInterface $output * @return string|null Theme code if valid or corrected, null if invalid */ @@ -364,9 +367,9 @@ private function displayThemeResult(string $themeName, int $cleaned, bool $dryRu /** * Display summary of cleaning operation * - * @param array $themeCodes + * @param array $themeCodes * @param int $totalCleaned - * @param array $failedThemes + * @param array $failedThemes * @param bool $dryRun * @return void */ @@ -411,7 +414,7 @@ private function displaySingleThemeSummary(string $themeCode, int $totalCleaned, * * @param int $totalThemes * @param int $totalCleaned - * @param array $failedThemes + * @param array $failedThemes * @param bool $dryRun * @return void */ @@ -543,6 +546,8 @@ private function getSecureEnvironmentValue(string $name): ?string /** * Cache and filter environment variables safely + * + * @return array */ private function getCachedEnvironmentVariables(): array { diff --git a/src/Model/TemplateEngine/Decorator/InspectorHints.php b/src/Model/TemplateEngine/Decorator/InspectorHints.php index 6fcc980..fa4aa83 100644 --- a/src/Model/TemplateEngine/Decorator/InspectorHints.php +++ b/src/Model/TemplateEngine/Decorator/InspectorHints.php @@ -44,7 +44,7 @@ public function __construct( * * @param BlockInterface $block * @param string $templateFile - * @param array $dictionary + * @param array $dictionary * @return string */ public function render(BlockInterface $block, $templateFile, array $dictionary = []): string diff --git a/src/Model/ThemeList.php b/src/Model/ThemeList.php index dd25e4c..f08a8b8 100644 --- a/src/Model/ThemeList.php +++ b/src/Model/ThemeList.php @@ -21,7 +21,7 @@ public function __construct( /** * Get all themes * - * @return array + * @return array */ public function getAllThemes(): array { diff --git a/src/Service/Hyva/CompatibilityChecker.php b/src/Service/Hyva/CompatibilityChecker.php index 2cadd0f..f5337d7 100644 --- a/src/Service/Hyva/CompatibilityChecker.php +++ b/src/Service/Hyva/CompatibilityChecker.php @@ -31,7 +31,7 @@ public function __construct( * @param bool $showAll Whether to show all modules (including compatible ones) * @param bool $thirdPartyOnly Whether to scan only third-party modules (excludes Magento_* modules) * @param bool $excludeVendor Whether to exclude modules from the vendor/ directory (true = exclude, false = include) - * @return array Results with structure: ['modules' => [], 'summary' => [], 'hasIncompatibilities' => bool] + * @return array Results with structure: ['modules' => [], 'summary' => [], 'hasIncompatibilities' => bool] */ public function check( SymfonyStyle $io, @@ -126,6 +126,10 @@ private function isMagentoModule(string $moduleName): bool /** * Format results for display + * + * @param array $results + * @param bool $showAll + * @return array> */ public function formatResultsForDisplay(array $results, bool $showAll = false): array { @@ -149,6 +153,8 @@ public function formatResultsForDisplay(array $results, bool $showAll = false): /** * Get status display string with colors + * + * @param array $moduleData */ private function getStatusDisplay(array $moduleData): string { @@ -169,6 +175,8 @@ private function getStatusDisplay(array $moduleData): string /** * Get issues display string + * + * @param array $moduleData */ private function getIssuesDisplay(array $moduleData): string { @@ -195,6 +203,10 @@ private function getIssuesDisplay(array $moduleData): string /** * Get detailed file issues for a module + * + * @param string $moduleName + * @param array $moduleData + * @return array> */ public function getDetailedIssues(string $moduleName, array $moduleData): array { diff --git a/src/Service/Hyva/IncompatibilityDetector.php b/src/Service/Hyva/IncompatibilityDetector.php index 038e111..b5700c6 100644 --- a/src/Service/Hyva/IncompatibilityDetector.php +++ b/src/Service/Hyva/IncompatibilityDetector.php @@ -102,7 +102,7 @@ public function __construct( /** * Detect incompatibilities in a file * - * @return array Array of issues with keys: pattern, description, severity, line + * @return array> Array of issues with keys: pattern, description, severity, line */ public function detectInFile(string $filePath): array { @@ -142,6 +142,10 @@ private function mapExtensionToType(string $extension): string /** * Scan content lines for pattern matches + * + * @param array $lines + * @param array> $patterns + * @return array> */ private function scanContentForPatterns(array $lines, array $patterns): array { diff --git a/src/Service/Hyva/ModuleScanner.php b/src/Service/Hyva/ModuleScanner.php index 9a956a4..8b7d7e3 100644 --- a/src/Service/Hyva/ModuleScanner.php +++ b/src/Service/Hyva/ModuleScanner.php @@ -26,7 +26,7 @@ public function __construct( /** * Scan a module directory for compatibility issues * - * @return array Array with structure: ['files' => [], 'totalIssues' => int, 'criticalIssues' => int] + * @return array Array with structure: ['files' => [], 'totalIssues' => int, 'criticalIssues' => int] */ public function scanModule(string $modulePath): array { @@ -65,6 +65,8 @@ public function scanModule(string $modulePath): array /** * Recursively find all relevant files in a directory + * + * @return array */ private function findRelevantFiles(string $directory): array { @@ -109,7 +111,7 @@ private function findRelevantFiles(string $directory): array /** * Check if module has Hyvä compatibility package based on composer data * - * @param array $composerData Parsed composer.json data + * @param array $composerData Parsed composer.json data */ private function isHyvaCompatibilityPackage(array $composerData): bool { @@ -165,6 +167,8 @@ public function hasHyvaCompatibilityPackage(string $modulePath): bool /** * Get module info from composer.json + * + * @return array */ public function getModuleInfo(string $modulePath): array { diff --git a/src/Service/StandardThemeBuilder.php b/src/Service/StandardThemeBuilder.php index cebcf10..27d2230 100644 --- a/src/Service/StandardThemeBuilder.php +++ b/src/Service/StandardThemeBuilder.php @@ -16,6 +16,14 @@ public function __construct( ) { } + /** + * @param string $themeCode + * @param SymfonyStyle $io + * @param OutputInterface $output + * @param bool $isVerbose + * @param array $successList + * @return bool + */ public function build( string $themeCode, SymfonyStyle $io, diff --git a/src/Service/ThemeBuilder/BuilderFactory.php b/src/Service/ThemeBuilder/BuilderFactory.php index 01f7371..b1e071f 100644 --- a/src/Service/ThemeBuilder/BuilderFactory.php +++ b/src/Service/ThemeBuilder/BuilderFactory.php @@ -6,6 +6,7 @@ class BuilderFactory { + /** @var array */ private array $builders = []; public function addBuilder(BuilderInterface $builder): void @@ -22,6 +23,9 @@ public function create(string $type): BuilderInterface return $this->builders[$type]; } + /** + * @return array + */ public function getAvailableBuilders(): array { return array_keys($this->builders); diff --git a/src/Service/ThemeSuggester.php b/src/Service/ThemeSuggester.php index 3a3b897..dd2f086 100644 --- a/src/Service/ThemeSuggester.php +++ b/src/Service/ThemeSuggester.php @@ -37,7 +37,7 @@ public function __construct( * - Returns top matches sorted by distance * * @param string $invalidTheme The invalid theme code entered by user - * @return array Array of suggested theme codes (max 3) + * @return array Array of suggested theme codes (max 3) */ public function findSimilarThemes(string $invalidTheme): array {