Skip to content

Commit eff4062

Browse files
committed
call_user_func replaced with expression
1 parent f9c400d commit eff4062

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Iterators/Mapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(\Traversable $iterator, callable $callback)
2828

2929
public function current()
3030
{
31-
return call_user_func($this->callback, parent::current(), parent::key());
31+
return ($this->callback)(parent::current(), parent::key());
3232
}
3333

3434
}

src/Utils/Callback.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function closure($callable, $m = NULL)
5959
public static function invoke($callable, ...$args)
6060
{
6161
self::check($callable);
62-
return call_user_func_array($callable, $args);
62+
return $callable(...$args);
6363
}
6464

6565

@@ -70,7 +70,7 @@ public static function invoke($callable, ...$args)
7070
public static function invokeArgs($callable, array $args = [])
7171
{
7272
self::check($callable);
73-
return call_user_func_array($callable, $args);
73+
return $callable(...$args);
7474
}
7575

7676

src/Utils/ObjectMixin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static function call($_this, $name, $args)
113113
}
114114

115115
} elseif ($isProp && $_this->$name instanceof \Closure) { // closure in property
116-
return call_user_func_array($_this->$name, $args);
116+
return ($_this->$name)(...$args);
117117

118118
} elseif (($methods = &self::getMethods($class)) && isset($methods[$name]) && is_array($methods[$name])) { // magic @methods
119119
list($op, $rp, $type) = $methods[$name];
@@ -420,7 +420,7 @@ public static function checkType(&$val, $type)
420420
case 'callable':
421421
case 'resource':
422422
case 'null':
423-
return call_user_func("is_$type", $val);
423+
return ("is_$type")($val);
424424
default:
425425
return $val instanceof $type;
426426
}

src/Utils/Validators.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public static function is($value, $expected)
130130

131131
list($type) = $item = explode(':', $item, 2);
132132
if (isset(static::$validators[$type])) {
133-
if (!call_user_func(static::$validators[$type], $value)) {
133+
if (!static::$validators[$type]($value)) {
134134
continue;
135135
}
136136
} elseif ($type === 'pattern') {
@@ -145,7 +145,7 @@ public static function is($value, $expected)
145145
if (isset($item[1])) {
146146
$length = $value;
147147
if (isset(static::$counters[$type])) {
148-
$length = call_user_func(static::$counters[$type], $value);
148+
$length = static::$counters[$type]($value);
149149
}
150150
$range = explode('..', $item[1]);
151151
if (!isset($range[1])) {

0 commit comments

Comments
 (0)