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

feat(password): Make password having custom length #235

Closed samijnih closed 4 years ago

samijnih commented 4 years ago

Why

Hello :)

I'm currently using your api to make a php cli menu for my app. I've been facing a problem when I wanted to make a user registration area.

So the aim of my pull request is to allow developers like me to call a setter in order to give another length. Of course, I made it backward-compatible so the previous value is a default value if the new method is not called.

Description

codecov-io commented 4 years ago

Codecov Report

Merging #235 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #235      +/-   ##
============================================
+ Coverage     92.86%   92.87%   +<.01%     
- Complexity      622      623       +1     
============================================
  Files            37       37              
  Lines          1864     1866       +2     
============================================
+ Hits           1731     1733       +2     
  Misses          133      133
Impacted Files Coverage Δ Complexity Δ
src/Input/Password.php 100% <100%> (ø) 15 <1> (+1) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1acf6fc...6f30f2d. Read the comment docs.

AydinHassan commented 4 years ago

Looks good to me! Only one thing, adding the method setValidator to the interface would be a BC break so I'm not sure we want to do that.

samijnih commented 4 years ago

Looks good to me! Only one thing, adding the method setValidator to the interface would be a BC break so I'm not sure we want to do that.

Hey :)

Are you sure about that? because there are only 3 classes which implement the Input interface:

There are all located in namespace PhpSchool\CliMenu\Input.

Also, even if people have extended these classes, the setValidator is already public and inside all the classes. I don't see how it could make a breaking change. May you give me more details? :)

AydinHassan commented 4 years ago

hey @samijnih if any body is implementing the interface to create their own inputs they might not have the setValidator method. If we add the method to the interface then their custom inputs will break.

samijnih commented 4 years ago

hey @samijnih if any body is implementing the interface to create their own inputs they might not have the setValidator method. If we add the method to the interface then their custom inputs will break.

You're right, I'm gonna update it

AydinHassan commented 4 years ago

thank you @samijnih !

samijnih commented 4 years ago

You're welcome!