File tree Expand file tree Collapse file tree 2 files changed +17
-19
lines changed Expand file tree Collapse file tree 2 files changed +17
-19
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use PHPStan \Reflection \ClassMemberReflection ;
6
6
use PHPStan \Reflection \ClassReflection ;
7
+ use PHPStan \Reflection \FunctionVariant ;
7
8
use PHPStan \Reflection \MethodReflection ;
8
9
use PHPStan \Type \ObjectType ;
9
- use PHPStan \Type \Type ;
10
10
11
11
class DibiFluentMethodReflection implements MethodReflection
12
12
{
@@ -43,19 +43,6 @@ public function isStatic(): bool
43
43
return false ;
44
44
}
45
45
46
- /**
47
- * @return \PHPStan\Reflection\ParameterReflection[]
48
- */
49
- public function getParameters (): array
50
- {
51
- return [];
52
- }
53
-
54
- public function isVariadic (): bool
55
- {
56
- return true ;
57
- }
58
-
59
46
public function isPrivate (): bool
60
47
{
61
48
return false ;
@@ -66,9 +53,18 @@ public function isPublic(): bool
66
53
return true ;
67
54
}
68
55
69
- public function getReturnType (): Type
56
+ /**
57
+ * @return \PHPStan\Reflection\ParametersAcceptor[]
58
+ */
59
+ public function getVariants (): array
70
60
{
71
- return new ObjectType (\Dibi \Fluent::class);
61
+ return [
62
+ new FunctionVariant (
63
+ [],
64
+ true ,
65
+ new ObjectType (\Dibi \Fluent::class)
66
+ ),
67
+ ];
72
68
}
73
69
74
70
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace PHPStan \Reflection \Dibi ;
4
4
5
+ use PHPStan \Reflection \ParametersAcceptorSelector ;
5
6
use PHPStan \Type \VerbosityLevel ;
6
7
7
8
class DibiFluentClassReflectionExtensionTest extends \PHPStan \Testing \TestCase
@@ -48,14 +49,15 @@ public function testGetMethod(): void
48
49
{
49
50
$ classReflection = $ this ->broker ->getClass (\Dibi \Fluent::class);
50
51
$ methodReflection = $ this ->extension ->getMethod ($ classReflection , 'select ' );
52
+ $ parametersAcceptor = ParametersAcceptorSelector::selectSingle ($ methodReflection ->getVariants ());
51
53
self ::assertSame ('select ' , $ methodReflection ->getName ());
52
54
self ::assertSame ($ classReflection , $ methodReflection ->getDeclaringClass ());
53
55
self ::assertFalse ($ methodReflection ->isStatic ());
54
- self ::assertEmpty ($ methodReflection ->getParameters ());
55
- self ::assertTrue ($ methodReflection ->isVariadic ());
56
+ self ::assertEmpty ($ parametersAcceptor ->getParameters ());
57
+ self ::assertTrue ($ parametersAcceptor ->isVariadic ());
56
58
self ::assertFalse ($ methodReflection ->isPrivate ());
57
59
self ::assertTrue ($ methodReflection ->isPublic ());
58
- self ::assertSame (\Dibi \Fluent::class, $ methodReflection ->getReturnType ()->describe (VerbosityLevel::value ()));
60
+ self ::assertSame (\Dibi \Fluent::class, $ parametersAcceptor ->getReturnType ()->describe (VerbosityLevel::value ()));
59
61
}
60
62
61
63
}
You can’t perform that action at this time.
0 commit comments