git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove usages of 'each', as it is deprecated in php 7.2
[plcapi.git]
/
src
/
Value.php
diff --git
a/src/Value.php
b/src/Value.php
index
97852b0
..
8747e69
100644
(file)
--- a/
src/Value.php
+++ b/
src/Value.php
@@
-329,8
+329,8
@@
class Value implements \Countable, \IteratorAggregate, \ArrayAccess
*/
public function serialize($charsetEncoding = '')
{
*/
public function serialize($charsetEncoding = '')
{
- reset($this->me);
-
list($typ, $val) = each
($this->me);
+
$val =
reset($this->me);
+
$typ = key
($this->me);
return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
}
return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
}
@@
-394,8
+394,7
@@
class Value implements \Countable, \IteratorAggregate, \ArrayAccess
*/
public function scalarval()
{
*/
public function scalarval()
{
- reset($this->me);
- list(, $b) = each($this->me);
+ $b = reset($this->me);
return $b;
}
return $b;
}
@@
-410,7
+409,7
@@
class Value implements \Countable, \IteratorAggregate, \ArrayAccess
public function scalartyp()
{
reset($this->me);
public function scalartyp()
{
reset($this->me);
-
list($a,) = each
($this->me);
+
$a = key
($this->me);
if ($a == static::$xmlrpcI4) {
$a = static::$xmlrpcInt;
}
if ($a == static::$xmlrpcI4) {
$a = static::$xmlrpcInt;
}
@@
-525,7
+524,7
@@
class Value implements \Countable, \IteratorAggregate, \ArrayAccess
case 1:
// todo: handle i4 vs int
reset($this->me);
case 1:
// todo: handle i4 vs int
reset($this->me);
-
list($type,) = each
($this->me);
+
$type = key
($this->me);
if ($type != $offset) {
throw new \Exception('');
}
if ($type != $offset) {
throw new \Exception('');
}
@@
-575,8
+574,8
@@
class Value implements \Countable, \IteratorAggregate, \ArrayAccess
return isset($this->me['array'][$offset]) ? $this->me['array'][$offset] : null;
case 1:
// on bad type: null or exception?
return isset($this->me['array'][$offset]) ? $this->me['array'][$offset] : null;
case 1:
// on bad type: null or exception?
- reset($this->me);
-
list($type, $value) = each
($this->me);
+
$value =
reset($this->me);
+
$type = key
($this->me);
return $type == $offset ? $value : null;
default:
// return null or exception?
return $type == $offset ? $value : null;
default:
// return null or exception?