Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameters:
level: 6
level: 7
paths:
- src
10 changes: 8 additions & 2 deletions src/Console/Command/System/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
$dbType = $this->getDatabaseType();
$osInfo = $this->getShortOsInfo();
$magentoVersion = $this->productMetadata->getVersion();
/** @var string $latestLtsNodeVersion */
$latestLtsNodeVersion = $this->escaper->escapeHtml($this->getLatestLtsNodeVersion());
$composerVersion = $this->getComposerVersion();
$npmVersion = $this->getNpmVersion();
Expand Down Expand Up @@ -227,9 +228,14 @@ private function getMysqlVersionViaPdo(): ?string

$dsn = "mysql:host=$host;port=$port";
$pdo = new \PDO($dsn, $user, $pass, [\PDO::ATTR_TIMEOUT => 1]);
$version = $pdo->query('SELECT VERSION()')->fetchColumn();
$stmt = $pdo->query('SELECT VERSION()');
if ($stmt === false) {
return null;
}

return !empty($version) ? $version : null;
$version = $stmt->fetchColumn();

return !empty($version) ? (string)$version : null;
} catch (\Exception $e) {
return null;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Console/Command/Theme/TokensCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ private function generateTokens(string $tailwindPath, string $themeCode, bool $i
}

$currentDir = getcwd();
if ($currentDir === false) {
$this->io->error("Cannot determine current directory");
return false;
}
chdir($tailwindPath);

try {
Expand Down
6 changes: 5 additions & 1 deletion src/Model/TemplateEngine/Decorator/InspectorHints.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ private function injectInspectorAttributes(string $html, BlockInterface $block,
// JSON encode with proper escaping for HTML comments
$jsonMetadata = json_encode($metadata, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

if ($jsonMetadata === false) {
return $html;
}

// Escape any comment terminators in JSON to prevent breaking out of comment
$jsonMetadata = str_replace('-->', '-->', $jsonMetadata);

Expand Down Expand Up @@ -164,7 +168,7 @@ private function getViewModel(BlockInterface $block): string
{
if (method_exists($block, 'getViewModel')) {
$viewModel = $block->getViewModel();
if ($viewModel) {
if (is_object($viewModel)) {
return get_class($viewModel);
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/Service/NodePackageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public function __construct(
public function installNodeModules(string $path, SymfonyStyle $io, bool $isVerbose): bool
{
$currentDir = getcwd();
if ($currentDir === false) {
$io->error('Cannot determine current directory');
return false;
}

chdir($path);

try {
Expand Down Expand Up @@ -85,6 +90,10 @@ public function isNodeModulesInSync(string $path): bool
}

$currentDir = getcwd();
if ($currentDir === false) {
return false;
}

chdir($path);

try {
Expand All @@ -107,6 +116,10 @@ public function isNodeModulesInSync(string $path): bool
public function checkOutdatedPackages(string $path, SymfonyStyle $io): void
{
$currentDir = getcwd();
if ($currentDir === false) {
return;
}

chdir($path);

try {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/ThemeBuilder/HyvaThemes/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ private function buildTheme(string $themePath, SymfonyStyle $io, bool $isVerbose

// Change to tailwind directory and run build
$currentDir = getcwd();
if ($currentDir === false) {
$io->error('Cannot determine current directory');
return false;
}
chdir($tailwindPath);

try {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/ThemeBuilder/TailwindCSS/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ public function build(string $themeCode, string $themePath, SymfonyStyle $io, Ou

// Change to tailwind directory and run build
$currentDir = getcwd();
if ($currentDir === false) {
$io->error('Cannot determine current directory');
return false;
}
chdir($tailwindPath);

try {
Expand Down
Loading