-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Fix some issues of Psalm in level 6 #2327
Conversation
e58e089
to
60eaa3b
Compare
$bucket->getFilesCollection() | ||
->expects($this->any()) | ||
$filesCollection = $bucket->getFilesCollection(); | ||
assert($filesCollection instanceof Collection && $filesCollection instanceof MockObject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, $bucket
is a mock and getFilesCollection
returns also a mock, not sure how that can be expressed other than this or we can just ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this assert 👍
fadd532
to
08bdcdf
Compare
@@ -129,7 +129,10 @@ public function testClosureToPHP($input, $output) | |||
return $return; | |||
})($input); | |||
|
|||
$this->assertInstanceOf('DateTimeImmutable', $return); | |||
// @phpstan-ignore-next-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to ignore assert below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the eval
in the closure, phpstan says:
------ ------------------------------------------------------------------------------
Line tests/Doctrine/ODM/MongoDB/Tests/Types/DateImmutableTypeTest.php
------ ------------------------------------------------------------------------------
131 Call to function assert() with false will always evaluate to false.
131 Instanceof between null and DateTimeImmutable will always evaluate to false.
------ ------------------------------------------------------------------------------
I've been trying other ways, but none worked 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, indeed the eval makes things worse... thanks for explaining!
Thanks @franmomu! |
Summary
Right now we are using level 7 of psalm, I raised it locally to level 6 and this PR fixes some of the issues that I think they are easy to review and only in
tests
directory.The first commits are not SA related, just some polishing.
For the remaning ones I'll open another PR.