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

Nullable non-empty-string is coerced as nullable string #9

Open
EmilMassey opened this issue Sep 21, 2022 · 0 comments
Open

Nullable non-empty-string is coerced as nullable string #9

EmilMassey opened this issue Sep 21, 2022 · 0 comments

Comments

@EmilMassey
Copy link

EmilMassey commented Sep 21, 2022

I'm unable to use shape with nullable non-empty-string (as well as union(null(), non_empty_string()). I'm not sure if the issue is in the extension or in the phpstan itself.

/** @param array{foo: non-empty-string, bar: non-empty-string|null} $arr */
function test(array $arr) {}

$arr = shape([
  'foo' => non_empty_string(),
  'bar' => nullable(non_empty_string()),
])->coerce($input);

test($arr);

Expects: array{foo: non-empty-string, bar: non-empty-string|null}, array{foo: non-empty-string, bar: string|null}. given

@EmilMassey EmilMassey changed the title Nullable non-empty-string is asserted as nullable string Nullable non-empty-string is coerced as nullable string Sep 21, 2022
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