-
-
Notifications
You must be signed in to change notification settings - Fork 20
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 type when using \PDO::FETCH_OBJ on iteration #751
Conversation
@@ -32,7 +32,7 @@ public function supportedFetchTypes(PDO $pdo) | |||
|
|||
$stmt = $pdo->query('SELECT email, adaid FROM ada', PDO::FETCH_OBJ); | |||
foreach ($stmt as $row) { | |||
assertType('array<int, stdClass>', $row); | |||
assertType('object{email: string, adaid: int<-32768, 32767>}&stdClass', $row); |
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.
@AllenJB does this look better/correct for you?
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.
Looks good to me. Thanks! 👍
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.
@AllenJB could you please fill another issue with your feature request regarding "how can I put a type onto a result-object" and your concrete use-case/example?
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 assume you're referring to phpstan/phpstan#9120
Did you just want me to repost that as a request on the phpstan-dba project? Or is there some information that's missing from there?
Did you see my latest comment with the reproducer repo I set up (which I've just updated for these changes)? And the related request for help I linked to on the phpstan project discussions? (Not sure how much the last will help you - it's just my current line of thinking on how to implement something that solves fetch mode handling well-enough to get back to at least what I had with the PDOStatement stub override under PHPStan 1)
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 see, lets discuss in the already open discussion
closes #748