Skip to content

Conversation

@lorenzolosa
Copy link

The country() and countries() helpers' return types depend on the value of the $hydrate parameter: in particular, country() might return either an array or a Country instance. This is a problem for static analysis tools like PHPStan, that are unable to correctly determine the return type.

This PR improves the return type annotations to conditionally determine the return type based on the the value of the parameter.

This is based on PHPStan syntax. Alternatively, if you prefer not to change the @return annotation, it is possible to add this as @phpstan-return annotation.

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

Successfully merging this pull request may close these issues.

1 participant