@@ -74,7 +74,7 @@ |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | - * @return mixed |
|
| 77 | + * @return integer |
|
| 78 | 78 | */ |
| 79 | 79 | public function key() { |
| 80 | 80 | return $this->idx; |
@@ -47,16 +47,16 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function current() { |
| 49 | 49 | $row = $this->currentItem; |
| 50 | - if($this->preserveTypes) { |
|
| 50 | + if ($this->preserveTypes) { |
|
| 51 | 51 | $columnDefinitions = FieldTypeProvider::getFieldTypes($this->getStmt()); |
| 52 | 52 | $row = FieldValueConverter::convertValues($row, $columnDefinitions); |
| 53 | 53 | } |
| 54 | 54 | $callback = $this->callback; |
| 55 | - if($callback !== null) { |
|
| 55 | + if ($callback !== null) { |
|
| 56 | 56 | $result = $callback($row); |
| 57 | - if($result instanceof DBIgnoreRow) { |
|
| 57 | + if ($result instanceof DBIgnoreRow) { |
|
| 58 | 58 | // Do nothing in this case |
| 59 | - } elseif($result !== null) { |
|
| 59 | + } elseif ($result !== null) { |
|
| 60 | 60 | return $result; |
| 61 | 61 | } else { |
| 62 | 62 | return $row; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function valid() { |
| 87 | 87 | $result = !!$this->currentItem; |
| 88 | - if(!$result) { |
|
| 88 | + if (!$result) { |
|
| 89 | 89 | $this->closeCursor(); |
| 90 | 90 | } |
| 91 | 91 | return $result; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | */ |
| 96 | 96 | public function rewind() { |
| 97 | - if($this->stmt !== null) { |
|
| 97 | + if ($this->stmt !== null) { |
|
| 98 | 98 | throw new \Exception("It's not possible to rewind this iterator"); |
| 99 | 99 | } |
| 100 | 100 | $this->stmt = call_user_func($this->statementFactory); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @return QueryStatement |
| 107 | 107 | */ |
| 108 | 108 | private function getStmt() { |
| 109 | - if($this->stmt === null) { |
|
| 109 | + if ($this->stmt === null) { |
|
| 110 | 110 | $this->rewind(); |
| 111 | 111 | } |
| 112 | 112 | return $this->stmt; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | */ |
| 117 | 117 | private function closeCursor() { |
| 118 | - if($this->stmt instanceof QueryStatement) { |
|
| 118 | + if ($this->stmt instanceof QueryStatement) { |
|
| 119 | 119 | $this->stmt->closeCursor(); |
| 120 | 120 | } |
| 121 | 121 | $this->stmt = null; |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | use Closure; |
| 5 | 5 | use Iterator; |
| 6 | 6 | use Kir\MySQL\Builder\QueryStatement; |
| 7 | -use PDO; |
|
| 8 | 7 | |
| 9 | 8 | class YieldPolyfillIterator implements Iterator { |
| 10 | 9 | /** @var Closure|null */ |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * @return array |
|
| 81 | + * @return string[] |
|
| 82 | 82 | */ |
| 83 | 83 | public function getFields() { |
| 84 | 84 | return $this->fields; |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | protected function buildLimit($query, $offset = null) { |
| 30 | 30 | $limit = $this->limit; |
| 31 | - if($limit === null && $offset !== null) { |
|
| 31 | + if ($limit === null && $offset !== null) { |
|
| 32 | 32 | $limit = '18446744073709551615'; |
| 33 | 33 | } |
| 34 | - if($limit !== null) { |
|
| 34 | + if ($limit !== null) { |
|
| 35 | 35 | $query .= "LIMIT\n\t{$limit}\n"; |
| 36 | 36 | } |
| 37 | 37 | return $query; |
@@ -21,16 +21,16 @@ |
||
| 21 | 21 | * @return array[]|\Generator |
| 22 | 22 | */ |
| 23 | 23 | public function generate(QueryStatement $statement, Closure $callback = null) { |
| 24 | - while($row = $statement->fetch()) { |
|
| 25 | - if($this->preserveTypes) { |
|
| 24 | + while ($row = $statement->fetch()) { |
|
| 25 | + if ($this->preserveTypes) { |
|
| 26 | 26 | $columnDefinitions = FieldTypeProvider::getFieldTypes($statement); |
| 27 | 27 | $row = FieldValueConverter::convertValues($row, $columnDefinitions); |
| 28 | 28 | } |
| 29 | - if($callback !== null) { |
|
| 29 | + if ($callback !== null) { |
|
| 30 | 30 | $result = $callback($row); |
| 31 | - if($result instanceof DBIgnoreRow) { |
|
| 31 | + if ($result instanceof DBIgnoreRow) { |
|
| 32 | 32 | // Do nothing in this case |
| 33 | - } elseif($result !== null) { |
|
| 33 | + } elseif ($result !== null) { |
|
| 34 | 34 | yield $result; |
| 35 | 35 | } else { |
| 36 | 36 | yield $row; |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | * @return $this |
| 47 | 47 | */ |
| 48 | 48 | public function setFetchMode($mode, $arg0 = null, array $arg1 = null) { |
| 49 | - if($arg1 !== null) { |
|
| 49 | + if ($arg1 !== null) { |
|
| 50 | 50 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
| 51 | 51 | $this->statement->setFetchMode($mode, $arg0, $arg1); |
| 52 | 52 | return $this; |
| 53 | 53 | } |
| 54 | - if($arg0 !== null) { |
|
| 54 | + if ($arg0 !== null) { |
|
| 55 | 55 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
| 56 | 56 | $this->statement->setFetchMode($mode, $arg0); |
| 57 | 57 | return $this; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $timer = microtime(true); |
| 71 | 71 | $response = $this->statement->execute($params); |
| 72 | 72 | $this->queryLoggers->log($this->query, microtime(true)-$timer); |
| 73 | - if(!$response) { |
|
| 73 | + if (!$response) { |
|
| 74 | 74 | throw new SqlException('Execution returned with "false".'); |
| 75 | 75 | } |
| 76 | 76 | }); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function fetchAll($fetchStyle = null, $fetchArgument = null, array $ctorArgs = []) { |
| 87 | 87 | return $this->exceptionHandler(function() use ($fetchStyle, $fetchArgument, $ctorArgs) { |
| 88 | - if($fetchArgument !== null) { |
|
| 88 | + if ($fetchArgument !== null) { |
|
| 89 | 89 | return $this->statement->fetchAll($fetchStyle, $fetchArgument, $ctorArgs); |
| 90 | 90 | } |
| 91 | 91 | return $this->statement->fetchAll($fetchStyle); |