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
12 changes: 7 additions & 5 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

<arg name="extensions" value="php,phtml"/>

<rule ref="Magento2">
<!-- Mago formats multi-line conditions PSR-12 style (newline after the
opening parenthesis); this PSR-2-era sniff would flag that. -->
<exclude name="PSR2.ControlStructures.ControlStructureSpacing"/>
</rule>
<!-- Full Magento2 standard, no exclusions: external package checkers run the
plain standard against the published package, so any local exclusion would
hide findings that still fail there. Multi-line conditions conflict with
Mago's PSR-12 wrapping (newline after the opening parenthesis, flagged by
PSR2.ControlStructures.ControlStructureSpacing) — keep conditions on one
line by extracting sub-expressions into variables instead. -->
<rule ref="Magento2"/>
</ruleset>
8 changes: 2 additions & 6 deletions src/Console/Command/System/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,8 @@ private function getLatestLtsNodeVersion(): string

/** @var array<int, array<string, mixed>> $nodes */
foreach ($nodes as $node) {
if (
isset($node['lts'])
&& $node['lts'] !== false
&& isset($node['version'])
&& is_string($node['version'])
) {
$isLtsRelease = isset($node['lts']) && $node['lts'] !== false;
if ($isLtsRelease && isset($node['version']) && is_string($node['version'])) {
return trim($node['version'], 'v');
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Service/Hyva/ModuleScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ private function isHyvaCompatibilityPackage(array $composerData): bool
{
// Check if this IS a Hyvä compatibility package
$packageName = $composerData['name'] ?? '';
if (
$isCompatPackage =
is_string($packageName)
&& str_starts_with($packageName, 'hyva-themes/')
&& str_contains($packageName, '-compat')
) {
&& str_contains($packageName, '-compat');
if ($isCompatPackage) {
return true;
}

Expand Down
8 changes: 2 additions & 6 deletions src/Service/ThemeBuilder/HyvaThemes/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ public function detect(string $themePath): bool
if ($this->fileDriver->isExists($themePath . '/composer.json')) {
$composerContent = $this->fileDriver->fileGetContents($themePath . '/composer.json');
$composerJson = json_decode($composerContent, true);
if (
is_array($composerJson)
&& isset($composerJson['name'])
&& is_string($composerJson['name'])
&& str_contains($composerJson['name'], 'hyva')
) {
$packageName = is_array($composerJson) ? $composerJson['name'] ?? null : null;
if (is_string($packageName) && str_contains($packageName, 'hyva')) {
return true;
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/Service/ThemeBuilder/TailwindCSS/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ public function detect(string $themePath): bool
if ($this->fileDriver->isExists($themePath . '/composer.json')) {
$composerContent = $this->fileDriver->fileGetContents($themePath . '/composer.json');
$composerJson = json_decode($composerContent, true);
if (
\is_array($composerJson)
&& isset($composerJson['name'])
&& \is_string($composerJson['name'])
&& !str_contains($composerJson['name'], 'hyva')
) {
$packageName = \is_array($composerJson) ? $composerJson['name'] ?? null : null;
if (\is_string($packageName) && !str_contains($packageName, 'hyva')) {
return true;
}
}
Expand Down
Loading