Skip to content

Commit

Permalink
Merge pull request #147 from zf1s/php81-compat-returntypewillchange
Browse files Browse the repository at this point in the history
php 8.1 compat: ReturnTypeWillChange Attribute
  • Loading branch information
falkenhawk authored Nov 28, 2022
2 parents 2a60786 + d7ba9c8 commit 9d61914
Show file tree
Hide file tree
Showing 134 changed files with 510 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"ext-xml": "*",
"ext-zlib": "*",
"php-parallel-lint/php-parallel-lint": "1.3.0",
"phpunit/dbunit": "1.3.2",
"staabm/annotate-pull-request-from-checkstyle": "1.5.0",
"zf1s/phpunit": "3.7.40"
"zf1s/dbunit": "1.3.2",
"zf1s/phpunit": "3.7.42"
},
"autoload": {
"psr-0": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public function __set($name, $value)
* @param string $name
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($this->_fields[$name]);
Expand All @@ -172,6 +173,7 @@ public function offsetExists($name)
* @param string $name
* @return mixed
*/
#[ReturnTypeWillChange]
public function offsetGet($name)
{
return $this->getField($name);
Expand All @@ -184,6 +186,7 @@ public function offsetGet($name)
* @param mixed $value
* @return void
*/
#[ReturnTypeWillChange]
public function offsetSet($name, $value)
{
$this->setField($name, $value);
Expand All @@ -195,6 +198,7 @@ public function offsetSet($name, $value)
* @param string $name
* @return void
*/
#[ReturnTypeWillChange]
public function offsetUnset($name)
{
if ($this->offsetExists($name)) {
Expand Down Expand Up @@ -231,6 +235,7 @@ public function __call($name, $args)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return count($this->_fields);
Expand All @@ -241,6 +246,7 @@ public function count()
*
* @return Iterator
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->_fields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(array $documents)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return $this->_documentCount;
Expand All @@ -61,6 +62,7 @@ public function count()
*
* @return Traversable
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return $this->_documents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected function addImage(Zend_Cloud_Infrastructure_Image $image)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return count($this->images);
Expand All @@ -99,6 +100,7 @@ public function count()
*
* @return Image
*/
#[ReturnTypeWillChange]
public function current()
{
return $this->images[$this->iteratorKey];
Expand All @@ -111,6 +113,7 @@ public function current()
*
* @return int
*/
#[ReturnTypeWillChange]
public function key()
{
return $this->iteratorKey;
Expand All @@ -123,6 +126,7 @@ public function key()
*
* @return void
*/
#[ReturnTypeWillChange]
public function next()
{
$this->iteratorKey++;
Expand All @@ -135,6 +139,7 @@ public function next()
*
* @return void
*/
#[ReturnTypeWillChange]
public function rewind()
{
$this->iteratorKey = 0;
Expand All @@ -147,6 +152,7 @@ public function rewind()
*
* @return bool
*/
#[ReturnTypeWillChange]
public function valid()
{
$numItems = $this->count();
Expand All @@ -164,6 +170,7 @@ public function valid()
* @param int $offset
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return ($offset < $this->count());
Expand All @@ -178,6 +185,7 @@ public function offsetExists($offset)
* @throws Zend_Cloud_Infrastructure_Exception
* @return Image
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
Expand All @@ -196,6 +204,7 @@ public function offsetGet($offset)
* @param string $value
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand All @@ -210,6 +219,7 @@ public function offsetSet($offset, $value)
* @param int $offset
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[ReturnTypeWillChange]
public function offsetUnset($offset)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ protected function addInstance(Zend_Cloud_Infrastructure_Instance $instance)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return count($this->instances);
Expand All @@ -100,6 +101,7 @@ public function count()
*
* @return Instance
*/
#[ReturnTypeWillChange]
public function current()
{
return $this->instances[$this->iteratorKey];
Expand All @@ -112,6 +114,7 @@ public function current()
*
* @return int
*/
#[ReturnTypeWillChange]
public function key()
{
return $this->iteratorKey;
Expand All @@ -124,6 +127,7 @@ public function key()
*
* @return void
*/
#[ReturnTypeWillChange]
public function next()
{
$this->iteratorKey++;
Expand All @@ -136,6 +140,7 @@ public function next()
*
* @return void
*/
#[ReturnTypeWillChange]
public function rewind()
{
$this->iteratorKey = 0;
Expand All @@ -148,6 +153,7 @@ public function rewind()
*
* @return bool
*/
#[ReturnTypeWillChange]
public function valid()
{
$numItems = $this->count();
Expand All @@ -165,6 +171,7 @@ public function valid()
* @param int $offset
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return ($offset < $this->count());
Expand All @@ -179,6 +186,7 @@ public function offsetExists($offset)
* @return Instance
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
Expand All @@ -197,6 +205,7 @@ public function offsetGet($offset)
* @param string $value
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand All @@ -211,6 +220,7 @@ public function offsetSet($offset, $value)
* @param int $offset
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[ReturnTypeWillChange]
public function offsetUnset($offset)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(array $messages)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return $this->_messageCount;
Expand All @@ -61,6 +62,7 @@ public function count()
*
* @return Traversable
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return $this->_messages;
Expand Down
6 changes: 6 additions & 0 deletions packages/zend-config/library/Zend/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public function __unset($name)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return $this->_count;
Expand All @@ -271,6 +272,7 @@ public function count()
*
* @return mixed
*/
#[ReturnTypeWillChange]
public function current()
{
$this->_skipNextIteration = false;
Expand All @@ -282,6 +284,7 @@ public function current()
*
* @return mixed
*/
#[ReturnTypeWillChange]
public function key()
{
return key($this->_data);
Expand All @@ -291,6 +294,7 @@ public function key()
* Defined by Iterator interface
*
*/
#[ReturnTypeWillChange]
public function next()
{
if ($this->_skipNextIteration) {
Expand All @@ -305,6 +309,7 @@ public function next()
* Defined by Iterator interface
*
*/
#[ReturnTypeWillChange]
public function rewind()
{
$this->_skipNextIteration = false;
Expand All @@ -317,6 +322,7 @@ public function rewind()
*
* @return boolean
*/
#[ReturnTypeWillChange]
public function valid()
{
return $this->_index < $this->_count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public function clearCurrentMessages($namespace = null)
*
* @return ArrayObject
*/
#[ReturnTypeWillChange]
public function getIterator($namespace = null)
{
if (!is_string($namespace) || $namespace == '') {
Expand All @@ -287,6 +288,7 @@ public function getIterator($namespace = null)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count($namespace = null)
{
if (!is_string($namespace) || $namespace == '') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function push(Zend_Controller_Action_Helper_Abstract $helper)
*
* @return array
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayObject($this->_helpersByPriority);
Expand All @@ -99,6 +100,7 @@ public function getIterator()
* @param int|string $priorityOrHelperName
* @return Zend_Controller_Action_HelperBroker_PriorityStack
*/
#[ReturnTypeWillChange]
public function offsetExists($priorityOrHelperName)
{
if (is_string($priorityOrHelperName)) {
Expand All @@ -114,6 +116,7 @@ public function offsetExists($priorityOrHelperName)
* @param int|string $priorityOrHelperName
* @return Zend_Controller_Action_HelperBroker_PriorityStack
*/
#[ReturnTypeWillChange]
public function offsetGet($priorityOrHelperName)
{
if (!$this->offsetExists($priorityOrHelperName)) {
Expand All @@ -135,6 +138,7 @@ public function offsetGet($priorityOrHelperName)
* @param Zend_Controller_Action_Helper_Abstract $helper
* @return Zend_Controller_Action_HelperBroker_PriorityStack
*/
#[ReturnTypeWillChange]
public function offsetSet($priority, $helper)
{
$priority = (int) $priority;
Expand Down Expand Up @@ -172,6 +176,7 @@ public function offsetSet($priority, $helper)
* @param int|string $priorityOrHelperName Priority integer or the helper name
* @return Zend_Controller_Action_HelperBroker_PriorityStack
*/
#[ReturnTypeWillChange]
public function offsetUnset($priorityOrHelperName)
{
if (!$this->offsetExists($priorityOrHelperName)) {
Expand All @@ -198,6 +203,7 @@ public function offsetUnset($priorityOrHelperName)
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return count($this->_helpersByPriority);
Expand Down
1 change: 1 addition & 0 deletions packages/zend-crypt/library/Zend/Crypt/Rsa/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function __toString()
return $this->toString();
}

#[ReturnTypeWillChange]
public function count()
{
return $this->_details['bits'];
Expand Down
1 change: 1 addition & 0 deletions packages/zend-db/library/Zend/Db/Statement/Pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public function fetch($style = null, $cursor = null, $offset = null)
*
* @return IteratorIterator
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new IteratorIterator($this->_stmt);
Expand Down
Loading

0 comments on commit 9d61914

Please sign in to comment.