Skip to content

Commit 3eea010

Browse files
Fixed a bug when working with text values like function names
1 parent d9b6069 commit 3eea010

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Concerns/Call.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ trait Call
1010

1111
protected function call(mixed $callback = null): mixed
1212
{
13-
return $this->isCallable($callback) ? $callback() : $callback;
13+
return $this->isCallable($callback) && ! $this->isFunction($callback) ? $callback() : $callback;
1414
}
1515

1616
protected function makeCallable($value): callable
1717
{
18-
if ($this->isCallable($value)) {
18+
if ($this->isCallable($value) && ! $this->isFunction($value)) {
1919
return $value;
2020
}
2121

@@ -28,4 +28,9 @@ protected function isCallable($value): bool
2828
{
2929
return is_callable($value);
3030
}
31+
32+
protected function isFunction($value): bool
33+
{
34+
return is_string($value) && function_exists($value);
35+
}
3136
}

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ abstract class TestCase extends BaseTestCase
2828

2929
protected array $keys = ['Foo', 'Bar', 'Baz'];
3030

31-
protected mixed $value = 'Foo';
31+
protected mixed $value = 'value';
3232

33-
protected string $value_second = 'Bar';
33+
protected string $value_second = 'Foo';
3434

3535
protected function getPackageProviders($app): array
3636
{

0 commit comments

Comments
 (0)