Skip to content

Invalid narrowed type after coerce/assert #19

Description

@p4veI

Hello, after upgrading to php-standard-library/phpstan-extension v1.1.0 I'm getting an invalid resolved type for array shapes narrowed by the psl type coerce/assert methods.

E.g.:

$type = shape([
  'name' => iterable(
    int(),
    shape([
      'id' => string(),
      ...
    ])
  )
]);

$data = $type->coerce($someMixedArray);

Then using PHPStan\dumpType I'm getting e.g. Dumped type: array{name?: mixed};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions