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

PDO: Added PDO::FETCH_CLASS support on fetch*(), fetchObject() #304

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

staabm
Copy link
Owner

@staabm staabm commented Feb 19, 2022

refs #269

@staabm
Copy link
Owner Author

staabm commented Feb 19, 2022

@Seldaek could you double check this one matches your expectations? just verifying the test-expectations would be enough for now.

Comment on lines +47 to +48
$all = $stmt->fetchAll(PDO::FETCH_CLASS);
assertType('array<int, stdClass>', $all);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks all good to me, but just to make sure, a simple fetch() here would return stdClass|false, right? Might be worth adding for completeness.

Copy link
Owner Author

Choose a reason for hiding this comment

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

fetch() without args depends on a previous setFetchMode(), which needs #258 and which in turn waits for the next phpstan release

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I see, great to see it all coming together :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

The tricky part was figuring out how this stateful apis can work in phpstan context.

I don't know any extension which did this before, so this is kind of an achievement

@staabm staabm merged commit 29dddd0 into main Feb 19, 2022
@staabm staabm deleted the pdo-class branch February 19, 2022 09:10
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

3 participants