Skip to content

Add default true to bool toggle methods in Alert, Dropdown, and… - #125

Open
WarLikeLaux wants to merge 3 commits into
yiisoft:masterfrom
WarLikeLaux:fix-bool-toggle-default-consistency
Open

Add default true to bool toggle methods in Alert, Dropdown, and…#125
WarLikeLaux wants to merge 3 commits into
yiisoft:masterfrom
WarLikeLaux:fix-bool-toggle-default-consistency

Conversation

@WarLikeLaux

Copy link
Copy Markdown
Contributor
Q A
Is bugfix?
New feature?
Docs added?
Tests added? ✔️
Breaks BC?
Fixed issues

What does this PR do?

Add default true to bool toggle methods for consistency. Alert::headerContainer() already had = true, but bodyContainer(), Dropdown::container(), itemContainer(), Menu::activateItems(), container(), and itemsContainer() did not.

Tests verify that calling these methods without an argument produces the same result as calling with true, preventing accidental removal of the default.

No BC break: adding a default value to an existing parameter is backward compatible.

Coverage

File Lines
Alert.php 139/139 (100%)
Dropdown.php 210/210 (100%)
Menu.php 193/193 (100%)

@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a602b53) to head (0529203).

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #125   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       316       316           
===========================================
  Files              8         8           
  Lines           1005      1005           
===========================================
  Hits            1005      1005           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

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 improves API consistency across the widget fluent setters by making several boolean “toggle” methods default to true, aligning them with existing behavior (e.g., Alert::headerContainer()), and adding regression tests to ensure the no-argument call matches explicitly passing true.

Changes:

  • Add = true default values to boolean toggle methods in Alert, Dropdown, and Menu.
  • Add unit tests verifying method() renders identically to method(true) for the updated toggles.
  • Document the enhancement in the changelog.

Reviewed changes

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

Show a summary per file
File Description
src/Alert.php Adds default true to bodyContainer(bool $value = true).
src/Dropdown.php Adds default true to container() and itemContainer().
src/Menu.php Adds default true to activateItems(), container(), and itemsContainer().
tests/Alert/AlertTest.php Adds a test asserting bodyContainer() equals bodyContainer(true) output.
tests/Dropdown/DropdownTest.php Adds tests asserting container()/itemContainer() equal their (...true) equivalents.
tests/Menu/MenuTest.php Adds tests asserting activateItems()/container()/itemsContainer() equal their (...true) equivalents.
CHANGELOG.md Adds entry for enhancement #125.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vjik
vjik requested a review from samdark May 31, 2026 09:58
@vjik vjik added the status:code review The pull request needs review. label May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants