fix: revert higher order message property

This commit is contained in:
Nuno Maduro
2023-06-15 10:44:52 +02:00
parent e42d224db2
commit 2122e57990
2 changed files with 4 additions and 2 deletions

View File

@ -55,7 +55,9 @@ final class HigherOrderMessage
}
try {
return Reflection::call($target, $this->name, is_array($this->arguments) ? $this->arguments : []);
return is_array($this->arguments)
? Reflection::call($target, $this->name, $this->arguments)
: $target->{$this->name}; /* @phpstan-ignore-line */
} catch (Throwable $throwable) {
Reflection::setPropertyValue($throwable, 'file', $this->filename);
Reflection::setPropertyValue($throwable, 'line', $this->line);

View File

@ -7,7 +7,7 @@ test('undefined method exceptions', function () {
__FILE__,
1,
'foqwdqwd',
null
[]
);
expect(fn () => $message->call($this))->toThrow(function (ReflectionException $exception) {