lstrojny / functional-php

Primitives for functional programming in PHP
MIT License
1.98k stars 204 forks source link

Add `ary` function which ignores arguments over the supplied number #215

Closed someonewithpc closed 4 years ago

someonewithpc commented 4 years ago

Added function which defines a function of an arbitry number of arguments and calls the provided callable with only the given number of arguments

Didn't add tests as it wasn't obvious how they worked and wanted feedback before investing the time

lstrojny commented 4 years ago

In lodash this function is called ary(https://lodash.com/docs/4.17.15#ary). What do you think?

someonewithpc commented 4 years ago

Maybe arity(callable, int): callable, then?

lstrojny commented 4 years ago

I would just follow lodash‘s naming precedence

someonewithpc commented 4 years ago

@lstrojny Renamed the function and added tests (the build fail seems to be unrelated and fixed by my other PR)

lstrojny commented 4 years ago

Care to document the function in the docs as well?

someonewithpc commented 4 years ago

@lstrojny added documentation to the tests commit.

lstrojny commented 4 years ago

Great, thank you!

One last thing, can you check https://travis-ci.org/github/lstrojny/functional-php/jobs/691301121 and fix the coding style errors, then we are ready to merge this

someonewithpc commented 4 years ago

How does it check those? I ran php-cs-fixer (from vendor/bin) and it didn't fiz it

lstrojny commented 4 years ago

How does it check those? I ran php-cs-fixer (from vendor/bin) and it didn't fiz it

That PHP code sniffer. Run phpcs to see the errors.

someonewithpc commented 4 years ago

Ok, should be ready to merge, now

lstrojny commented 4 years ago

Great, thank you!