fix: guard downloads assets without WooCommerce#34
Conversation
📝 WalkthroughWalkthrough
ChangesWooCommerce Guard Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.2.2)PHPStan was skipped because the config uses disallowed Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
composer.json (1)
25-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer
@phpin Composer scripts.Using
@phpkeeps these tests on the same interpreter Composer is using and is more portable than hardcodingphp.Proposed change
"test": [ - "php tests/downloads-page-woocommerce-guard-regression.php", - "php tests/product-versions-remote-download-regression.php" + "`@php` tests/downloads-page-woocommerce-guard-regression.php", + "`@php` tests/product-versions-remote-download-regression.php" ]🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@composer.json` around lines 25 - 28, The Composer test script currently hardcodes php, which can use a different interpreter than Composer itself. Update the test entries in the scripts section of composer.json to invoke the regression scripts through `@php` so they run with the same PHP binary Composer is using; keep the existing test commands and only swap the executable reference in the test script list.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@composer.json`:
- Around line 25-28: The Composer test script currently hardcodes php, which can
use a different interpreter than Composer itself. Update the test entries in the
scripts section of composer.json to invoke the regression scripts through `@php`
so they run with the same PHP binary Composer is using; keep the existing test
commands and only swap the executable reference in the test script list.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fe0f2653-710d-480c-8960-1a8b032dd7d6
📒 Files selected for processing (3)
composer.jsoninc/class-downloads-page.phptests/downloads-page-woocommerce-guard-regression.php
Summary
is_account_page()helper is unavailable.\is_account_page()after the availability guard.Downloads_Pagewithout WooCommerce helpers and verifiesenqueue_assets()returns without fataling.Verification
composer testphp -l inc/class-downloads-page.phpphp -l tests/downloads-page-woocommerce-guard-regression.phpaidevops.sh v3.29.11 plugin for OpenCode v1.17.11 with gpt-5.5
Summary by CodeRabbit
Bug Fixes
Tests