Skip to content

Commit

Permalink
Fix array types in docblock.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Sep 1, 2022
1 parent eec6239 commit f94f24b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function getSchemaCollection(): SchemaCollectionInterface
*
* @param string $table the table to insert values in
* @param array $values values to be inserted
* @param array<string, string> $types list of associative array containing the types to be used for casting
* @param array<int|string, string> $types Array containing the types to be used for casting
* @return \Cake\Database\StatementInterface
*/
public function insert(string $table, array $values, array $types = []): StatementInterface
Expand All @@ -449,7 +449,7 @@ public function insert(string $table, array $values, array $types = []): Stateme
* @param string $table the table to update rows from
* @param array $values values to be updated
* @param array $conditions conditions to be set for update statement
* @param array $types list of associative array containing the types to be used for casting
* @param array<string> $types list of associative array containing the types to be used for casting
* @return \Cake\Database\StatementInterface
*/
public function update(string $table, array $values, array $conditions = [], array $types = []): StatementInterface
Expand All @@ -467,7 +467,7 @@ public function update(string $table, array $values, array $conditions = [], arr
*
* @param string $table the table to delete rows from
* @param array $conditions conditions to be set for delete statement
* @param array $types list of associative array containing the types to be used for casting
* @param array<string> $types list of associative array containing the types to be used for casting
* @return \Cake\Database\StatementInterface
*/
public function delete(string $table, array $conditions = [], array $types = []): StatementInterface
Expand Down
4 changes: 2 additions & 2 deletions Expression/QueryExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getConjunction(): string
* be added. When using an array and the key is 'OR' or 'AND' a new expression
* object will be created with that conjunction and internal array value passed
* as conditions.
* @param array<string, string> $types Associative array of fields pointing to the type of the
* @param array<int|string, string> $types Associative array of fields pointing to the type of the
* values that are being passed. Used for correctly binding values to statements.
* @see \Cake\Database\Query::where() for examples on conditions
* @return $this
Expand Down Expand Up @@ -702,7 +702,7 @@ public function hasNestedExpression(): bool
* representation is wrapped around an adequate instance or of this class.
*
* @param array $conditions list of conditions to be stored in this object
* @param array<string, string> $types list of types associated on fields referenced in $conditions
* @param array<int|string, string> $types list of types associated on fields referenced in $conditions
* @return void
*/
protected function _addConditions(array $conditions, array $types): void
Expand Down
2 changes: 1 addition & 1 deletion Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ public function unionAll($query, $overwrite = false)
* with Query::values().
*
* @param array $columns The columns to insert into.
* @param array<string, string> $types A map between columns & their datatypes.
* @param array<int|string, string> $types A map between columns & their datatypes.
* @return $this
* @throws \RuntimeException When there are 0 columns.
*/
Expand Down
22 changes: 11 additions & 11 deletions TypeMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@
class TypeMap
{
/**
* Associative array with the default fields and the related types this query might contain.
* Array with the default fields and the related types this query might contain.
*
* Used to avoid repetition when calling multiple functions inside this class that
* may require a custom type for a specific field.
*
* @var array<string, string>
* @var array<int|string, string>
*/
protected $_defaults = [];

/**
* Associative array with the fields and the related types that override defaults this query might contain
* Array with the fields and the related types that override defaults this query might contain
*
* Used to avoid repetition when calling multiple functions inside this class that
* may require a custom type for a specific field.
*
* @var array<string, string>
* @var array<int|string, string>
*/
protected $_types = [];

/**
* Creates an instance with the given defaults
*
* @param array<string, string> $defaults The defaults to use.
* @param array<int|string, string> $defaults The defaults to use.
*/
public function __construct(array $defaults = [])
{
Expand All @@ -69,7 +69,7 @@ public function __construct(array $defaults = [])
* This method will replace all the existing default mappings with the ones provided.
* To add into the mappings use `addDefaults()`.
*
* @param array<string, string> $defaults Associative array where keys are field names and values
* @param array<int|string, string> $defaults Array where keys are field names / positions and values
* are the correspondent type.
* @return $this
*/
Expand All @@ -83,7 +83,7 @@ public function setDefaults(array $defaults)
/**
* Returns the currently configured types.
*
* @return array<string, string>
* @return array<int|string, string>
*/
public function getDefaults(): array
{
Expand All @@ -95,7 +95,7 @@ public function getDefaults(): array
*
* If a key already exists it will not be overwritten.
*
* @param array<string, string> $types The additional types to add.
* @param array<int|string, string> $types The additional types to add.
* @return void
*/
public function addDefaults(array $types): void
Expand All @@ -114,7 +114,7 @@ public function addDefaults(array $types): void
*
* This method will replace all the existing type maps with the ones provided.
*
* @param array<string, string> $types Associative array where keys are field names and values
* @param array<int|string, string> $types Array where keys are field names / positions and values
* are the correspondent type.
* @return $this
*/
Expand All @@ -128,7 +128,7 @@ public function setTypes(array $types)
/**
* Gets a map of fields and their associated types for single-use.
*
* @return array<string, string>
* @return array<int|string, string>
*/
public function getTypes(): array
{
Expand All @@ -151,7 +151,7 @@ public function type($column): ?string
/**
* Returns an array of all types mapped types
*
* @return array<string, string>
* @return array<int|string, string>
*/
public function toArray(): array
{
Expand Down
4 changes: 2 additions & 2 deletions TypeMapTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getTypeMap(): TypeMap
* To add a default without overwriting existing ones
* use `getTypeMap()->addDefaults()`
*
* @param array<string, string> $types The array of types to set.
* @param array<int|string, string> $types The array of types to set.
* @return $this
* @see \Cake\Database\TypeMap::setDefaults()
*/
Expand All @@ -80,7 +80,7 @@ public function setDefaultTypes(array $types)
/**
* Gets default types of current type map.
*
* @return array<string, string>
* @return array<int|string, string>
*/
public function getDefaultTypes(): array
{
Expand Down

0 comments on commit f94f24b

Please sign in to comment.