Skip to content

Commit 0951fed

Browse files
committed
Updated PHPStan
1 parent 2b6db86 commit 0951fed

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

src/Reflection/Dibi/DibiFluentMethodReflection.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use PHPStan\Reflection\ClassMemberReflection;
66
use PHPStan\Reflection\ClassReflection;
7+
use PHPStan\Reflection\FunctionVariant;
78
use PHPStan\Reflection\MethodReflection;
89
use PHPStan\Type\ObjectType;
9-
use PHPStan\Type\Type;
1010

1111
class 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
}

tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Reflection\Dibi;
44

5+
use PHPStan\Reflection\ParametersAcceptorSelector;
56
use PHPStan\Type\VerbosityLevel;
67

78
class 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
}

0 commit comments

Comments
 (0)