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
Closed

Allow Psalm to add missing parameter types #204

muglug opened this issue Aug 22, 2017 · 0 comments
Labels
enhancement hard problems Problems without an obvious easy solution

Comments

@muglug
Copy link
Collaborator

muglug 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);
  }
}
muglug added a commit that referenced this issue Sep 2, 2017
@muglug muglug added the hard problems Problems without an obvious easy solution label Jan 18, 2019
@muglug muglug closed this as completed in 194bb31 Feb 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement hard problems Problems without an obvious easy solution
Projects
None yet
Development

No branches or pull requests

1 participant