Skip to content

Commit d8df7dc

Browse files
committed
Add ext/pdo stubs
1 parent a758089 commit d8df7dc

File tree

4 files changed

+405
-142
lines changed

4 files changed

+405
-142
lines changed

ext/pdo/pdo.stub.php

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
<?php
2+
3+
class PDO
4+
{
5+
public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null);
6+
7+
/**
8+
* @param string $statement
9+
* @param array $options
10+
*
11+
* @return PDOStatement|false
12+
*/
13+
public function prepare(string $statement, array $options = []);
14+
15+
/**
16+
* @return bool
17+
*/
18+
public function beginTransaction();
19+
20+
/**
21+
* @return bool
22+
*/
23+
public function commit();
24+
25+
/**
26+
* @return bool
27+
*/
28+
public function rollBack();
29+
30+
/**
31+
* @return bool
32+
*/
33+
public function inTransaction();
34+
35+
/**
36+
* @param int $attribute
37+
* @param mixed $value
38+
*
39+
* @return boolean
40+
*/
41+
public function setAttribute(int $attribute, mixed $value);
42+
43+
/**
44+
* @param string $query
45+
*
46+
* @return int|false
47+
*/
48+
public function exec(string $query);
49+
50+
/**
51+
* @param string $sql
52+
*
53+
* @return object
54+
*/
55+
public function query(string $sql);
56+
57+
/**
58+
* @param ?string $seqname = null
59+
*
60+
* @return int|false
61+
*/
62+
public function lastInsertId(?string $seqname = null);
63+
64+
/**
65+
* @return string|null
66+
*/
67+
public function errorCode();
68+
69+
/**
70+
* @return array
71+
*/
72+
public function errorInfo();
73+
74+
/**
75+
* @param int $attribute
76+
*
77+
* @return mixed
78+
*/
79+
public function getAttribute(int $attribute);
80+
81+
/**
82+
* @param string $string
83+
* @param int $paramtype
84+
*
85+
* @return string|false
86+
*/
87+
public function quote(string $string, int $paramtype = 0);
88+
89+
/**
90+
* @return array
91+
*/
92+
public static function getAvailableDrivers();
93+
}
94+
95+
class PDOException
96+
{
97+
}
98+
99+
class PDOStatement
100+
{
101+
/**
102+
* @param array $bound_input_params
103+
*
104+
* @return bool
105+
*/
106+
public function execute(?array $bound_input_params = null);
107+
108+
/**
109+
* @param int $how = PDO_FETCH_BOTH
110+
* @param int $orientation
111+
* @param int $offset
112+
*
113+
* @return mixed
114+
*/
115+
public function fetch(int $how = PDO_FETCH_BOTH, int $orientation = 0, int $offset = 0);
116+
117+
/**
118+
* @param mixed $paramno
119+
* @param mixed &$param
120+
* @param int $type
121+
* @param int $maxlen
122+
* @param ?mixed $driverdata
123+
*
124+
* @return bool
125+
*/
126+
public function bindParam(mixed $paramno, mixed &$param, int $type = 0, int $maxlen = 0, ?mixed $driverdata = null);
127+
128+
/**
129+
* @param mixed $paramno
130+
* @param mixed &$param
131+
* @param int $type
132+
* @param int $maxlen
133+
* @param mixed $driverdata
134+
*
135+
* @return bool
136+
*/
137+
public function bindColumn(mixed $paramno, mixed &$param, int $type = 0, int $maxlen = 0, ?mixed $driverdata = null);
138+
139+
/**
140+
* @param mixed $paramno,
141+
* @param mixed $param
142+
* @param int $type
143+
*
144+
* @return bool
145+
*/
146+
public function bindValue(mixed $paramno, mixed $param, int $type = 0);
147+
148+
/**
149+
* @return int
150+
*/
151+
public function rowCount();
152+
153+
/**
154+
* @param int $column_number
155+
*
156+
* @return string|false
157+
*/
158+
public function fetchColumn(int $column_number = 0);
159+
160+
/**
161+
* @param int $how
162+
* @param string $class_name
163+
* @param ?array $ctor_args
164+
*
165+
* @return array|false
166+
*/
167+
public function fetchAll(int $how = PDO_FETCH_BOTH, string $class_name = '', ?array $ctor_args = null);
168+
169+
/**
170+
* @param string $class_name
171+
* @param ?array $ctor_args
172+
*
173+
* @return mixed
174+
*/
175+
public function fetchObject(string $class_name = '', ?array $ctor_args = null);
176+
177+
/**
178+
* @return string|null
179+
*/
180+
public function errorCode();
181+
182+
/**
183+
* @return array
184+
*/
185+
public function errorInfo();
186+
187+
/**
188+
* @param long $attribute
189+
* @param mixed $value
190+
*
191+
* @return bool
192+
*/
193+
public function setAttribute(long $attribute, mixed $value);
194+
195+
/**
196+
* @param long $attribute
197+
*
198+
* @return mixed
199+
*/
200+
public function getAttribute(long $attribute);
201+
202+
/**
203+
* @return int
204+
*/
205+
public function columnCount();
206+
207+
/**
208+
* @param int $column
209+
*
210+
* @return array|false
211+
*/
212+
public function getColumnMeta(int $column);
213+
214+
/**
215+
* @param int $mode
216+
* @param ?mixed $params
217+
*
218+
* @return bool
219+
*/
220+
public function setFetchMode(int $mode, ?mixed $params = null);
221+
222+
/**
223+
* @return bool
224+
*/
225+
public function nextRowset();
226+
227+
/**
228+
* @return bool
229+
*/
230+
public function closeCursor();
231+
232+
/**
233+
* @return void|false
234+
*/
235+
public function debugDumpParams();
236+
}
237+
238+
class PDORow
239+
{
240+
}

