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

Nested shapes loses non-empty-string #16

Open
bendavies opened this issue Feb 22, 2024 · 3 comments
Open

Nested shapes loses non-empty-string #16

bendavies opened this issue Feb 22, 2024 · 3 comments

Comments

@bendavies
Copy link

Hi,

The following works:

$payload = Type\shape([
  'repository' => Type\non_empty_string(),
])->coerce($payload);

PHPStan\dumpType($payload);

dumps

 Dumped type: array{repository: non-empty-string}

however, the non_empty_string is lost if nested:

$payload = Type\shape([
    'repository' => Type\non_empty_vec(
        Type\shape([
            'name' => Type\non_empty_string(),
        ]),
    ),
])->coerce($payload);

\PHPStan\dumpType($payload);

dumps

Dumped type: array{repository: non-empty-list<array{name: string}>}
@bendavies bendavies changed the title Nested shapes loses `non-empty-string Nested shapes loses non-empty-string Feb 22, 2024
@ondrejmirtes
Copy link
Collaborator

What about with bleeding edge?

@bendavies
Copy link
Author

yes, bleeding edge is on.

@jrmajor
Copy link

jrmajor commented Apr 2, 2024

Here's a failing test case, feel free to cherry pick it: 00d0cdc.

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

3 participants