phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Fixed incorrect return type of PDO::quote()

Open rasmus0201 opened this issue 1 year ago • 3 comments

Fixes https://github.com/phpstan/phpstan/issues/10512

rasmus0201 avatar Feb 20 '24 08:02 rasmus0201

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

phpstan-bot avatar Feb 20 '24 08:02 phpstan-bot

Friendly ping @ondrejmirtes you might have missed this "easy" PR to review or do you also want a non-regression test for such changes ?

VincentLanglet avatar Aug 10 '24 23:08 VincentLanglet

I didn't merge this yet because I'm not sure about this change.

The documentation states:

Returns false if the driver does not support quoting in this way.

So a benevolent union type might be the better choice here - __benevolent<string|false>.

Also the usage of this function at all is not recommended in favor of prepared statements.

That's why I didn't rush to merge this.

ondrejmirtes avatar Aug 11 '24 05:08 ondrejmirtes