Skip to content

Commit 3fc789b

Browse files
committed
mistake array_unshift
1 parent c7a5d63 commit 3fc789b

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/Kernel/Mnemonics/_invokestatic.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ public function execute(): void
6161
$methodAccessor = $reflectionClass->getMethod("{$prefix}{$methodName}");
6262

6363
if ($document = $methodAccessor->getDocComment()) {
64-
array_unshift(
65-
$arguments,
66-
...$this->getNativeAnnotateInjections($document)
67-
);
64+
$prependInjections = $this->getNativeAnnotateInjections($document);
65+
if (!empty($prependInjections)) {
66+
array_unshift(
67+
$arguments,
68+
...$prependInjections
69+
);
70+
}
6871
}
6972

7073
$return = forward_static_call_array(

src/Kernel/Mnemonics/_invokevirtual.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ public function execute(): void
5555
$methodAccessor = $reflectionClass->getMethod($methodName);
5656

5757
if ($document = $methodAccessor->getDocComment()) {
58-
array_unshift(
59-
$arguments,
60-
...$this->getNativeAnnotateInjections($document)
61-
);
58+
$prependInjections = $this->getNativeAnnotateInjections($document);
59+
if (!empty($prependInjections)) {
60+
array_unshift(
61+
$arguments,
62+
...$prependInjections
63+
);
64+
}
6265
}
6366

6467
$result = call_user_func_array(

0 commit comments

Comments
 (0)