Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Bartel-C8 opened this issue Apr 5, 2024 · 1 comment
Open

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

Bartel-C8 opened this issue Apr 5, 2024 · 1 comment

Comments

@Bartel-C8
Copy link

Bartel-C8 commented Apr 5, 2024

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
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants