Skip to content

refactor: simplify condition checks in various files#215

Merged
Morgy93 merged 1 commit into
mainfrom
fix-phpcs
Jul 4, 2026
Merged

refactor: simplify condition checks in various files#215
Morgy93 merged 1 commit into
mainfrom
fix-phpcs

Conversation

@Morgy93

@Morgy93 Morgy93 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces several code simplifications and refactorings to improve readability and maintainability, as well as an update to the PHP CodeSniffer configuration for stricter code style enforcement. The main changes include extracting boolean expressions into variables for clarity, updating the code style rules to match external package checkers, and simplifying logic for composer package detection.

Code Simplification and Refactoring:

  • Extracted boolean logic into variables for clarity in methods such as getLatestLtsNodeVersion, isHyvaCompatibilityPackage, and theme builder detection methods. This makes the code easier to read and debug. [1] [2] [3] [4]

Code Style and Standards:

  • Updated phpcs.xml.dist to enforce the full Magento2 coding standard without local exclusions. This ensures that the codebase adheres to the same standards as external package checkers, preventing hidden issues. The comment now recommends extracting sub-expressions into variables to avoid multi-line condition conflicts.

Copilot AI review requested due to automatic review settings July 4, 2026 16:58
@Morgy93 Morgy93 enabled auto-merge (squash) July 4, 2026 16:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors several conditional checks to improve readability across the theme builder and Hyvä scanning logic, and aligns local PHPCS rules with the plain upstream Magento2 standard to avoid mismatches with external package checkers.

Changes:

  • Simplifies theme builder detect() conditionals by extracting composer package name checks into a single variable.
  • Refactors Hyvä compatibility detection to use an intermediate boolean for clearer intent.
  • Updates phpcs.xml.dist to run the full Magento2 standard with no local exclusions and documents the formatter/PHPCS implication for multi-line conditions.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Service/ThemeBuilder/TailwindCSS/Builder.php Simplifies composer.json package-name conditional in detect() for non-Hyvä Tailwind themes.
src/Service/ThemeBuilder/HyvaThemes/Builder.php Simplifies composer.json package-name conditional in detect() for Hyvä themes.
src/Service/Hyva/ModuleScanner.php Extracts Hyvä compatibility package detection into a named boolean for readability.
src/Console/Command/System/CheckCommand.php Extracts the “is LTS release” check into a boolean to simplify the foreach condition.
phpcs.xml.dist Removes the local exclusion and documents why conditions should be kept single-line (via extracted sub-expressions).

@Morgy93 Morgy93 disabled auto-merge July 4, 2026 17:06
@Morgy93 Morgy93 merged commit 89bd44c into main Jul 4, 2026
19 checks passed
@Morgy93 Morgy93 deleted the fix-phpcs branch July 4, 2026 17:06
@github-actions github-actions Bot mentioned this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants