Skip to content

Commit ef7737c

Browse files
committed
Fix PHP deprecations on ArrayAccess and additional classes
1 parent 5ec53b7 commit ef7737c

16 files changed

+129
-112
lines changed

lib/Doctrine/Access.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ public function __unset($name)
9696
}
9797

9898
/**
99-
* Check if an offset axists
100-
*
101-
* @param mixed $offset
102-
* @return boolean Whether or not this object contains $offset
99+
* @return bool
103100
*/
104101
#[\ReturnTypeWillChange]
105102
public function offsetExists($offset)
@@ -108,10 +105,6 @@ public function offsetExists($offset)
108105
}
109106

110107
/**
111-
* An alias of get()
112-
*
113-
* @see get, __get
114-
* @param mixed $offset
115108
* @return mixed
116109
*/
117110
#[\ReturnTypeWillChange]
@@ -127,11 +120,6 @@ public function offsetGet($offset)
127120
}
128121

129122
/**
130-
* Sets $offset to $value
131-
*
132-
* @see set, __set
133-
* @param mixed $offset
134-
* @param mixed $value
135123
* @return void
136124
*/
137125
#[\ReturnTypeWillChange]
@@ -145,22 +133,19 @@ public function offsetSet($offset, $value)
145133
}
146134

147135
/**
148-
* Unset a given offset
149-
*
150-
* @see set, offsetSet, __set
151-
* @param mixed $offset
136+
* @return void
152137
*/
153138
#[\ReturnTypeWillChange]
154139
public function offsetUnset($offset)
155140
{
156-
return $this->remove($offset);
141+
$this->remove($offset);
157142
}
158143

159144
/**
160145
* Remove the element with the specified offset
161146
*
162147
* @param mixed $offset The offset to remove
163-
* @return boolean True if removed otherwise false
148+
* @return bool True if removed otherwise false
164149
*/
165150
public function remove($offset)
166151
{
@@ -191,8 +176,8 @@ public function set($offset, $value)
191176
}
192177

193178
/**
194-
* Check if the specified offset exists
195-
*
179+
* Check if the specified offset exists
180+
*
196181
* @param mixed $offset The offset to check
197182
* @return boolean True if exists otherwise false
198183
*/
@@ -202,9 +187,9 @@ public function contains($offset)
202187
}
203188

204189
/**
205-
* Add the value
206-
*
207-
* @param mixed $value The value to add
190+
* Add the value
191+
*
192+
* @param mixed $value The value to add
208193
* @return void
209194
*/
210195
public function add($value)

lib/Doctrine/Connection/Common.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ class Doctrine_Connection_Common extends Doctrine_Connection
3838
* @param string $query
3939
* @param mixed $limit
4040
* @param mixed $offset
41+
* @return string
4142
*/
4243
public function modifyLimitQuery($query, $limit = false,$offset = false,$isManip=false)
4344
{
4445
$limit = (int) $limit;
4546
$offset = (int) $offset;
46-
47+
4748
if ($limit && $offset) {
4849
$query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
4950
} elseif ($limit && ! $offset) {
@@ -54,4 +55,4 @@ public function modifyLimitQuery($query, $limit = false,$offset = false,$isManip
5455

5556
return $query;
5657
}
57-
}
58+
}

lib/Doctrine/Hydrator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct()
5151
/**
5252
* Set the hydration mode
5353
*
54-
* @param mixed $hydrationMode One of the Doctrine_Core::HYDRATE_* constants or
54+
* @param mixed $hydrationMode One of the Doctrine_Core::HYDRATE_* constants or
5555
* a string representing the name of the hydration mode or
5656
* or an instance of the hydration class
5757
*/
@@ -112,9 +112,9 @@ public function getHydratorDriverClassName($mode = null)
112112
/**
113113
* Get an instance of the hydration driver for the passed hydration mode
114114
*
115-
* @param string $mode
116-
* @param array $tableAliases
117-
* @return object Doctrine_Hydrator_Abstract
115+
* @param string $mode
116+
* @param array $tableAliases
117+
* @return Doctrine_Hydrator_Abstract
118118
*/
119119
public function getHydratorDriver($mode, $tableAliases)
120120
{
@@ -138,8 +138,8 @@ public function getHydratorDriver($mode, $tableAliases)
138138
* Hydrate the query statement in to its final data structure by one of the
139139
* hydration drivers.
140140
*
141-
* @param object $stmt
142-
* @param array $tableAliases
141+
* @param object $stmt
142+
* @param array $tableAliases
143143
* @return mixed $result
144144
*/
145145
public function hydrateResultSet($stmt, $tableAliases)
@@ -149,4 +149,4 @@ public function hydrateResultSet($stmt, $tableAliases)
149149

150150
return $result;
151151
}
152-
}
152+
}

