11
11
use Kir \MySQL \Builder \Helpers \YieldPolyfillIterator ;
12
12
use Kir \MySQL \Databases \MySQL ;
13
13
use PDO ;
14
+ use RuntimeException ;
14
15
use Traversable ;
15
16
16
17
/**
@@ -193,7 +194,7 @@ public function fetchValue($default = null) {
193
194
}
194
195
195
196
/**
196
- * @return bool
197
+ * @return int
197
198
*/
198
199
public function getFoundRows () {
199
200
return $ this ->foundRows ;
@@ -202,14 +203,14 @@ public function getFoundRows() {
202
203
/**
203
204
* @param callback $fn
204
205
* @return mixed
205
- * @throws \Exception
206
+ * @throws RuntimeException
206
207
*/
207
208
private function createTempStatement ($ fn ) {
208
209
$ stmt = $ this ->createStatement ();
209
210
$ res = null ;
210
211
try {
211
212
$ res = call_user_func ($ fn , $ stmt );
212
- } catch (\ Exception $ e ) { // PHP 5.4 compatibility
213
+ } catch (RuntimeException $ e ) { // PHP 5.4 compatibility
213
214
$ stmt ->closeCursor ();
214
215
throw $ e ;
215
216
}
@@ -221,6 +222,7 @@ private function createTempStatement($fn) {
221
222
* @return QueryStatement
222
223
*/
223
224
private function createStatement () {
225
+ /** @var MySQL $db */
224
226
$ db = $ this ->db ();
225
227
$ query = $ this ->__toString ();
226
228
$ statement = $ db ->prepare ($ query );
@@ -243,7 +245,7 @@ public function getIterator() {
243
245
* @param int $mode
244
246
* @param mixed $arg0
245
247
* @return mixed
246
- * @throws \Exception
248
+ * @throws RuntimeException
247
249
*/
248
250
private function fetchAll (Closure $ callback = null , $ mode , $ arg0 = null ) {
249
251
return $ this ->createTempStatement (function (QueryStatement $ statement ) use ($ callback , $ mode , $ arg0 ) {
@@ -276,7 +278,7 @@ private function fetchAll(Closure $callback = null, $mode, $arg0 = null) {
276
278
* @param Closure $callback
277
279
* @param int $mode
278
280
* @param mixed $arg0
279
- * @return Generator |YieldPolyfillIterator|mixed[]
281
+ * @return Traversable |YieldPolyfillIterator|mixed[]
280
282
*/
281
283
private function fetchLazy (Closure $ callback = null , $ mode , $ arg0 = null ) {
282
284
if (version_compare (PHP_VERSION , '5.5 ' , '< ' )) {
0 commit comments