Skip to content

Commit f4e0ae6

Browse files
committed
[BUGFIX] Update reflections to be compatible with 0.10 interfaces
1 parent 4596c42 commit f4e0ae6

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

src/Reflection/RepositoryFindByMethodReflection.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
use PHPStan\Broker\Broker;
77
use PHPStan\Reflection\ClassReflection;
8+
use PHPStan\Reflection\ClassMemberReflection;
9+
use PHPStan\Reflection\FunctionVariant;
810
use PHPStan\Reflection\MethodReflection;
911
use PHPStan\Type\ObjectType;
1012
use PHPStan\Type\Type;
@@ -55,7 +57,7 @@ public function isPublic(): bool
5557
return true;
5658
}
5759

58-
public function getPrototype(): MethodReflection
60+
public function getPrototype(): ClassMemberReflection
5961
{
6062
return $this;
6163
}
@@ -97,4 +99,18 @@ public function getReturnType(): Type
9799
{
98100
return new ObjectType(QueryResultInterface::class);
99101
}
102+
103+
/**
104+
* @return \PHPStan\Reflection\ParametersAcceptor[]
105+
*/
106+
public function getVariants(): array
107+
{
108+
return [
109+
new FunctionVariant(
110+
$this->getParameters(),
111+
$this->isVariadic(),
112+
$this->getReturnType()
113+
),
114+
];
115+
}
100116
}

src/Reflection/RepositoryFindByParameterReflection.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace SaschaEgerer\PhpstanTypo3\Reflection;
55

66
use PHPStan\Reflection\ParameterReflection;
7+
use PHPStan\Reflection\PassedByReference;
78
use PHPStan\Type\IntegerType;
89
use PHPStan\Type\Type;
910
use PHPStan\Type\TypeCombinator;
@@ -46,13 +47,13 @@ public function getType(): Type
4647
);
4748
}
4849

49-
public function isPassedByReference(): bool
50+
public function isVariadic(): bool
5051
{
5152
return false;
5253
}
5354

54-
public function isVariadic(): bool
55+
public function passedByReference(): PassedByReference
5556
{
56-
return false;
57+
return PassedByReference::createNo();
5758
}
5859
}

src/Reflection/RepositoryFindOneByMethodReflection.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
use PHPStan\Broker\Broker;
77
use PHPStan\Reflection\ClassReflection;
8+
use PHPStan\Reflection\ClassMemberReflection;
9+
use PHPStan\Reflection\FunctionVariant;
810
use PHPStan\Reflection\MethodReflection;
911
use PHPStan\Type\ObjectType;
1012
use PHPStan\Type\Type;
@@ -55,7 +57,7 @@ public function isPublic(): bool
5557
return true;
5658
}
5759

58-
public function getPrototype(): MethodReflection
60+
public function getPrototype(): ClassMemberReflection
5961
{
6062
return $this;
6163
}
@@ -97,4 +99,18 @@ public function getReturnType(): Type
9799
{
98100
return TypeCombinator::addNull(new ObjectType($this->getModelName()));
99101
}
102+
103+
/**
104+
* @return \PHPStan\Reflection\ParametersAcceptor[]
105+
*/
106+
public function getVariants(): array
107+
{
108+
return [
109+
new FunctionVariant(
110+
$this->getParameters(),
111+
$this->isVariadic(),
112+
$this->getReturnType()
113+
),
114+
];
115+
}
100116
}

0 commit comments

Comments
 (0)