Skip to content

Commit 046a070

Browse files
committed
Resource treated as a class because PHP type system doesn't have it
Instead, use PHP doc comments
1 parent a5a44a2 commit 046a070

File tree

1 file changed

+243
-59
lines changed

1 file changed

+243
-59
lines changed

ibm_db2.stub.php

Lines changed: 243 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,155 +2,339 @@
22

33
/**
44
* Stub for arginfo in PHP 8.
5+
* XXX: How do we represent optionals without defaults?
56
* @generate-function-entries
67
* @generate-legacy-arginfo
78
*/
89

9-
function db2_connect(string $database, ?string $username, ?string $password, array $options = []): resource|false {}
10+
/**
11+
* @param resource $connection
12+
* @return resource|false
13+
*/
14+
function db2_connect(string $database, ?string $username, ?string $password, array $options = []) {}
1015

11-
function db2_commit(resource $connection): bool {}
16+
/**
17+
* @param resource $connection
18+
*/
19+
function db2_commit($connection): bool {}
1220

13-
function db2_pconnect(string $database, ?string $username, ?string $password, array $options = []): resource|false {}
21+
/**
22+
* @param resource $connection
23+
* @return resource|false
24+
*/
25+
function db2_pconnect(string $database, ?string $username, ?string $password, array $options = []) {}
1426

15-
function db2_autocommit(resource $connection, ?int $value = null): int|bool {}
27+
/**
28+
* @param resource $connection
29+
*/
30+
function db2_autocommit($connection, ?int $value = null): int|bool {}
1631

17-
function db2_bind_param(resource $connection, int $parameter_number, string $variable_name, ?int $parameter_type, int $data_type = 0, int $precision = -1, int $scale = 0): bool {}
32+
/**
33+
* @param resource $connection
34+
*/
35+
function db2_bind_param($connection, int $parameter_number, string $variable_name, ?int $parameter_type, int $data_type = 0, int $precision = -1, int $scale = 0): bool {}
1836

19-
function db2_close(resource $connection): bool {}
37+
/**
38+
* @param resource $connection
39+
*/
40+
function db2_close($connection): bool {}
2041

2142
#ifdef PASE
22-
function db2_pclose(resource $connection): bool {}
43+
/**
44+
* @param resource $connection
45+
*/
46+
function db2_pclose( $connection): bool {}
2347
#endif
2448

25-
function db2_column_privileges(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null): resource {}
49+
/**
50+
* @param resource $connection
51+
* @return resource
52+
*/
53+
function db2_column_privileges($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null) {}
2654

2755
/**
56+
* @param resource $connection
57+
* @return resource
2858
* @alias db2_column_privileges
2959
*/
30-
function db2_columnprivileges(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null): resource {}
60+
function db2_columnprivileges($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null) {}
3161

32-
function db2_columns(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null): resource {}
62+
/**
63+
* @param resource $connection
64+
* @return resource
65+
*/
66+
function db2_columns($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null) {}
3367

34-
function db2_foreign_keys(resource $connection, ?string $qualifier, ?string $schema, string $table_name): resource {}
68+
/**
69+
* @param resource $connection
70+
* @return resource
71+
*/
72+
function db2_foreign_keys($connection, ?string $qualifier, ?string $schema, string $table_name) {}
3573

3674
/**
75+
* @param resource $connection
76+
* @return resource
3777
* @alias db2_foreign_keys
3878
*/
39-
function db2_foreignkeys(resource $connection, ?string $qualifier, ?string $schema, string $table_name): resource {}
79+
function db2_foreignkeys($connection, ?string $qualifier, ?string $schema, string $table_name) {}
4080

41-
function db2_primary_keys(resource $connection, ?string $qualifier, ?string $schema, string $table_name): resource {}
81+
/**
82+
* @param resource $connection
83+
* @return resource
84+
*/
85+
function db2_primary_keys($connection, ?string $qualifier, ?string $schema, string $table_name) {}
4286

4387
/**
88+
* @param resource $connection
89+
* @return resource
4490
* @alias db2_primary_keys
4591
*/
46-
function db2_primarykeys(resource $connection, ?string $qualifier, ?string $schema, string $table_name): resource {}
92+
function db2_primarykeys($connection, ?string $qualifier, ?string $schema, string $table_name) {}
4793

48-
function db2_procedure_columns(resource $connection, ?string $qualifier, string $schema, string $procedure, ?string $parameter): resource {}
94+
/**
95+
* @param resource $connection
96+
* @return resource
97+
*/
98+
function db2_procedure_columns($connection, ?string $qualifier, string $schema, string $procedure, ?string $parameter) {}
4999

50100
/**
101+
* @param resource $connection
102+
* @return resource
51103
* @alias db2_procedure_columns
52104
*/
53-
function db2_procedurecolumns(resource $connection, ?string $qualifier, string $schema, string $procedure, ?string $parameter): resource {}
105+
function db2_procedurecolumns($connection, ?string $qualifier, string $schema, string $procedure, ?string $parameter) {}
54106

