folkloreinc / laravel-graphql

Facebook GraphQL for Laravel 5. It supports Relay, eloquent models, validation and GraphiQL.
1.76k stars 234 forks source link

Fix 'func_get_args()' occurrences #240

Open pschaub opened 6 years ago

pschaub commented 6 years ago

There are a few functions that are using "func_get_args()". We should not use it. Code lines: https://github.com/Folkloreatelier/laravel-graphql/search?utf8=%E2%9C%93&q=func_get_args&type=

Instead we should use the new "..." (triple dots) language feature which is included since PHP 5.6, see http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list

Reasons:

  1. For example the function rules() has function arguments but the developer does not see that there are function arguments. With the "..." token the developer will see that he can use function arguments there.

  2. Here is an example where developers didn't know that there are function parameters hidden through "func_get_args()": https://github.com/Folkloreatelier/laravel-graphql/issues/47

  3. The code will be cleaner and smaller with "..." tokens instead of "func_get_args()"

pschaub commented 6 years ago

Note: This improvement is only possible with PHP 5.6+. The current library supports PHP 5.5.9+.