Fix conditional checks for meta and link tags#15
Conversation
If the meta_tags or link_tags keys do not exist, an empty array will be returned by default. However, if a null value is stored, the following foreach loop will generate an error. Bonus: inside the following two foreach loops, the parentheses were not correctly placed, I have fixed it.
WalkthroughPlugin.php is refactored to fix operator precedence bugs in conditional checks for meta and link tags iteration, and default fallback patterns are standardized using Elvis coalescing to empty arrays for safer defaults. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)Plugin.php (2)
🔇 Additional comments (3)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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 |
|
Thanks for the PR @Quendi6, apologies for the delay; I missed this in my notifications. |
If the meta_tags or link_tags keys do not exist, an empty array will be returned by default. However, if a null value is stored, the following foreach loop will generate an error.
Bonus: inside the following two foreach loops, the parentheses were not correctly placed, I have fixed it.
This fix is necessary because, without it, it is impossible to save plugin settings without adding at least one meta tag AND one link tag, which is not always what we want to do.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.