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

SA Checks: fromCallable #94

Merged
merged 2 commits into from
May 23, 2021
Merged

Conversation

AlexandruGG
Copy link
Collaborator

Continuing the static analysis checks, this PR adds fromCallable.

  • adding check
  • improving tests
  • improving type hints


-
message: "#^Return type \\(Iterator\\) of method loophp\\\\collection\\\\Collection\\:\\:getIterator\\(\\) should be covariant with return type \\(Iterator\\<mixed, mixed\\>\\) of method loophp\\\\collection\\\\Contract\\\\Collection\\<TKey,T\\>\\:\\:getIterator\\(\\)$#"
message: "#^Parameter \\#1 \\$callable of class loophp\\\\collection\\\\Collection constructor expects callable\\(\\.\\.\\.mixed\\)\\: iterable\\<int, string\\>, Closure\\(string, string\\)\\: loophp\\\\collection\\\\Iterator\\\\StringIterator\\<mixed, string\\> given\\.$#"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an issue with PHPStan, I've reported it here: phpstan/phpstan#5060

@AlexandruGG AlexandruGG marked this pull request as ready for review May 23, 2021 21:18
@drupol drupol enabled auto-merge (squash) May 23, 2021 21:22
Copy link
Collaborator

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super great ! Thanks !

@drupol drupol merged commit 999e3d9 into loophp:master May 23, 2021
@AlexandruGG AlexandruGG deleted the from-callable-check branch May 23, 2021 21:29
@AlexandruGG
Copy link
Collaborator Author

@drupol I just realised that in CI PHPStan doesn't run on the tests/static-analysis directory because it's ignored here: https://github.com/drupol/php-conventions/blob/master/config/php73/grumphp.yml#L85. I've been using it directly rather than via GrumPHP on my local so far and overlooked that.

How can we override that config for GrumPHP? Do we need to have a tasks.phpstan.ignore_patterns entry in the project's config where we list all paths again apart from the tests one?

@drupol
Copy link
Collaborator

drupol commented May 23, 2021

Yes that's it.

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