Skip to content

Commit 992fec6

Browse files
committed
1 parent 770de9a commit 992fec6

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

src/Reflection/CallableReflection.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
use ReflectionMethod;
1111

1212
/**
13-
* Create a reflection object from a callable.
13+
* Create a reflection object from a callable or a callable-like.
1414
*
15-
* @internal
15+
* @api
1616
*/
1717
class CallableReflection
1818
{
1919
/**
20+
* @param callable|array|string $callable Can be a callable or a callable-like.
21+
*
2022
* @throws NotCallableException|ReflectionException
2123
*/
22-
public static function create(callable $callable): ReflectionFunctionAbstract
24+
public static function create($callable): ReflectionFunctionAbstract
2325
{
2426
// Closure
2527
if ($callable instanceof Closure) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Invoker\Test\Reflection;
4+
5+
use Invoker\Reflection\CallableReflection;
6+
use PHPUnit\Framework\TestCase;
7+
use ReflectionMethod;
8+
9+
class CallableReflectionTest extends TestCase
10+
{
11+
public function test_with_not_real_PHP_callable_array()
12+
{
13+
$reflection = CallableReflection::create([self::class, 'foo']);
14+
15+
$this->assertInstanceOf(ReflectionMethod::class, $reflection);
16+
}
17+
18+
public function foo(): void
19+
{
20+
}
21+
}

0 commit comments

Comments
 (0)