Skip to content

Fix 3271: Add a stub for PDOStatement#200

Closed
alexeyinkin wants to merge 1 commit intophpstan:masterfrom
alexeyinkin:bug3271_pdostatement-stub
Closed

Fix 3271: Add a stub for PDOStatement#200
alexeyinkin wants to merge 1 commit intophpstan:masterfrom
alexeyinkin:bug3271_pdostatement-stub

Conversation

@alexeyinkin
Copy link
Copy Markdown

No description provided.

* @link https://php.net/manual/en/class.pdostatement.php
*/
class PDOStatement implements Traversable {
//public function setFetchMode ($mode, $classNameObject = null, array $ctorarfg = array()) {}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Uncomment this, and you get ShouldNotHappenException.

@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you, merged it as: dfd3c63

The internal error is because one of the rules executed on stubs is MethodSignatureVarianceRule and it calls ParametersAcceptorSelector::selectSingle(). Because userland methods can only have one variant (there's no overloading), but built-in PHP methods like setFetchMode have multiple variants. Not sure if it's worth fixing. We'll have to do it once we will want to add a stub on a such a method but that will probably need more consideration for that case once it comes up.

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.

2 participants