Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Zend_Db_Table_Rowset docblocks with generics to allow better type hinting #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/Zend/Db/Table/Rowset/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
* @subpackage Table
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @template TZend_Db_Table_Row of \Zend_Db_Table_Row_Abstract
* @template TZend_Db_Table of \Zend_Db_Table_Abstract
* @implements SeekableIterator<int, TZend_Db_Table_Row>
*/
abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Countable, ArrayAccess
{
Expand All @@ -39,7 +42,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
/**
* Zend_Db_Table_Abstract object.
*
* @var Zend_Db_Table_Abstract
* @var TZend_Db_Table
*/
protected $_table;

Expand All @@ -55,14 +58,14 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
/**
* Zend_Db_Table_Abstract class name.
*
* @var string
* @var class-string<TZend_Db_Table>
*/
protected $_tableClass;

/**
* Zend_Db_Table_Row_Abstract class name.
*
* @var string
* @var class-string<TZend_Db_Table_Row>
*/
protected $_rowClass = 'Zend_Db_Table_Row';

Expand All @@ -83,7 +86,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
/**
* Collection of instantiated Zend_Db_Table_Row objects.
*
* @var array
* @var array<TZend_Db_Table_Row>
*/
protected $_rows = array();

Expand Down Expand Up @@ -177,7 +180,7 @@ public function isConnected()
/**
* Returns the table object, or null if this is disconnected rowset
*
* @return Zend_Db_Table_Abstract
* @return TZend_Db_Table
*/
public function getTable()
{
Expand Down Expand Up @@ -212,7 +215,7 @@ public function setTable(Zend_Db_Table_Abstract $table)
* Query the class name of the Table object for which this
* Rowset was created.
*
* @return string
* @return class-string<TZend_Db_Table>
*/
public function getTableClass()
{
Expand All @@ -237,7 +240,7 @@ public function rewind()
* Similar to the current() function for arrays in PHP
* Required by interface Iterator.
*
* @return Zend_Db_Table_Row_Abstract|null current element from the collection
* @return TZend_Db_Table_Row|null current element from the collection
*/
public function current()
{
Expand Down Expand Up @@ -332,7 +335,7 @@ public function offsetExists($offset)
* Required by the ArrayAccess implementation
*
* @param string $offset
* @return Zend_Db_Table_Row_Abstract
* @return TZend_Db_Table_Row
*/
public function offsetGet($offset)
{
Expand Down Expand Up @@ -371,7 +374,7 @@ public function offsetUnset($offset)
*
* @param int $position the position of the row expected
* @param bool $seek wether or not seek the iterator to that position after
* @return Zend_Db_Table_Row
* @return TZend_Db_Table_Row
* @throws Zend_Db_Table_Rowset_Exception
*/
public function getRow($position, $seek = false)
Expand All @@ -394,7 +397,7 @@ public function getRow($position, $seek = false)
*
* Updates the $_data property with current row object values.
*
* @return array
* @return array<int, array<string, mixed>>
*/
public function toArray()
{
Expand All @@ -406,6 +409,10 @@ public function toArray()
return $this->_data;
}

/**
* @param $position
* @return TZend_Db_Table_Row
*/
protected function _loadAndReturnRow($position)
{
if (!isset($this->_data[$position])) {
Expand Down