Skip to content

Commit a3d56dd

Browse files
committed
used native callback invocation
1 parent 8afa2d8 commit a3d56dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Utils/ObjectMixin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function call($_this, string $name, array $args)
4242
} elseif ($isProp === 'event') { // calling event handlers
4343
if (is_array($_this->$name) || $_this->$name instanceof \Traversable) {
4444
foreach ($_this->$name as $handler) {
45-
Callback::invokeArgs($handler, $args);
45+
$handler(...$args);
4646
}
4747
} elseif ($_this->$name !== null) {
4848
throw new Nette\UnexpectedValueException("Property $class::$$name must be array or null, " . gettype($_this->$name) . ' given.');
@@ -72,7 +72,7 @@ public static function call($_this, string $name, array $args)
7272
return $_this;
7373

7474
} elseif ($cb = self::getExtensionMethod($class, $name)) { // extension methods
75-
return Callback::invoke($cb, $_this, ...$args);
75+
return $cb($_this, ...$args);
7676

7777
} else {
7878
ObjectHelpers::strictCall($class, $name, array_keys(self::getExtensionMethods($class)));

src/Utils/SmartObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __call(string $name, array $args)
3333
if (ObjectHelpers::hasProperty($class, $name) === 'event') { // calling event handlers
3434
if (is_array($this->$name) || $this->$name instanceof \Traversable) {
3535
foreach ($this->$name as $handler) {
36-
Callback::invokeArgs($handler, $args);
36+
$handler(...$args);
3737
}
3838
} elseif ($this->$name !== null) {
3939
throw new UnexpectedValueException("Property $class::$$name must be array or null, " . gettype($this->$name) . ' given.');

0 commit comments

Comments
 (0)