Skip to content

Commit

Permalink
Merge pull request #4433 from morozov/more-specific-statement-params-…
Browse files Browse the repository at this point in the history
…type

Require positional statement parameters to be a list
  • Loading branch information
morozov authored Nov 15, 2020
2 parents ede9e16 + 41ff58d commit ee6d126
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Cache/QueryCacheProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getCacheKey()
* Generates the real cache key from query, params, types and connection parameters.
*
* @param string $sql
* @param array<int, mixed>|array<string, mixed> $params
* @param list<mixed>|array<string, mixed> $params
* @param array<int, Type|int|string|null>|array<string, Type|int|string|null> $types
* @param array<string, mixed> $connectionParams
*
Expand Down
36 changes: 18 additions & 18 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public function setAutoCommit($autoCommit)
* as an associative array.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return array<string, mixed>|false False is returned if no rows are found.
Expand All @@ -489,7 +489,7 @@ public function fetchAssociative(string $query, array $params = [], array $types
* as a numerically indexed array.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return list< mixed>|false False is returned if no rows are found.
Expand All @@ -510,7 +510,7 @@ public function fetchNumeric(string $query, array $params = [], array $types = [
* of the first row of the result.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return mixed|false False is returned if no rows are found.
Expand Down Expand Up @@ -778,7 +778,7 @@ public function quote($value, $type = ParameterType::STRING)
* Prepares and executes an SQL query and returns the result as an array of numeric arrays.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return list<list<mixed>>
Expand All @@ -798,7 +798,7 @@ public function fetchAllNumeric(string $query, array $params = [], array $types
* Prepares and executes an SQL query and returns the result as an array of associative arrays.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return list<array<string,mixed>>
Expand All @@ -819,7 +819,7 @@ public function fetchAllAssociative(string $query, array $params = [], array $ty
* mapped to the first column and the values mapped to the second column.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return array<mixed,mixed>
Expand All @@ -837,7 +837,7 @@ public function fetchAllKeyValue(string $query, array $params = [], array $types
* and their values.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string>|array<string, int|string> $types Parameter types
*
* @return array<mixed,array<string,mixed>>
Expand All @@ -853,7 +853,7 @@ public function fetchAllAssociativeIndexed(string $query, array $params = [], ar
* Prepares and executes an SQL query and returns the result as an array of the first column values.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return list<mixed>
Expand All @@ -873,7 +873,7 @@ public function fetchFirstColumn(string $query, array $params = [], array $types
* Prepares and executes an SQL query and returns the result as an iterator over rows represented as numeric arrays.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return Traversable<int,list<mixed>>
Expand All @@ -898,7 +898,7 @@ public function iterateNumeric(string $query, array $params = [], array $types =
* as associative arrays.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return Traversable<int,array<string,mixed>>
Expand All @@ -923,7 +923,7 @@ public function iterateAssociative(string $query, array $params = [], array $typ
* mapped to the first column and the values mapped to the second column.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return Traversable<mixed,mixed>
Expand All @@ -941,7 +941,7 @@ public function iterateKeyValue(string $query, array $params = [], array $types
* and their values.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string>|array<string, int|string> $types Parameter types
*
* @return Traversable<mixed,array<string,mixed>>
Expand All @@ -957,7 +957,7 @@ public function iterateAssociativeIndexed(string $query, array $params = [], arr
* Prepares and executes an SQL query and returns the result as an iterator over the first column values.
*
* @param string $query SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return Traversable<int,mixed>
Expand Down Expand Up @@ -996,7 +996,7 @@ public function prepare(string $sql): Statement
* If an SQLLogger is configured, the execution is logged.
*
* @param string $sql SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @throws Exception
Expand Down Expand Up @@ -1049,7 +1049,7 @@ public function executeQuery(
* Executes a caching query.
*
* @param string $sql SQL query
* @param array<int, mixed>|array<string, mixed> $params Query parameters
* @param list<mixed>|array<string, mixed> $params Query parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @throws CacheException
Expand Down Expand Up @@ -1106,7 +1106,7 @@ public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp)
* This method supports PDO binding types as well as DBAL mapping types.
*
* @param string $sql SQL statement
* @param array<int, mixed>|array<string, mixed> $params Statement parameters
* @param list<mixed>|array<string, mixed> $params Statement parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return int The number of affected rows.
Expand Down Expand Up @@ -1580,7 +1580,7 @@ public function convertToPHPValue($value, $type)
* or DBAL mapping type, to a given statement.
*
* @param DriverStatement $stmt Prepared statement
* @param array<int, mixed>|array<string, mixed> $params Statement parameters
* @param list<mixed>|array<string, mixed> $params Statement parameters
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @throws Exception
Expand Down Expand Up @@ -1655,7 +1655,7 @@ public function createQueryBuilder()
/**
* @internal
*
* @param array<int, mixed>|array<string, mixed> $params
* @param list<mixed>|array<string, mixed> $params
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
*/
final public function convertExceptionDuringQuery(
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/SQLLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface SQLLogger
* Logs a SQL statement somewhere.
*
* @param string $sql SQL statement
* @param array<int, mixed>|array<string, mixed>|null $params Statement parameters
* @param list<mixed>|array<string, mixed>|null $params Statement parameters
* @param array<int, Type|int|string|null>|array<string, Type|int|string|null>|null $types Parameter types
*
* @return void
Expand Down
6 changes: 3 additions & 3 deletions src/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class QueryBuilder
/**
* The query parameters.
*
* @var array<int, mixed>|array<string, mixed>
* @var list<mixed>|array<string, mixed>
*/
private $params = [];

Expand Down Expand Up @@ -298,7 +298,7 @@ public function setParameter($key, $value, $type = null)
* ));
* </code>
*
* @param array<int, mixed>|array<string, mixed> $params Parameters to set
* @param list<mixed>|array<string, mixed> $params Parameters to set
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
*
* @return $this This QueryBuilder instance.
Expand All @@ -314,7 +314,7 @@ public function setParameters(array $params, array $types = [])
/**
* Gets all defined query parameters for the query being constructed indexed by parameter index or name.
*
* @return array<int, mixed>|array<string, mixed> The currently defined query parameters
* @return list<mixed>|array<string, mixed> The currently defined query parameters
*/
public function getParameters()
{
Expand Down

0 comments on commit ee6d126

Please sign in to comment.