diff --git a/src/ExtendedPdo.php b/src/ExtendedPdo.php index 833dc71b..b9149c57 100644 --- a/src/ExtendedPdo.php +++ b/src/ExtendedPdo.php @@ -472,7 +472,7 @@ public function fetchCol( * * @param array $ctor_args Arguments to pass to the object constructor. * - * @return object + * @return object|false * */ public function fetchObject( @@ -537,7 +537,7 @@ public function fetchObjects( * * @param array $values Values to bind to the query. * - * @return array + * @return array|false * */ public function fetchOne($statement, array $values = array()) diff --git a/src/ExtendedPdoInterface.php b/src/ExtendedPdoInterface.php index da9918ad..4a56799a 100644 --- a/src/ExtendedPdoInterface.php +++ b/src/ExtendedPdoInterface.php @@ -114,7 +114,7 @@ public function fetchCol($statement, array $values = array(), $callable = null); * * @param array $ctor_args Arguments to pass to the object constructor. * - * @return object + * @return object|false * */ public function fetchObject( @@ -163,7 +163,7 @@ public function fetchObjects( * * @param array $values Values to bind to the query. * - * @return array + * @return array|false * */ public function fetchOne($statement, array $values = array()); diff --git a/tests/AbstractExtendedPdoTest.php b/tests/AbstractExtendedPdoTest.php index 27575db9..a059f9e3 100755 --- a/tests/AbstractExtendedPdoTest.php +++ b/tests/AbstractExtendedPdoTest.php @@ -333,6 +333,13 @@ public function testFetchObject() $this->assertSame('Anna', $actual->name); } + public function testFetchObjectReturningFalse() + { + $stm = "SELECT id, name FROM pdotest WHERE id = ?"; + $actual = $this->pdo->fetchObject($stm, array(-1)); + $this->assertFalse($actual); + } + public function testFetchObject_withCtorArgs() { $stm = "SELECT id, name FROM pdotest WHERE id = ?"; @@ -419,6 +426,13 @@ public function testFetchOne() $this->assertEquals($expect, $actual); } + public function testFetchOneReturningFalse() + { + $stm = "SELECT id, name FROM pdotest WHERE id = -1"; + $actual = $this->pdo->fetchOne($stm); + $this->assertFalse($actual); + } + public function testGroupSingleColumn() { $stm = "SELECT id, name FROM pdotest WHERE id = 1";