manager = $resolver->getManager(); } public function getClass(): string { return \App\Core\DB\DB::class; } public function isStaticMethodSupported(MethodReflection $methodReflection): bool { return in_array($methodReflection->getName(), DB::METHODS_ACCEPTING_TABLE_NAME); } public function getTypeFromStaticMethodCall( MethodReflection $methodReflection, StaticCall $staticCall, Scope $scope ): \PHPStan\Type\Type { if (count($staticCall->args) === 0) { return \PHPStan\Reflection\ParametersAcceptorSelector::selectFromArgs($scope, $staticCall->args, $methodReflection->getVariants())->getReturnType(); } $arg = $staticCall->args[0]->value; if ($arg instanceof String_) { DB::setManager($this->manager); DB::initTableMap(); $class = DB::filterTableName($staticCall->name, [$arg->value]); return $scope->resolveTypeByName(new Name($class)); } else { return \PHPStan\Reflection\ParametersAcceptorSelector::selectFromArgs($scope, $staticCall->args, $methodReflection->getVariants())->getReturnType(); } } }