rafaelwendel / phpsupabase

PHP Client to use Supabase
MIT License
187 stars 17 forks source link

Documentation "bug": Optional parameters + type order #33

Closed Bartel-C8 closed 1 month ago

Bartel-C8 commented 5 months ago

I got warnings in my code base when using library functions with optional parameters, when using e.g. initializeDatabase.

Argument '2' passed to initializeDatabase() is expected to be of type PHPSupabase\optional, string given PHP(PHP0406)

https://github.com/rafaelwendel/phpsupabase/blob/main/src/Service.php#L160

Documentation : https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/param.html

In my case (VSCODE + DEVSENSE PHP extension) I got errors, as it parses the first word after the variable as the type. Which is Optional int this case.

And as I see now, the documented way of PHPDoc is even:

@param [<Type>] [name] [<description>]

And in this lib,

@param [name] [] [(optional)] []

is used mostly...

With also String needs to be a lower case string.

Or do you use another method/library for documentation?

Thanks!

rafaelwendel commented 3 months ago

Hello @Bartel-C8

You're absolutely right. I made a mistake when creating the tag annotations. I am already providing the correction for the next version.

Thank you for your contribution!

rafaelwendel commented 1 month ago

Set on 0.0.8 version