[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

fix: improve PHPDoc for find method of QueryBuilder to support FETCH_ASSOC #2081

Merged

Conversation

kayw-geek
Copy link
Contributor
@kayw-geek kayw-geek commented Oct 21, 2024

The current PHPDoc for the find() method declares the return type as object|null.

This likely stems from Laravel’s default fetchMode for the Database\Connection property being set to PDO::FETCH_OBJ. However, when users customize the Connection to use PDO::FETCH_ASSOC, this can result in numerous errors, as the return type differs.

My attempt to override Larastan’s stub with a custom file was unsuccessful because PHPStan does not support overriding stub files.

This limitation highlights the need for a more flexible solution to accommodate different fetch modes without causing type-related errors.

@kayw-geek kayw-geek force-pushed the feature/improve-phpdoc-for-db-find branch 3 times, most recently from 322acce to b730e7b Compare October 24, 2024 07:25
@kayw-geek kayw-geek force-pushed the feature/improve-phpdoc-for-db-find branch from b730e7b to 0b1a17e Compare October 24, 2024 08:00
@canvural canvural changed the title Improve PHPDoc for find method of QueryBuilder to support FETCH_ASSOC fix: improve PHPDoc for find method of QueryBuilder to support FETCH_ASSOC Nov 2, 2024
@canvural canvural merged commit bd01df5 into larastan:2.x Nov 2, 2024
33 of 35 checks passed
@canvural
Copy link
Collaborator
canvural commented Nov 2, 2024

Thank you! It was mixed before actually 😅 And was recently changed to object and I knew we had a reason to have mixed but forgot it. Makes sense now 👍🏽

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.

3 participants