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

Stub generation of optional arguments doesn't set default value to NULL #305

Open
pprkut opened this issue Dec 19, 2023 · 0 comments
Open

Comments

@pprkut
Copy link

pprkut commented Dec 19, 2023

Given a function like this:

#[php_function()]
pub fn foo(a: String, b: Option<bool>) -> PhpResult<Zval> {
    ...
}

The generated stub looks like this:

namespace {
    function foo(string $a, ?bool $b): mixed {}
}

However, this is not reflecting the truth, as $b here is just documented as nullable, but must be specified, whereas in reality it's optional. The stub should therefore be

namespace {
    function foo(string $a, ?bool $b = null): mixed {}
}
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

1 participant