From d0a6a3b10746e0997350fd6bdbecea4e9026ae0b Mon Sep 17 00:00:00 2001 From: Martin Stefanov Date: Wed, 21 Nov 2018 18:57:48 +0200 Subject: [PATCH 1/2] Fix type error for facades because of wrong implementation. --- src/ReflectionMethodAlwaysStatic.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/ReflectionMethodAlwaysStatic.php b/src/ReflectionMethodAlwaysStatic.php index ab05f2d..98a33a9 100644 --- a/src/ReflectionMethodAlwaysStatic.php +++ b/src/ReflectionMethodAlwaysStatic.php @@ -2,19 +2,11 @@ namespace Weebly\PHPStan\Laravel; -final class ReflectionMethodAlwaysStatic extends \ReflectionMethod -{ - /** - * @param \ReflectionMethod $reflectionMethod - * - * @throws \ReflectionException - */ - public function __construct(\ReflectionMethod $reflectionMethod) - { - parent::__construct($reflectionMethod->getDeclaringClass()->getName(), $reflectionMethod->getName()); - } +use PHPStan\Reflection\Php\NativeBuiltinMethodReflection; - public function isStatic() +final class ReflectionMethodAlwaysStatic extends NativeBuiltinMethodReflection +{ + public function isStatic(): bool { return true; } From 61c00d7a610f19ab842bf012a7467c6f0115b4f3 Mon Sep 17 00:00:00 2001 From: Martin Stefanov Date: Wed, 21 Nov 2018 18:58:56 +0200 Subject: [PATCH 2/2] Fix type error for static create of model. --- src/MethodReflectionFactory.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MethodReflectionFactory.php b/src/MethodReflectionFactory.php index 6081f46..6fbd143 100644 --- a/src/MethodReflectionFactory.php +++ b/src/MethodReflectionFactory.php @@ -8,6 +8,7 @@ use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\Php\PhpMethodReflectionFactory; +use PHPStan\Reflection\Php\NativeBuiltinMethodReflection; use PHPStan\Type\FileTypeMapper; use PHPStan\Type\Type; @@ -80,6 +81,8 @@ public function create(ClassReflection $classReflection, \ReflectionMethod $meth if ($methodWrapper) { $methodReflection = new $methodWrapper($methodReflection); + } else { + $methodReflection = new NativeBuiltinMethodReflection($methodReflection); } return $this->methodReflectionFactory->create(