fzaninotto / Faker

Faker is a PHP library that generates fake data for you
MIT License
26.79k stars 3.59k forks source link

Update optional() in readme to use v2 weight #2068

Open patrickdaze opened 4 years ago

patrickdaze commented 4 years ago

Update documentation for optional() to use the new weight system (percent 0 to 100 instead of float 0 to 1).

optional() source code


πŸ™ Possible to add hacktoberfest-accepted label to this PR? (Details)

codecov-io commented 4 years ago

Codecov Report

Merging #2068 into master will decrease coverage by 0.26%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2068      +/-   ##
============================================
- Coverage     56.56%   56.30%   -0.27%     
  Complexity     2068     2068              
============================================
  Files           306      306              
  Lines          4849     4849              
============================================
- Hits           2743     2730      -13     
- Misses         2106     2119      +13     
Impacted Files Coverage Ξ” Complexity Ξ”
src/Faker/Provider/de_DE/Person.php 0.00% <0.00%> (-100.00%) 1.00% <0.00%> (ΓΈ%)
src/Faker/Provider/ne_NP/Person.php 0.00% <0.00%> (-50.00%) 2.00% <0.00%> (ΓΈ%)
src/Faker/Provider/id_ID/Company.php 50.00% <0.00%> (-50.00%) 2.00% <0.00%> (ΓΈ%)
src/Faker/Provider/en_UG/Person.php 40.00% <0.00%> (-40.00%) 5.00% <0.00%> (ΓΈ%)
src/Faker/Provider/ko_KR/Address.php 60.00% <0.00%> (-40.00%) 5.00% <0.00%> (ΓΈ%)
src/Faker/Provider/en_HK/Address.php 33.33% <0.00%> (-33.34%) 9.00% <0.00%> (ΓΈ%)
src/Faker/Provider/sr_RS/Address.php 66.66% <0.00%> (-33.34%) 3.00% <0.00%> (ΓΈ%)
src/Faker/Provider/ka_GE/Address.php 57.14% <0.00%> (-28.58%) 7.00% <0.00%> (ΓΈ%)
src/Faker/Provider/es_ES/Person.php 75.00% <0.00%> (-25.00%) 3.00% <0.00%> (ΓΈ%)
src/Faker/Provider/en_ZA/Address.php 50.00% <0.00%> (-25.00%) 4.00% <0.00%> (ΓΈ%)
... and 45 more

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 5337ce5...5278dbb. Read the comment docs.

pimjansen commented 4 years ago

I dont really see an actual usecase for this where the float is valid as well?

patrickdaze commented 4 years ago

I assume it's still there for backwards compatibility.

This PR doesn't change functionality. It only updates the README based on the new system. Maybe I can open a separate PR for Faker v2 because it would be a breaking change? It would basically take care of the TODO in the optional() function.