Skip to content

Commit 435da9b

Browse files
committed
Add literal string types for insert, update and delete methods
1 parent 334f2ec commit 435da9b

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

stubs/DBAL/Connection.stub

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,49 @@ class Connection
7474
*/
7575
public function transactional(Closure $func);
7676

77+
/**
78+
* Executes an SQL DELETE statement on a table.
79+
*
80+
* Table expression and columns are not escaped and are not safe for user-input.
81+
*
82+
* @param __doctrine-literal-string $table Table name
83+
* @param array<__doctrine-literal-string, mixed> $criteria Deletion criteria
84+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
85+
*
86+
* @return int|string The number of affected rows.
87+
*
88+
* @throws Exception
89+
*/
90+
public function delete($table, array $criteria, array $types = []);
91+
92+
/**
93+
* Executes an SQL UPDATE statement on a table.
94+
*
95+
* Table expression and columns are not escaped and are not safe for user-input.
96+
*
97+
* @param __doctrine-literal-string $table Table name
98+
* @param array<__doctrine-literal-string, mixed> $data Column-value pairs
99+
* @param array<__doctrine-literal-string, mixed> $criteria Update criteria
100+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
101+
*
102+
* @return int|string The number of affected rows.
103+
*
104+
* @throws Exception
105+
*/
106+
public function update($table, array $data, array $criteria, array $types = []);
107+
108+
/**
109+
* Inserts a table row with specified data.
110+
*
111+
* Table expression and columns are not escaped and are not safe for user-input.
112+
*
113+
* @param __doctrine-literal-string $table Table name
114+
* @param array<__doctrine-literal-string, mixed> $data Column-value pairs
115+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types
116+
*
117+
* @return int|string The number of affected rows.
118+
*
119+
* @throws Exception
120+
*/
121+
public function insert($table, array $data, array $types = []);
77122
}

stubs/DBAL/Connection4.stub

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,49 @@ class Connection
7878
*/
7979
public function transactional(Closure $func);
8080

81+
/**
82+
* Executes an SQL DELETE statement on a table.
83+
*
84+
* Table expression and columns are not escaped and are not safe for user-input.
85+
*
86+
* @param __doctrine-literal-string $table
87+
* @param array<__doctrine-literal-string, mixed> $criteria
88+
* @param array<int<0,max>, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types
89+
*
90+
* @return int|numeric-string The number of affected rows.
91+
*
92+
* @throws Exception
93+
*/
94+
public function delete(string $table, array $criteria = [], array $types = []): int|string;
95+
96+
/**
97+
* Executes an SQL UPDATE statement on a table.
98+
*
99+
* Table expression and columns are not escaped and are not safe for user-input.
100+
*
101+
* @param __doctrine-literal-string $table
102+
* @param array<__doctrine-literal-string, mixed> $data
103+
* @param array<__doctrine-literal-string, mixed> $criteria
104+
* @param array<int<0,max>, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types
105+
*
106+
* @return int|numeric-string The number of affected rows.
107+
*
108+
* @throws Exception
109+
*/
110+
public function update(string $table, array $data, array $criteria = [], array $types = []): int|string;
111+
112+
/**
113+
* Inserts a table row with specified data.
114+
*
115+
* Table expression and columns are not escaped and are not safe for user-input.
116+
*
117+
* @param __doctrine-literal-string $table
118+
* @param array<__doctrine-literal-string, mixed> $data
119+
* @param array<int<0,max>, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types
120+
*
121+
* @return int|numeric-string The number of affected rows.
122+
*
123+
* @throws Exception
124+
*/
125+
public function insert(string $table, array $data, array $types = []): int|string;
81126
}

0 commit comments

Comments
 (0)