55-
function db2_procedures(resource $connection, ?string $qualifier, string $schema, string $procedure): resource {}
107+
/**
108+
* @param resource $connection
109+
* @return resource
110+
*/
111+
function db2_procedures($connection, ?string $qualifier, string $schema, string $procedure) {}
56112

57-
function db2_special_columns(resource $connection, ?string $qualifier, string $schema, string $table_name, int $scope): resource {}
113+
/**
114+
* @param resource $connection
115+
* @return resource
116+
*/
117+
function db2_special_columns($connection, ?string $qualifier, string $schema, string $table_name, int $scope) {}
58118

59119
/**
120+
* @param resource $connection
121+
* @return resource
60122
* @alias db2_special_columns
61123
*/
62-
function db2_specialcolumns(resource $connection, ?string $qualifier, string $schema, string $table_name, int $scope): resource {}
124+
function db2_specialcolumns(resource $connection, ?string $qualifier, string $schema, string $table_name, int $scope) {}
63125

64-
function db2_statistics(resource $connection, ?string $qualifier, ?string $schema, string $table_name, bool|int $unique): resource {}
126+
/**
127+
* @param resource $connection
128+
* @return resource
129+
*/
130+
function db2_statistics($connection, ?string $qualifier, ?string $schema, string $table_name, bool|int $unique) {}
65131

66-
function db2_table_privileges(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null): resource {}
132+
/**
133+
* @param resource $connection
134+
* @return resource
135+
*/
136+
function db2_table_privileges($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null) {}
67137

68138
/**
139+
* @param resource $connection
140+
* @return resource
69141
* @alias db2_table_privileges
70142
*/
71-
function db2_tableprivileges(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null): resource {}
143+
function db2_tableprivileges($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null) {}
72144

73-
function db2_tables(resource $connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $table_type = null): resource {}
145+
/**
146+
* @param resource $connection
147+
* @return resource
148+
*/
149+
function db2_tables($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $table_type = null) {}
74150

75-
function db2_exec(resource $connection, string $statement, array $options = []): resource|false {}
151+
/**
152+
* @param resource $connection
153+
* @return resource|false
154+
*/
155+
function db2_exec($connection, string $statement, array $options = []) {}
76156

77-
function db2_prepare(resource $connection, string $statement, array $options = []): resource|false {}
157+
/**
158+
* @param resource $connection
159+
* @return resource|false
160+
*/
161+
function db2_prepare($connection, string $statement, array $options = []) {}
78162

79-
function db2_execute(resource $stmt, array $options = []): bool {}
163+
/**
164+
* @param resource $stmt
165+
*/
166+
function db2_execute($stmt, array $options = []): bool {}
80167

81168
#ifndef PASE
82169
/* XXX: Not documented and not supported on PASE. */
83-
function db2_execute_many(resource $stmt, array $options = []): int|false {}
170+
171+
/**
172+
* @param resource $stmt
173+
*/
174+
function db2_execute_many($stmt, array $options = []): int|false {}
84175
#endif
85176

86-
function db2_stmt_errormsg(?resource $stmt = null): string {}
177+
/**
178+
* @param resource $stmt
179+
*/
180+
function db2_stmt_errormsg($stmt = null): string {}
87181

88-
function db2_stmt_error(?resource $stmt = null): string {}
182+
/**
183+
* @param resource $stmt
184+
*/
185+
function db2_stmt_error($stmt = null): string {}
89186

90-
function db2_conn_errormsg(?resource $connection = null): string {}
187+
/**
188+
* @param resource $connection
189+
*/
190+
function db2_conn_errormsg($connection = null): string {}
91191

92-
function db2_conn_error(?resource $connection = null): string {}
192+
/**
193+
* @param resource $connection
194+
*/
195+
function db2_conn_error($connection = null): string {}
93196

94-
function db2_next_result(resource $stmt): resource|false {}
197+
/**
198+
* @param resource $stmt
199+
* @return resource|false
200+
*/
201+
function db2_next_result($stmt) {}
95202

96-
function db2_num_fields(resource $stmt): int|false {}
203+
/**
204+
* @param resource $stmt
205+
*/
206+
function db2_num_fields($stmt): int|false {}
97207

98-
function db2_num_rows(resource $stmt): int|false {}
208+
/**
209+
* @param resource $stmt
210+
*/
211+
function db2_num_rows($stmt): int|false {}
99212

100-
function db2_field_name(resource $stmt, int|string $column): string|false {}
213+
/**
214+
* @param resource $stmt
215+
*/
216+
function db2_field_name($stmt, int|string $column): string|false {}
101217

102-
function db2_field_display_size(resource $stmt, int|string $column): int|false {}
218+
/**
219+
* @param resource $stmt
220+
*/
221+
function db2_field_display_size($stmt, int|string $column): int|false {}
103222

