php-school / cli-menu

🖥 Build beautiful PHP CLI menus. Simple yet Powerful. Expressive DSL.
http://www.phpschool.io
MIT License
1.94k stars 107 forks source link

Accept any callable as argument for addSubMenu and addSplitItem in CliMenuBuilder #275

Closed simonorono closed 1 year ago

simonorono commented 1 year ago

While working on a personal project I was structuring all actions to be callable objects (using the __invoke method) and stumbled upon the addSubMenu method not accepting them as a callback. This PR modifies the argument type so it accepts any callable as defined here

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (0cdb162) 93.46% compared to head (ea2986a) 93.46%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #275 +/- ## ========================================= Coverage 93.46% 93.46% Complexity 656 656 ========================================= Files 38 38 Lines 2021 2021 ========================================= Hits 1889 1889 Misses 132 132 ``` | [Files Changed](https://app.codecov.io/gh/php-school/cli-menu/pull/275?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=php-school) | Coverage Δ | | |---|---|---| | [src/Builder/CliMenuBuilder.php](https://app.codecov.io/gh/php-school/cli-menu/pull/275?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=php-school#diff-c3JjL0J1aWxkZXIvQ2xpTWVudUJ1aWxkZXIucGhw) | `76.07% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

AydinHassan commented 1 year ago

Nice thanks, do you think you could also update addSplitItem in the same manner?

simonorono commented 1 year ago

Nice thanks, do you think you could also update addSplitItem in the same manner?

Just did it.

AydinHassan commented 1 year ago

Thanks @simonorono !