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

Allow Psalm to add missing parameter types #204

Closed
muglug opened this issue Aug 22, 2017 · 0 comments

Comments

@muglug
Copy link
Member

commented Aug 22, 2017

Given the following code:

function takesString(string $s) : void {}

function shouldTakeString($s) : void {
  takesString($s);
}

with --add-missing-param-types, Psalm would return

function takesString(string $s) : void {}

function shouldTakeString(string $s) : void {
  takesString($s);
}

In this way we could approximate Hindley-Milner type inference, while improving the underlying PHP code.

It would do nothing with this input:

function takesString(string $s) : void {}

function shouldTakeString($s) : void {
  if (is_string($s)) {
    takesString($s);
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.