104-
function db2_field_num(resource $stmt, int|string $column): int|false {}
223+
/**
224+
* @param resource $stmt
225+
*/
226+
function db2_field_num($stmt, int|string $column): int|false {}
105227

106-
function db2_field_precision(resource $stmt, int|string $column): int|false {}
228+
/**
229+
* @param resource $stmt
230+
*/
231+
function db2_field_precision($stmt, int|string $column): int|false {}
107232

108-
function db2_field_scale(resource $stmt, int|string $column): int|false {}
233+
/**
234+
* @param resource $stmt
235+
*/
236+
function db2_field_scale($stmt, int|string $column): int|false {}
109237

110-
function db2_field_type(resource $stmt, int|string $column): string|false {}
238+
/**
239+
* @param resource $stmt
240+
*/
241+
function db2_field_type($stmt, int|string $column): string|false {}
111242

112-
function db2_field_width(resource $stmt, int|string $column): int|false {}
243+
/**
244+
* @param resource $stmt
245+
*/
246+
function db2_field_width($stmt, int|string $column): int|false {}
113247

114-
function db2_cursor_type(resource $stmt): int {}
248+
/**
249+
* @param resource $stmt
250+
*/
251+
function db2_cursor_type($stmt): int {}
115252

116-
function db2_rollback(resource $connection): bool {}
253+
/**
254+
* @param resource $connection
255+
*/
256+
function db2_rollback($connection): bool {}
117257

118-
function db2_free_stmt(resource $stmt): bool {}
258+
/**
259+
* @param resource $stmt
260+
*/
261+
function db2_free_stmt($stmt): bool {}
119262

120-
function db2_result(resource $stmt, int|string $column): object|null {}
263+
/**
264+
* @param resource $stmt
265+
*/
266+
function db2_result($stmt, int|string $column): object|null {}
121267

122-
function db2_fetch_row(resource $stmt, ?int $row_number = null): bool {}
268+
/**
269+
* @param resource $stmt
270+
*/
271+
function db2_fetch_row($stmt, ?int $row_number = null): bool {}
123272

124-
function db2_fetch_assoc(resource $stmt, ?int $row_number = null): array|false {}
273+
/**
274+
* @param resource $stmt
275+
*/
276+
function db2_fetch_assoc($stmt, ?int $row_number = null): array|false {}
125277

126-
function db2_fetch_array(resource $stmt, ?int $row_number = null): array|false {}
278+
/**
279+
* @param resource $stmt
280+
*/
281+
function db2_fetch_array($stmt, ?int $row_number = null): array|false {}
127282

128-
function db2_fetch_both(resource $stmt, ?int $row_number = null): array|false {}
283+
/**
284+
* @param resource $stmt
285+
*/
286+
function db2_fetch_both($stmt, ?int $row_number = null): array|false {}
129287

130-
function db2_fetch_object(resource $stmt, ?int $row_number = null): object|false {}
288+
/**
289+
* @param resource $stmt
290+
*/
291+
function db2_fetch_object($stmt, ?int $row_number = null): object|false {}
131292

132-
function db2_free_result(resource $stmt): bool {}
293+
/**
294+
* @param resource $stmt
295+
*/
296+
function db2_free_result($stmt): bool {}
133297

134-
function db2_set_option(resource $resource, array $options, int $type): bool {}
298+
/**
299+
* @param resource $resource
300+
*/
301+
function db2_set_option($resource, array $options, int $type): bool {}
135302

136303
/**
304+
* @param resource $resource
137305
* @alias db2_set_option
138306
*/
139-
function db2_setoption(resource $resource, array $options, int $type): bool {}
307+
function db2_setoption($resource, array $options, int $type): bool {}
140308

141-
function db2_client_info(resource $connection): object|false {}
309+
/**
310+
* @param resource $connection
311+
*/
312+
function db2_client_info($connection): object|false {}
142313

143-
function db2_server_info(resource $connection): object|false {}
314+
/**
315+
* @param resource $connection
316+
*/
317+
function db2_server_info($connection): object|false {}
144318

145319
function db2_escape_string(string $string_literal): string {}
146320

147-
function db2_lob_read(resource $stmt, int $colnum, int $length): string|false {}
321+
/**
322+
* @param resource $stmt
323+
*/
324+
function db2_lob_read($stmt, int $colnum, int $length): string|false {}
148325

149-
function db2_get_option(resource $stmt, string $option): string|false {}
326+
/**
327+
* @param resource $resource
328+
*/
329+
function db2_get_option($resource, string $option): string|false {}
150330

151331
/**
332+
* @param resource $resource
152333
* @alias db2_get_option
153334
*/
154-
function db2_getoption(resource $stmt, string $option): string|false {}
335+
function db2_getoption($resource, string $option): string|false {}
155336

156-
function db2_last_insert_id(resource $stmt): string {}
337+
/**
338+
* @param resource $resource
339+
*/
340+
function db2_last_insert_id($resource): string {}

0 commit comments

Comments
 (0)