From 2ea5c3e1cafc0d8138f41a412d1dfd91b558b98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Falk=20D=C3=B6ring?= Date: Thu, 28 Dec 2017 11:26:10 +0100 Subject: [PATCH 1/3] update docblocks for AdapterServiceFactory, AbstractResultSet, AbstractTableGateway and TableGatewayInterface --- src/Adapter/AdapterServiceFactory.php | 4 +++ src/ResultSet/AbstractResultSet.php | 5 ++- src/TableGateway/AbstractTableGateway.php | 9 +++--- src/TableGateway/TableGatewayInterface.php | 36 ++++++++++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/Adapter/AdapterServiceFactory.php b/src/Adapter/AdapterServiceFactory.php index b57e7538ab..326e1184ca 100644 --- a/src/Adapter/AdapterServiceFactory.php +++ b/src/Adapter/AdapterServiceFactory.php @@ -10,6 +10,8 @@ namespace Zend\Db\Adapter; use Interop\Container\ContainerInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -22,6 +24,8 @@ class AdapterServiceFactory implements FactoryInterface * @param string $requestedName * @param array $options * @return Adapter + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { diff --git a/src/ResultSet/AbstractResultSet.php b/src/ResultSet/AbstractResultSet.php index 6bf2252bde..a602615318 100644 --- a/src/ResultSet/AbstractResultSet.php +++ b/src/ResultSet/AbstractResultSet.php @@ -33,7 +33,7 @@ abstract class AbstractResultSet implements Iterator, ResultSetInterface protected $count = null; /** - * @var Iterator|IteratorAggregate|ResultInterface + * @var Iterator|IteratorAggregate|ResultInterface|ArrayIterator */ protected $dataSource = null; @@ -110,6 +110,9 @@ public function buffer() return $this; } + /** + * @return bool + */ public function isBuffered() { if ($this->buffer === -1 || is_array($this->buffer)) { diff --git a/src/TableGateway/AbstractTableGateway.php b/src/TableGateway/AbstractTableGateway.php index 014c08eaa2..ca54948717 100644 --- a/src/TableGateway/AbstractTableGateway.php +++ b/src/TableGateway/AbstractTableGateway.php @@ -83,7 +83,6 @@ public function isInitialized() * Initialize * * @throws Exception\RuntimeException - * @return null */ public function initialize() { @@ -158,7 +157,7 @@ public function getFeatureSet() /** * Get select result prototype * - * @return ResultSet + * @return ResultSetInterface */ public function getResultSetPrototype() { @@ -177,7 +176,7 @@ public function getSql() * Select * * @param Where|\Closure|string|array $where - * @return ResultSet + * @return ResultSetInterface */ public function select($where = null) { @@ -211,7 +210,7 @@ public function selectWith(Select $select) /** * @param Select $select - * @return ResultSet + * @return ResultSetInterface * @throws Exception\RuntimeException */ protected function executeSelect(Select $select) @@ -350,7 +349,7 @@ public function update($set, $where = null, array $joins = null) } /** - * @param \Zend\Db\Sql\Update $update + * @param Update $update * @return int */ public function updateWith(Update $update) diff --git a/src/TableGateway/TableGatewayInterface.php b/src/TableGateway/TableGatewayInterface.php index 58c7759c3f..4da9c0a3ce 100644 --- a/src/TableGateway/TableGatewayInterface.php +++ b/src/TableGateway/TableGatewayInterface.php @@ -9,11 +9,47 @@ namespace Zend\Db\TableGateway; +use Zend\Db\ResultSet\ResultSetInterface; +use Zend\Db\Sql\Where; + interface TableGatewayInterface { + /** + * @return string + */ public function getTable(); + + /** + * Select + * + * @param Where|\Closure|string|array $where + * @return ResultSetInterface + */ public function select($where = null); + + /** + * Insert + * + * @param array $set + * @return int + */ public function insert($set); + + /** + * Update + * + * @param array $set + * @param string|array|\Closure $where + * + * @return int + */ public function update($set, $where = null); + + /** + * Delete + * + * @param Where|\Closure|string|array $where + * @return int + */ public function delete($where); } From 88208d764ef11582de7a61f72f405135f87a7820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Falk=20D=C3=B6ring?= Date: Fri, 29 Dec 2017 15:22:13 +0100 Subject: [PATCH 2/3] update docblock for StatementContainerInterface --- src/Adapter/StatementContainerInterface.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Adapter/StatementContainerInterface.php b/src/Adapter/StatementContainerInterface.php index 30bb80ac36..c7e17dfe3b 100644 --- a/src/Adapter/StatementContainerInterface.php +++ b/src/Adapter/StatementContainerInterface.php @@ -14,15 +14,15 @@ interface StatementContainerInterface /** * Set sql * - * @param $sql - * @return mixed + * @param string $sql + * @return self */ public function setSql($sql); /** * Get sql * - * @return mixed + * @return string */ public function getSql(); @@ -30,14 +30,14 @@ public function getSql(); * Set parameter container * * @param ParameterContainer $parameterContainer - * @return mixed + * @return self */ public function setParameterContainer(ParameterContainer $parameterContainer); /** * Get parameter container * - * @return mixed + * @return ParameterContainer */ public function getParameterContainer(); } From 5c81e6460dd16d7ca9f87f41d5b886236322fbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Falk=20D=C3=B6ring?= Date: Fri, 29 Dec 2017 15:31:39 +0100 Subject: [PATCH 3/3] updates after CR from @ocramius --- src/ResultSet/AbstractResultSet.php | 2 +- src/TableGateway/TableGatewayInterface.php | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ResultSet/AbstractResultSet.php b/src/ResultSet/AbstractResultSet.php index a602615318..a6b55df844 100644 --- a/src/ResultSet/AbstractResultSet.php +++ b/src/ResultSet/AbstractResultSet.php @@ -33,7 +33,7 @@ abstract class AbstractResultSet implements Iterator, ResultSetInterface protected $count = null; /** - * @var Iterator|IteratorAggregate|ResultInterface|ArrayIterator + * @var Iterator|IteratorAggregate|ResultInterface */ protected $dataSource = null; diff --git a/src/TableGateway/TableGatewayInterface.php b/src/TableGateway/TableGatewayInterface.php index 4da9c0a3ce..177e888343 100644 --- a/src/TableGateway/TableGatewayInterface.php +++ b/src/TableGateway/TableGatewayInterface.php @@ -15,41 +15,42 @@ interface TableGatewayInterface { /** + * Return the table name + * * @return string */ public function getTable(); /** - * Select + * Select values by conditions * - * @param Where|\Closure|string|array $where + * @param Where|\Closure|string|array|null $where * @return ResultSetInterface */ public function select($where = null); /** - * Insert + * Insert values given by array * * @param array $set - * @return int + * @return int number of affected rows */ public function insert($set); /** - * Update + * Update values by condition * * @param array $set - * @param string|array|\Closure $where - * - * @return int + * @param string|array|\Closure|null $where + * @return int number of affected rows */ public function update($set, $where = null); /** - * Delete + * Delete values by condition * * @param Where|\Closure|string|array $where - * @return int + * @return int number of affected rows */ public function delete($where); }