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 44
55use PHPStan \Reflection \ClassMemberReflection ;
66use PHPStan \Reflection \ClassReflection ;
7+ use PHPStan \Reflection \FunctionVariant ;
78use PHPStan \Reflection \MethodReflection ;
89use PHPStan \Type \ObjectType ;
9- use PHPStan \Type \Type ;
1010
1111class DibiFluentMethodReflection implements MethodReflection
1212{
@@ -43,19 +43,6 @@ public function isStatic(): bool
4343 return false ;
4444 }
4545
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-
5946 public function isPrivate (): bool
6047 {
6148 return false ;
@@ -66,9 +53,18 @@ public function isPublic(): bool
6653 return true ;
6754 }
6855
69- public function getReturnType (): Type
56+ /**
57+ * @return \PHPStan\Reflection\ParametersAcceptor[]
58+ */
59+ public function getVariants (): array
7060 {
71- return new ObjectType (\Dibi \Fluent::class);
61+ return [
62+ new FunctionVariant (
63+ [],
64+ true ,
65+ new ObjectType (\Dibi \Fluent::class)
66+ ),
67+ ];
7268 }
7369
7470}
Original file line number Diff line number Diff line change 22
33namespace PHPStan \Reflection \Dibi ;
44
5+ use PHPStan \Reflection \ParametersAcceptorSelector ;
56use PHPStan \Type \VerbosityLevel ;
67
78class DibiFluentClassReflectionExtensionTest extends \PHPStan \Testing \TestCase
@@ -48,14 +49,15 @@ public function testGetMethod(): void
4849 {
4950 $ classReflection = $ this ->broker ->getClass (\Dibi \Fluent::class);
5051 $ methodReflection = $ this ->extension ->getMethod ($ classReflection , 'select ' );
52+ $ parametersAcceptor = ParametersAcceptorSelector::selectSingle ($ methodReflection ->getVariants ());
5153 self ::assertSame ('select ' , $ methodReflection ->getName ());
5254 self ::assertSame ($ classReflection , $ methodReflection ->getDeclaringClass ());
5355 self ::assertFalse ($ methodReflection ->isStatic ());
54- self ::assertEmpty ($ methodReflection ->getParameters ());
55- self ::assertTrue ($ methodReflection ->isVariadic ());
56+ self ::assertEmpty ($ parametersAcceptor ->getParameters ());
57+ self ::assertTrue ($ parametersAcceptor ->isVariadic ());
5658 self ::assertFalse ($ methodReflection ->isPrivate ());
5759 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 ()));
5961 }
6062
6163}
You can’t perform that action at this time.
0 commit comments