fixed spacing

simple-pdo
n0nag0n 4 days ago
parent ff17dd591d
commit dd39d4adad

@ -247,6 +247,7 @@ class SimplePdo extends PdoWrapper
* *
* @param string $sql * @param string $sql
* @param array<int|string,mixed> $params * @param array<int|string,mixed> $params
*
* @return array<int,mixed> * @return array<int,mixed>
*/ */
public function fetchColumn(string $sql, array $params = []): array public function fetchColumn(string $sql, array $params = []): array
@ -262,6 +263,7 @@ class SimplePdo extends PdoWrapper
* *
* @param string $sql * @param string $sql
* @param array<int|string,mixed> $params * @param array<int|string,mixed> $params
*
* @return array<string|int,mixed> * @return array<string|int,mixed>
*/ */
public function fetchPairs(string $sql, array $params = []): array public function fetchPairs(string $sql, array $params = []): array
@ -280,7 +282,9 @@ class SimplePdo extends PdoWrapper
* }); * });
* *
* @param callable $callback * @param callable $callback
*
* @return mixed The return value of the callback * @return mixed The return value of the callback
*
* @throws \Throwable * @throws \Throwable
*/ */
public function transaction(callable $callback) public function transaction(callable $callback)
@ -310,6 +314,7 @@ class SimplePdo extends PdoWrapper
* *
* @param string $table * @param string $table
* @param array<string,mixed>|array<int,array<string,mixed>> $data Single row or array of rows * @param array<string,mixed>|array<int,array<string,mixed>> $data Single row or array of rows
*
* @return string Last insert ID (for single insert or last row of bulk insert) * @return string Last insert ID (for single insert or last row of bulk insert)
*/ */
public function insert(string $table, array $data): string public function insert(string $table, array $data): string
@ -386,6 +391,7 @@ class SimplePdo extends PdoWrapper
* @param array<string,mixed> $data * @param array<string,mixed> $data
* @param string $where - e.g., "id = ?" * @param string $where - e.g., "id = ?"
* @param array<int|string,mixed> $whereParams * @param array<int|string,mixed> $whereParams
*
* @return int Number of affected rows (rows where data actually changed) * @return int Number of affected rows (rows where data actually changed)
*/ */
public function update(string $table, array $data, string $where, array $whereParams = []): int public function update(string $table, array $data, string $where, array $whereParams = []): int
@ -415,6 +421,7 @@ class SimplePdo extends PdoWrapper
* @param string $table * @param string $table
* @param string $where - e.g., "id = ?" * @param string $where - e.g., "id = ?"
* @param array<int|string,mixed> $whereParams * @param array<int|string,mixed> $whereParams
*
* @return int Number of deleted rows * @return int Number of deleted rows
*/ */
public function delete(string $table, string $where, array $whereParams = []): int public function delete(string $table, string $where, array $whereParams = []): int
@ -423,5 +430,4 @@ class SimplePdo extends PdoWrapper
$stmt = $this->runQuery($sql, $whereParams); $stmt = $this->runQuery($sql, $whereParams);
return $stmt->rowCount(); return $stmt->rowCount();
} }
} }

@ -463,7 +463,7 @@ class Request
*/ */
public function negotiateContentType(array $supported): ?string public function negotiateContentType(array $supported): ?string
{ {
$accept = $this->header('Accept') ?? ''; $accept = $this->header('Accept') ?: '';
if ($accept === '') { if ($accept === '') {
return $supported[0]; return $supported[0];
} }

@ -444,5 +444,4 @@ class SimplePdoTest extends TestCase
$id = $this->db->fetchField('SELECT id, name FROM users WHERE id = ?', [1]); $id = $this->db->fetchField('SELECT id, name FROM users WHERE id = ?', [1]);
$this->assertEquals(1, $id); $this->assertEquals(1, $id);
} }
} }

Loading…
Cancel
Save