ext/pdo/pdo_arginfo.h

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1)
4+
ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
5+
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 1)
6+
ZEND_ARG_TYPE_INFO(0, passwd, IS_STRING, 1)
7+
ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 1)
8+
ZEND_END_ARG_INFO()
9+
10+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_prepare, 0, 0, 1)
11+
ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0)
12+
ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
13+
ZEND_END_ARG_INFO()
14+
15+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_beginTransaction, 0, 0, 0)
16+
ZEND_END_ARG_INFO()
17+
18+
#define arginfo_class_PDO_commit arginfo_class_PDO_beginTransaction
19+
20+
#define arginfo_class_PDO_rollBack arginfo_class_PDO_beginTransaction
21+
22+
#define arginfo_class_PDO_inTransaction arginfo_class_PDO_beginTransaction
23+
24+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_setAttribute, 0, 0, 2)
25+
ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0)
26+
ZEND_ARG_OBJ_INFO(0, value, mixed, 0)
27+
ZEND_END_ARG_INFO()
28+
29+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_exec, 0, 0, 1)
30+
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
31+
ZEND_END_ARG_INFO()
32+
33+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_query, 0, 0, 1)
34+
ZEND_ARG_TYPE_INFO(0, sql, IS_STRING, 0)
35+
ZEND_END_ARG_INFO()
36+
37+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_lastInsertId, 0, 0, 0)
38+
ZEND_ARG_TYPE_INFO(0, seqname, IS_STRING, 1)
39+
ZEND_END_ARG_INFO()
40+
41+
#define arginfo_class_PDO_errorCode arginfo_class_PDO_beginTransaction
42+
43+
#define arginfo_class_PDO_errorInfo arginfo_class_PDO_beginTransaction
44+
45+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_getAttribute, 0, 0, 1)
46+
ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0)
47+
ZEND_END_ARG_INFO()
48+
49+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_quote, 0, 0, 1)
50+
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
51+
ZEND_ARG_TYPE_INFO(0, paramtype, IS_LONG, 0)
52+
ZEND_END_ARG_INFO()
53+
54+
#define arginfo_class_PDO_getAvailableDrivers arginfo_class_PDO_beginTransaction
55+
56+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_execute, 0, 0, 0)
57+
ZEND_ARG_TYPE_INFO(0, bound_input_params, IS_ARRAY, 1)
58+
ZEND_END_ARG_INFO()
59+
60+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetch, 0, 0, 0)
61+
ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
62+
ZEND_ARG_TYPE_INFO(0, orientation, IS_LONG, 0)
63+
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
64+
ZEND_END_ARG_INFO()
65+
66+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindParam, 0, 0, 2)
67+
ZEND_ARG_OBJ_INFO(0, paramno, mixed, 0)
68+
ZEND_ARG_OBJ_INFO(1, param, mixed, 0)
69+
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
70+
ZEND_ARG_TYPE_INFO(0, maxlen, IS_LONG, 0)
71+
ZEND_ARG_OBJ_INFO(0, driverdata, mixed, 1)
72+
ZEND_END_ARG_INFO()
73+
74+
#define arginfo_class_PDOStatement_bindColumn arginfo_class_PDOStatement_bindParam
75+
76+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindValue, 0, 0, 2)
77+
ZEND_ARG_OBJ_INFO(0, paramno, mixed, 0)
78+
ZEND_ARG_OBJ_INFO(0, param, mixed, 0)
79+
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
80+
ZEND_END_ARG_INFO()
81+
82+
#define arginfo_class_PDOStatement_rowCount arginfo_class_PDO_beginTransaction
83+
84+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchColumn, 0, 0, 0)
85+
ZEND_ARG_TYPE_INFO(0, column_number, IS_LONG, 0)
86+
ZEND_END_ARG_INFO()
87+
88+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchAll, 0, 0, 0)
89+
ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
90+
ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
91+
ZEND_ARG_TYPE_INFO(0, ctor_args, IS_ARRAY, 1)
92+
ZEND_END_ARG_INFO()
93+
94+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchObject, 0, 0, 0)
95+
ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
96+
ZEND_ARG_TYPE_INFO(0, ctor_args, IS_ARRAY, 1)
97+
ZEND_END_ARG_INFO()
98+
99+
#define arginfo_class_PDOStatement_errorCode arginfo_class_PDO_beginTransaction
100+
101+
#define arginfo_class_PDOStatement_errorInfo arginfo_class_PDO_beginTransaction
102+
103+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_setAttribute, 0, 0, 2)
104+
ZEND_ARG_OBJ_INFO(0, attribute, long, 0)
105+
ZEND_ARG_OBJ_INFO(0, value, mixed, 0)
106+
ZEND_END_ARG_INFO()
107+
108+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_getAttribute, 0, 0, 1)
109+
ZEND_ARG_OBJ_INFO(0, attribute, long, 0)
110+
ZEND_END_ARG_INFO()
111+
112+
#define arginfo_class_PDOStatement_columnCount arginfo_class_PDO_beginTransaction
113+
114+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_getColumnMeta, 0, 0, 1)
115+
ZEND_ARG_TYPE_INFO(0, column, IS_LONG, 0)
116+
ZEND_END_ARG_INFO()
117+
118+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_setFetchMode, 0, 0, 1)
119+
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
120+
ZEND_ARG_OBJ_INFO(0, params, mixed, 1)
121+
ZEND_END_ARG_INFO()
122+
123+
#define arginfo_class_PDOStatement_nextRowset arginfo_class_PDO_beginTransaction
124+
125+
#define arginfo_class_PDOStatement_closeCursor arginfo_class_PDO_beginTransaction
126+
127+
#define arginfo_class_PDOStatement_debugDumpParams arginfo_class_PDO_beginTransaction

0 commit comments

Comments
 (0)