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

Add value helper extension #545

Merged
merged 1 commit into from
Apr 26, 2020
Merged

Conversation

Daanra
Copy link
Contributor

@Daanra Daanra commented Apr 26, 2020

Adds an extension for the value helper function such that the return type is correctly inferred.

The following will now be seen as invalid:

public function returnInt(): int
{
    return value('string'); // string and int mismatch
}

public function returnClosureInt(): int
{
   return value(function (): string {
       return 'string'; // string and int mismatch
  });
}

@canvural canvural merged commit c8fcebe into larastan:master Apr 26, 2020
@canvural
Copy link
Collaborator

Thank you!

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.

None yet

2 participants