[TOOLS][PHPStan] Add missing toString on the call to DB::filterName, as it seems something changed in some update

This commit is contained in:
Hugo Sales 2021-10-10 09:51:21 +01:00 committed by Diogo Peralta Cordeiro
parent b65ee4c21d
commit b524c5bc90
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0

View File

@ -43,7 +43,7 @@ class ClassFromTableNameDynamicStaticMethodReturnTypeExtension implements Dynami
): \PHPStan\Type\Type { ): \PHPStan\Type\Type {
if (isset($_ENV['PHPSTAN_BOOT_KERNEL']) && \count($staticCall->args) >= 1 && ($arg = $staticCall->args[0]->value) instanceof String_) { if (isset($_ENV['PHPSTAN_BOOT_KERNEL']) && \count($staticCall->args) >= 1 && ($arg = $staticCall->args[0]->value) instanceof String_) {
// If called with the first argument as a string, it's a table name // If called with the first argument as a string, it's a table name
return $scope->resolveTypeByName(new Name(DB::filterTableName($staticCall->name, [$arg->value]))); return $scope->resolveTypeByName(new Name(DB::filterTableName($staticCall->name->toString(), [$arg->value])));
} else { } else {
// Let PHPStan handle it normally // Let PHPStan handle it normally
return \PHPStan\Reflection\ParametersAcceptorSelector::selectFromArgs($scope, $staticCall->args, $methodReflection->getVariants())->getReturnType(); return \PHPStan\Reflection\ParametersAcceptorSelector::selectFromArgs($scope, $staticCall->args, $methodReflection->getVariants())->getReturnType();