-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Update PDO parameter names #6272
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
Conversation
ext/pdo/pdo_stmt.stub.php
Outdated
|
||
/** @return bool */ | ||
public function bindParam(string|int $param, mixed &$bind_var, int $type = PDO::PARAM_STR, int $max_length = 0, mixed $driver_options = null) {} | ||
public function bindParam(string|int $param, mixed &$var, int $type = PDO::PARAM_STR, int $max_length = 0, mixed $driverOptions = null) {} |
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.
You changed $driverOptions
to $options
in PDO::prepate()
. is there any difference between the two use-cases?
(there is one one $max_length
here)
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.
For PDO::prepare(), the documentation says this:
This array holds one or more key=>value pairs to set attribute values for the PDOStatement object that this method returns. You would most commonly use this to set the PDO::ATTR_CURSOR value to PDO::CURSOR_SCROLL to request a scrollable cursor. Some drivers have driver-specific options that may be set at prepare-time.
So it seems that at least some of the supported options are generic PDO options, not driver-specific ones.
For $driverOptions
on these APIs, it seems like the parameter is effectively unused. This sets the driver_params fields, but it is never actually used anywhere.
|
||
/** @return array */ | ||
public function fetchAll(int $mode = PDO::FETCH_BOTH, mixed ...$args) {} | ||
|
||
/** @return mixed */ | ||
public function fetchColumn(int $index = 0) {} | ||
public function fetchColumn(int $column = 0) {} |
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 wonder if we should update ext/mysqli $index usage to $column as well (e.g.
php-src/ext/mysqli/mysqli.stub.php
Line 340 in faea5ab
public function fetch_field_direct(int $index) {} |
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 have no idea what the best course of action would be :(
|
||
/** @return mixed */ | ||
public function fetchObject(?string $class = "stdClass", ?array $constructor_args = null) {} | ||
public function fetchObject(?string $class = "stdClass", ?array $ctorArgs = null) {} |
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.
Is there a reason why this can't be $constructorArgs
?
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.
It could also be a $constructorArgs. I prefer the shorter version a bit, but don't insist on it :)
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.
IMHO args
is a quite common abbreviation but ctor
is much less common. I'd prefer $constructorArgs
Second pass for PDO parameter name updates.
&$var
.$column
instead of$index
. We have cases (both in PDO and other exts) where columns can also be given as strings.