lib/Doctrine/Hydrator/Abstract.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ public function onDemandReset()
9797
* (I.e. ORACLE limit/offset emulation adds doctrine_rownum to the result set).
9898
*
9999
* @param string $name
100-
* @return boolean
100+
* @return bool
101101
*/
102102
protected function _isIgnoredName($name)
103103
{
104-
return $name == 'DOCTRINE_ROWNUM';
104+
return $name === 'DOCTRINE_ROWNUM';
105105
}
106106

107107
/**
@@ -114,8 +114,7 @@ protected function _isIgnoredName($name)
114114
* The key idea is the loop over the rowset only once doing all the needed operations
115115
* within this massive loop.
116116
*
117-
* @param mixed $stmt
118117
* @return mixed
119118
*/
120119
abstract public function hydrateResultSet($stmt);
121-
}
120+
}

lib/Doctrine/Hydrator/ArrayHierarchyDriver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
*/
3333
class Doctrine_Hydrator_ArrayHierarchyDriver extends Doctrine_Hydrator_ArrayDriver
3434
{
35+
/**
36+
* @return array
37+
*/
3538
public function hydrateResultSet($stmt)
3639
{
3740
$collection = parent::hydrateResultSet($stmt);
@@ -80,4 +83,4 @@ public function hydrateResultSet($stmt)
8083
}
8184
return $trees;
8285
}
83-
}
86+
}

lib/Doctrine/Hydrator/ArrayShallowDriver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
*/
3333
class Doctrine_Hydrator_ArrayShallowDriver extends Doctrine_Hydrator_ScalarDriver
3434
{
35+
/**
36+
* @return array
37+
*/
3538
public function hydrateResultSet($stmt)
3639
{
3740
$cache = array();
@@ -41,4 +44,4 @@ public function hydrateResultSet($stmt)
4144
}
4245
return $result;
4346
}
44-
}
47+
}

lib/Doctrine/Hydrator/Graph.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ protected function _getCustomIndexField($alias)
5050
return isset($this->_queryComponents[$alias]['map']) ? $this->_queryComponents[$alias]['map'] : null;
5151
}
5252

53+
/**
54+
* @return Doctrine_Collection|mixed
55+
*/
5356
public function hydrateResultSet($stmt)
5457
{
5558
// Used variables during hydration

lib/Doctrine/Hydrator/NoneDriver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
*/
3434
class Doctrine_Hydrator_NoneDriver extends Doctrine_Hydrator_Abstract
3535
{
36+
/**
37+
* @return mixed
38+
*/
3639
public function hydrateResultSet($stmt)
3740
{
3841
return $stmt->fetchAll(PDO::FETCH_NUM);
3942
}
40-
}
43+
}

lib/Doctrine/Hydrator/RecordHierarchyDriver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@
3232
*/
3333
class Doctrine_Hydrator_RecordHierarchyDriver extends Doctrine_Hydrator_RecordDriver
3434
{
35+
/**
36+
* @return Doctrine_Collection
37+
*/
3538
public function hydrateResultSet($stmt)
3639
{
3740
return parent::hydrateResultSet($stmt)->toHierarchy();
3841
}
39-
}
42+
}

lib/Doctrine/Hydrator/ScalarDriver.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
*/
3333
class Doctrine_Hydrator_ScalarDriver extends Doctrine_Hydrator_Abstract
3434
{
35+
/**
36+
* @return array
37+
*/
3538
public function hydrateResultSet($stmt)
3639
{
3740
$cache = array();
@@ -55,7 +58,7 @@ protected function _gatherRowData($data, &$cache, $aliasPrefix = true)
5558
}
5659
// cache general information like the column name <-> field name mapping
5760
$e = explode('__', $key);
58-
$columnName = strtolower(array_pop($e));
61+
$columnName = strtolower(array_pop($e));
5962
$cache[$key]['dqlAlias'] = $this->_tableAliases[strtolower(implode('__', $e))];
6063
$table = $this->_queryComponents[$cache[$key]['dqlAlias']]['table'];
6164
// check whether it's an aggregate value or a regular field
@@ -84,7 +87,7 @@ protected function _gatherRowData($data, &$cache, $aliasPrefix = true)
8487
$fieldName = $cache[$key]['fieldName'];
8588

8689
$rowDataKey = $aliasPrefix ? $dqlAlias . '_' . $fieldName:$fieldName;
87-
90+
8891
if ($cache[$key]['isSimpleType'] || $cache[$key]['isAgg']) {
8992
$rowData[$rowDataKey] = $value;
9093
} else {
@@ -94,4 +97,4 @@ protected function _gatherRowData($data, &$cache, $aliasPrefix = true)
9497
}
9598
return $rowData;
9699
}
97-
}
100+
}

0 commit comments

Comments
 (0)