|
2 | 2 |
|
3 | 3 | namespace PHPStan\Tests;
|
4 | 4 |
|
| 5 | +use PhpParser\Node\Expr\ClassConstFetch; |
5 | 6 | use PhpParser\Node\Expr\MethodCall;
|
6 | 7 | use PhpParser\Node\Expr\StaticCall;
|
7 | 8 | use PHPStan\Analyser\Scope;
|
| 9 | +use PHPStan\Reflection\Dummy\ChangedTypeMethodReflection; |
8 | 10 | use PHPStan\Reflection\MethodReflection;
|
9 | 11 | use PHPStan\Reflection\ParametersAcceptorSelector;
|
| 12 | +use PHPStan\Reflection\ResolvedMethodReflection; |
| 13 | +use PHPStan\Reflection\Type\CalledOnTypeUnresolvedMethodPrototypeReflection; |
| 14 | +use PHPStan\Reflection\Type\UnionTypeMethodReflection; |
10 | 15 | use PHPStan\Type\Constant\ConstantStringType;
|
11 | 16 | use PHPStan\Type\DynamicMethodReturnTypeExtension;
|
12 | 17 | use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
|
| 18 | +use PHPStan\Type\IntegerType; |
| 19 | +use PHPStan\Type\IntersectionType; |
| 20 | +use PHPStan\Type\NeverType; |
13 | 21 | use PHPStan\Type\ObjectType;
|
14 | 22 | use PHPStan\Type\ObjectWithoutClassType;
|
15 | 23 | use PHPStan\Type\Type;
|
| 24 | +use PHPStan\Type\TypeCombinator; |
16 | 25 |
|
17 | 26 | class GetByPrimaryDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
|
18 | 27 | {
|
@@ -209,3 +218,25 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
|
209 | 218 | }
|
210 | 219 |
|
211 | 220 | }
|
| 221 | + |
| 222 | +class Bug7344DynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension |
| 223 | +{ |
| 224 | + public function getClass(): string |
| 225 | + { |
| 226 | + return \Bug7344\Model::class; |
| 227 | + } |
| 228 | + |
| 229 | + public function isMethodSupported(MethodReflection $methodReflection): bool |
| 230 | + { |
| 231 | + return $methodReflection->getName() === 'getModel'; |
| 232 | + } |
| 233 | + |
| 234 | + public function getTypeFromMethodCall( |
| 235 | + MethodReflection $methodReflection, |
| 236 | + MethodCall $methodCall, |
| 237 | + Scope $scope |
| 238 | + ): Type { |
| 239 | + return new IntegerType(); |
| 240 | + } |
| 241 | + |
| 242 | +} |
0 commit comments