From a07dd7fae817a328d87e912afed761fe5d1962e2 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Tue, 6 Jul 2021 23:22:54 +0200 Subject: [PATCH] chore: add imports --- src/Fakes/FakeFilesystem.php | 4 ++- src/Fakes/FakeMetaCommand.php | 4 ++- src/Fakes/FakeModelsCommand.php | 6 ++-- src/Handlers/Application/ContainerHandler.php | 9 ++++-- src/Handlers/Eloquent/ModelMethodHandler.php | 24 +++++++++----- .../Eloquent/ModelPropertyAccessorHandler.php | 3 +- .../ModelRelationshipPropertyHandler.php | 32 +++++++++++-------- .../Eloquent/Schema/SchemaAggregator.php | 6 ++-- src/Handlers/Helpers/PathHandler.php | 3 +- src/Handlers/Helpers/TransHandler.php | 3 +- src/Handlers/Helpers/ViewHandler.php | 3 +- src/Plugin.php | 3 +- src/Providers/ApplicationProvider.php | 16 ++++++---- src/Providers/FacadeStubProvider.php | 12 ++++--- src/Providers/ModelStubProvider.php | 9 ++++-- src/Providers/ViewFactoryProvider.php | 3 +- src/Util/ContainerResolver.php | 3 +- src/Util/ProxyMethodReturnTypeProvider.php | 6 ++-- 18 files changed, 97 insertions(+), 52 deletions(-) diff --git a/src/Fakes/FakeFilesystem.php b/src/Fakes/FakeFilesystem.php index eb38bfd..e373475 100644 --- a/src/Fakes/FakeFilesystem.php +++ b/src/Fakes/FakeFilesystem.php @@ -2,7 +2,9 @@ namespace Psalm\LaravelPlugin\Fakes; -class FakeFilesystem extends \Illuminate\Filesystem\Filesystem +use Illuminate\Filesystem\Filesystem; + +class FakeFilesystem extends Filesystem { /** @var ?string */ private $destination = ''; diff --git a/src/Fakes/FakeMetaCommand.php b/src/Fakes/FakeMetaCommand.php index 29a630f..f7520a7 100644 --- a/src/Fakes/FakeMetaCommand.php +++ b/src/Fakes/FakeMetaCommand.php @@ -2,7 +2,9 @@ namespace Psalm\LaravelPlugin\Fakes; -class FakeMetaCommand extends \Barryvdh\LaravelIdeHelper\Console\MetaCommand +use Barryvdh\LaravelIdeHelper\Console\MetaCommand; + +class FakeMetaCommand extends MetaCommand { /** * @return void diff --git a/src/Fakes/FakeModelsCommand.php b/src/Fakes/FakeModelsCommand.php index 085cef6..4188b55 100644 --- a/src/Fakes/FakeModelsCommand.php +++ b/src/Fakes/FakeModelsCommand.php @@ -2,6 +2,8 @@ namespace Psalm\LaravelPlugin\Fakes; +use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; +use Illuminate\Database\Eloquent\Model; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Str; use Psalm\LaravelPlugin\Handlers\Eloquent\Schema\SchemaAggregator; @@ -10,7 +12,7 @@ use function get_class; use function implode; use function in_array; -class FakeModelsCommand extends \Barryvdh\LaravelIdeHelper\Console\ModelsCommand +class FakeModelsCommand extends ModelsCommand { /** @var SchemaAggregator */ private $schema; @@ -36,7 +38,7 @@ class FakeModelsCommand extends \Barryvdh\LaravelIdeHelper\Console\ModelsCommand /** * Load the properties from the database table. * - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model */ protected function getPropertiesFromTable($model) : void { diff --git a/src/Handlers/Application/ContainerHandler.php b/src/Handlers/Application/ContainerHandler.php index 8f28c4e..c7813be 100644 --- a/src/Handlers/Application/ContainerHandler.php +++ b/src/Handlers/Application/ContainerHandler.php @@ -2,6 +2,7 @@ namespace Psalm\LaravelPlugin\Handlers\Application; +use PhpParser\Node\Arg; use Psalm\CodeLocation; use Psalm\Context; use Psalm\Internal\MethodIdentifier; @@ -16,6 +17,8 @@ use Psalm\StatementsSource; use Psalm\Type; use Psalm\Type\Atomic\TNamedObject; use Psalm\Type\Union; +use ReflectionClass; +use Throwable; use function array_filter; use function array_keys; use function get_class; @@ -37,7 +40,7 @@ final class ContainerHandler implements AfterClassLikeVisitInterface, FunctionRe } /** - * @param array<\PhpParser\Node\Arg> $call_args + * @param array $call_args */ public static function getFunctionReturnType(StatementsSource $statements_source, string $function_id, array $call_args, Context $context, CodeLocation $code_location): ?Union { @@ -100,12 +103,12 @@ final class ContainerHandler implements AfterClassLikeVisitInterface, FunctionRe continue; } - $reflectionClass = new \ReflectionClass($concrete); + $reflectionClass = new ReflectionClass($concrete); if ($reflectionClass->isAnonymous()) { continue; } - } catch (\Throwable $e) { + } catch (Throwable $e) { // cannot just catch binding exception as the following error is emitted within laravel: // Class 'Symfony\Component\Cache\Adapter\Psr16Adapter' not found continue; diff --git a/src/Handlers/Eloquent/ModelMethodHandler.php b/src/Handlers/Eloquent/ModelMethodHandler.php index 089ee8c..b9cc37a 100644 --- a/src/Handlers/Eloquent/ModelMethodHandler.php +++ b/src/Handlers/Eloquent/ModelMethodHandler.php @@ -5,13 +5,21 @@ namespace Psalm\LaravelPlugin\Handlers\Eloquent; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use PhpParser\Node\Expr\MethodCall; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassLike; +use Psalm\Codebase; use Psalm\CodeLocation; use Psalm\Context; +use Psalm\FileManipulation; +use Psalm\FileSource; +use Psalm\Internal\Analyzer\StatementsAnalyzer; use Psalm\Internal\MethodIdentifier; use Psalm\LaravelPlugin\Util\ProxyMethodReturnTypeProvider; use Psalm\Plugin\Hook\AfterClassLikeVisitInterface; use Psalm\Plugin\Hook\MethodReturnTypeProviderInterface; use Psalm\StatementsSource; +use Psalm\Storage\ClassLikeStorage; use Psalm\Type; use Psalm\Type\Union; use function strtolower; @@ -37,7 +45,7 @@ final class ModelMethodHandler implements MethodReturnTypeProviderInterface, Aft string $called_fq_classlike_name = null, string $called_method_name_lowercase = null ) : ?Type\Union { - if (!$source instanceof \Psalm\Internal\Analyzer\StatementsAnalyzer) { + if (!$source instanceof StatementsAnalyzer) { return null; } @@ -49,7 +57,7 @@ final class ModelMethodHandler implements MethodReturnTypeProviderInterface, Aft $methodId = new MethodIdentifier($called_fq_classlike_name, $called_method_name_lowercase); $fake_method_call = new MethodCall( - new \PhpParser\Node\Expr\Variable('builder'), + new Variable('builder'), $methodId->method_name, $call_args ); @@ -67,18 +75,18 @@ final class ModelMethodHandler implements MethodReturnTypeProviderInterface, Aft } /** - * @param \Psalm\FileManipulation[] $file_replacements + * @param FileManipulation[] $file_replacements * * @return void */ public static function afterClassLikeVisit( - \PhpParser\Node\Stmt\ClassLike $stmt, - \Psalm\Storage\ClassLikeStorage $storage, - \Psalm\FileSource $statements_source, - \Psalm\Codebase $codebase, + ClassLike $stmt, + ClassLikeStorage $storage, + FileSource $statements_source, + Codebase $codebase, array &$file_replacements = [] ) { - if ($stmt instanceof \PhpParser\Node\Stmt\Class_ + if ($stmt instanceof Class_ && !$storage->abstract && isset($storage->parent_classes[strtolower(Model::class)]) ) { diff --git a/src/Handlers/Eloquent/ModelPropertyAccessorHandler.php b/src/Handlers/Eloquent/ModelPropertyAccessorHandler.php index 6f89e7b..fbacaab 100644 --- a/src/Handlers/Eloquent/ModelPropertyAccessorHandler.php +++ b/src/Handlers/Eloquent/ModelPropertyAccessorHandler.php @@ -2,6 +2,7 @@ namespace Psalm\LaravelPlugin\Handlers\Eloquent; +use Psalm\Codebase; use Psalm\CodeLocation; use Psalm\Context; use Psalm\LaravelPlugin\Providers\ModelStubProvider; @@ -69,7 +70,7 @@ final class ModelPropertyAccessorHandler implements PropertyExistenceProviderInt return null; } - private static function accessorExists(\Psalm\Codebase $codebase, string $fq_classlike_name, string $property_name): bool + private static function accessorExists(Codebase $codebase, string $fq_classlike_name, string $property_name): bool { return $codebase->methodExists($fq_classlike_name . '::get' . str_replace('_', '', $property_name) . 'Attribute'); } diff --git a/src/Handlers/Eloquent/ModelRelationshipPropertyHandler.php b/src/Handlers/Eloquent/ModelRelationshipPropertyHandler.php index dfcd113..5c89831 100644 --- a/src/Handlers/Eloquent/ModelRelationshipPropertyHandler.php +++ b/src/Handlers/Eloquent/ModelRelationshipPropertyHandler.php @@ -9,20 +9,26 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphToMany; use PhpParser; +use Psalm\Codebase; use Psalm\CodeLocation; use Psalm\Context; use Psalm\LaravelPlugin\Providers\ModelStubProvider; +use Psalm\Plugin\Hook\PropertyExistenceProviderInterface; +use Psalm\Plugin\Hook\PropertyTypeProviderInterface; +use Psalm\Plugin\Hook\PropertyVisibilityProviderInterface; use Psalm\StatementsSource; use Psalm\Type; +use Psalm\Type\Atomic\TGenericObject; +use Psalm\Type\Union; use function in_array; /** * @psalm-suppress DeprecatedInterface */ class ModelRelationshipPropertyHandler implements - \Psalm\Plugin\Hook\PropertyExistenceProviderInterface, - \Psalm\Plugin\Hook\PropertyVisibilityProviderInterface, - \Psalm\Plugin\Hook\PropertyTypeProviderInterface + PropertyExistenceProviderInterface, + PropertyVisibilityProviderInterface, + PropertyTypeProviderInterface { /** @return array */ public static function getClassLikeNames() : array @@ -92,7 +98,7 @@ class ModelRelationshipPropertyHandler implements /** * @param array $call_args * - * @return ?Type\Union + * @return ?Union */ public static function getPropertyType( string $fq_classlike_name, @@ -100,7 +106,7 @@ class ModelRelationshipPropertyHandler implements bool $read_mode, StatementsSource $source = null, Context $context = null - ) : ?Type\Union { + ) : ?Union { if (!$source || !$read_mode) { return null; } @@ -113,21 +119,21 @@ class ModelRelationshipPropertyHandler implements return Type::getMixed(); } - /** @var \Psalm\Type\Union|null $modelType */ + /** @var Union|null $modelType */ $modelType = null; - /** @var \Psalm\Type\Atomic\TGenericObject|null $relationType */ + /** @var TGenericObject|null $relationType */ $relationType = null; // In order to get the property value, we need to decipher the generic relation object foreach ($methodReturnType->getAtomicTypes() as $atomicType) { - if (!$atomicType instanceof Type\Atomic\TGenericObject) { + if (!$atomicType instanceof TGenericObject) { continue; } $relationType = $atomicType; foreach ($atomicType->getChildNodes() as $childNode) { - if (!$childNode instanceof Type\Union) { + if (!$childNode instanceof Union) { continue; } foreach ($childNode->getAtomicTypes() as $atomicType) { @@ -152,8 +158,8 @@ class ModelRelationshipPropertyHandler implements ]; if ($modelType && $relationType && in_array($relationType->value, $relationsThatReturnACollection)) { - $returnType = new Type\Union([ - new Type\Atomic\TGenericObject(Collection::class, [ + $returnType = new Union([ + new TGenericObject(Collection::class, [ $modelType ]), ]); @@ -166,13 +172,13 @@ class ModelRelationshipPropertyHandler implements } /** - * @param \Psalm\Codebase $codebase + * @param Codebase $codebase * @param string $fq_classlike_name * @param string $property_name * * @return bool */ - private static function relationExists(\Psalm\Codebase $codebase, string $fq_classlike_name, string $property_name): bool + private static function relationExists(Codebase $codebase, string $fq_classlike_name, string $property_name): bool { // @todo: ensure this is a relation method return $codebase->methodExists($fq_classlike_name . '::' . $property_name); diff --git a/src/Handlers/Eloquent/Schema/SchemaAggregator.php b/src/Handlers/Eloquent/Schema/SchemaAggregator.php index 4f59957..61dff58 100644 --- a/src/Handlers/Eloquent/Schema/SchemaAggregator.php +++ b/src/Handlers/Eloquent/Schema/SchemaAggregator.php @@ -2,6 +2,8 @@ namespace Psalm\LaravelPlugin\Handlers\Eloquent\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; use PhpParser; use function count; use function is_string; @@ -49,7 +51,7 @@ class SchemaAggregator && $stmt->expr instanceof PhpParser\Node\Expr\StaticCall && $stmt->expr->class instanceof PhpParser\Node\Name && $stmt->expr->name instanceof PhpParser\Node\Identifier - && $stmt->expr->class->getAttribute('resolvedName') === \Illuminate\Support\Facades\Schema::class + && $stmt->expr->class->getAttribute('resolvedName') === Schema::class ) { switch ($stmt->expr->name->name) { case 'create': @@ -91,7 +93,7 @@ class SchemaAggregator || count($call->args[1]->value->params) < 1 || ($call->args[1]->value->params[0]->type instanceof PhpParser\Node\Name && $call->args[1]->value->params[0]->type->getAttribute('resolvedName') - !== \Illuminate\Database\Schema\Blueprint::class) + !== Blueprint::class) ) { return; } diff --git a/src/Handlers/Helpers/PathHandler.php b/src/Handlers/Helpers/PathHandler.php index db5b40f..a34a91e 100644 --- a/src/Handlers/Helpers/PathHandler.php +++ b/src/Handlers/Helpers/PathHandler.php @@ -2,6 +2,7 @@ namespace Psalm\LaravelPlugin\Handlers\Helpers; +use Closure; use Psalm\CodeLocation; use Psalm\Context; use Psalm\LaravelPlugin\Providers\ApplicationProvider; @@ -68,7 +69,7 @@ final class PathHandler implements FunctionReturnTypeProviderInterface, MethodRe }); } - private static function resolveReturnType(array $call_args, \Closure $closure): ?Union + private static function resolveReturnType(array $call_args, Closure $closure): ?Union { // we're going to do some dynamic analysis here. Were going to invoke the closure that is wrapping the // app method or the global function in order to determine the literal string path that is returned diff --git a/src/Handlers/Helpers/TransHandler.php b/src/Handlers/Helpers/TransHandler.php index f0481fc..b87a46a 100644 --- a/src/Handlers/Helpers/TransHandler.php +++ b/src/Handlers/Helpers/TransHandler.php @@ -5,10 +5,11 @@ namespace Psalm\LaravelPlugin\Handlers\Helpers; use PhpParser; use Psalm\CodeLocation; use Psalm\Context; +use Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface; use Psalm\StatementsSource; use Psalm\Type; -class TransHandler implements \Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface +class TransHandler implements FunctionReturnTypeProviderInterface { public static function getFunctionIds() : array { diff --git a/src/Handlers/Helpers/ViewHandler.php b/src/Handlers/Helpers/ViewHandler.php index e88d243..dd2c390 100644 --- a/src/Handlers/Helpers/ViewHandler.php +++ b/src/Handlers/Helpers/ViewHandler.php @@ -5,10 +5,11 @@ namespace Psalm\LaravelPlugin\Handlers\Helpers; use PhpParser; use Psalm\CodeLocation; use Psalm\Context; +use Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface; use Psalm\StatementsSource; use Psalm\Type; -class ViewHandler implements \Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface +class ViewHandler implements FunctionReturnTypeProviderInterface { public static function getFunctionIds() : array { diff --git a/src/Plugin.php b/src/Plugin.php index 998ec1f..93f46fd 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -18,6 +18,7 @@ use Psalm\LaravelPlugin\Providers\ModelStubProvider; use Psalm\Plugin\PluginEntryPointInterface; use Psalm\Plugin\RegistrationInterface; use SimpleXMLElement; +use Throwable; use function dirname; use function glob; @@ -29,7 +30,7 @@ class Plugin implements PluginEntryPointInterface try { ApplicationProvider::bootApp(); $this->generateStubFiles(); - } catch (\Throwable $t) { + } catch (Throwable $t) { return; } diff --git a/src/Providers/ApplicationProvider.php b/src/Providers/ApplicationProvider.php index 690a378..1db7141 100644 --- a/src/Providers/ApplicationProvider.php +++ b/src/Providers/ApplicationProvider.php @@ -2,7 +2,11 @@ namespace Psalm\LaravelPlugin\Providers; +use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider; +use Illuminate\Contracts\Console\Kernel; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Foundation\Application as LaravelApplication; +use Laravel\Lumen\Application as LumenApplication; use Orchestra\Testbench\Concerns\CreatesApplication; use function file_exists; use function get_class; @@ -13,30 +17,30 @@ final class ApplicationProvider use CreatesApplication; /** - * @var LaravelApplication|\Laravel\Lumen\Application|null + * @var LaravelApplication|LumenApplication|null */ private static $app; /** - * @return LaravelApplication|\Laravel\Lumen\Application + * @return LaravelApplication|LumenApplication */ public static function bootApp() { $app = self::getApp(); - if ($app instanceof \Illuminate\Contracts\Foundation\Application) { - $app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap(); + if ($app instanceof Application) { + $app->make(Kernel::class)->bootstrap(); } else { $app->boot(); } - $app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); + $app->register(IdeHelperServiceProvider::class); return $app; } /** - * @return LaravelApplication|\Laravel\Lumen\Application + * @return LaravelApplication|LumenApplication */ public static function getApp() { diff --git a/src/Providers/FacadeStubProvider.php b/src/Providers/FacadeStubProvider.php index 975f4b8..1e37003 100644 --- a/src/Providers/FacadeStubProvider.php +++ b/src/Providers/FacadeStubProvider.php @@ -2,7 +2,11 @@ namespace Psalm\LaravelPlugin\Providers; +use Barryvdh\LaravelIdeHelper\Console\GeneratorCommand; +use Illuminate\Config\Repository; use Psalm\LaravelPlugin\Fakes\FakeFilesystem; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\NullOutput; use function unlink; final class FacadeStubProvider implements GeneratesStubs @@ -11,7 +15,7 @@ final class FacadeStubProvider implements GeneratesStubs { $app = ApplicationProvider::getApp(); - /** @var \Illuminate\Config\Repository $config */ + /** @var Repository $config */ $config = $app['config']; // The \Eloquent mixin has less specific return types than our custom plugin can determine, so we unset it here @@ -25,7 +29,7 @@ final class FacadeStubProvider implements GeneratesStubs $fake_filesystem = new FakeFilesystem(); - $stubs_generator_command = new \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand( + $stubs_generator_command = new GeneratorCommand( $config, $fake_filesystem, ViewFactoryProvider::get(), @@ -38,8 +42,8 @@ final class FacadeStubProvider implements GeneratesStubs $fake_filesystem->setDestination(self::getStubFileLocation()); $stubs_generator_command->run( - new \Symfony\Component\Console\Input\ArrayInput([]), - new \Symfony\Component\Console\Output\NullOutput() + new ArrayInput([]), + new NullOutput() ); } diff --git a/src/Providers/ModelStubProvider.php b/src/Providers/ModelStubProvider.php index 9c544cc..4a97053 100644 --- a/src/Providers/ModelStubProvider.php +++ b/src/Providers/ModelStubProvider.php @@ -2,9 +2,12 @@ namespace Psalm\LaravelPlugin\Providers; +use Psalm\Internal\Analyzer\ProjectAnalyzer; use Psalm\LaravelPlugin\Fakes\FakeFilesystem; use Psalm\LaravelPlugin\Fakes\FakeModelsCommand; use Psalm\LaravelPlugin\Handlers\Eloquent\Schema\SchemaAggregator; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\NullOutput; use function dirname; use function glob; use function unlink; @@ -22,7 +25,7 @@ final class ModelStubProvider implements GeneratesStubs $app = ApplicationProvider::getApp(); $migrations_folder = dirname(__DIR__, 4) . '/database/migrations/'; - $project_analyzer = \Psalm\Internal\Analyzer\ProjectAnalyzer::getInstance(); + $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); $schema_aggregator = new SchemaAggregator(); @@ -46,10 +49,10 @@ final class ModelStubProvider implements GeneratesStubs $fake_filesystem->setDestination(self::getStubFileLocation()); $models_generator_command->run( - new \Symfony\Component\Console\Input\ArrayInput([ + new ArrayInput([ '--nowrite' => true ]), - new \Symfony\Component\Console\Output\NullOutput() + new NullOutput() ); self::$model_classes = $models_generator_command->getModels(); diff --git a/src/Providers/ViewFactoryProvider.php b/src/Providers/ViewFactoryProvider.php index f29ad79..e1181f5 100644 --- a/src/Providers/ViewFactoryProvider.php +++ b/src/Providers/ViewFactoryProvider.php @@ -2,6 +2,7 @@ namespace Psalm\LaravelPlugin\Providers; +use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider; use Illuminate\View\Engines\EngineResolver; use Illuminate\View\Engines\PhpEngine; use Illuminate\View\Factory; @@ -13,7 +14,7 @@ final class ViewFactoryProvider { public static function get(): Factory { - $service_helper_reflection = new \ReflectionClass(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); + $service_helper_reflection = new \ReflectionClass(IdeHelperServiceProvider::class); $file_path = $service_helper_reflection->getFileName(); diff --git a/src/Util/ContainerResolver.php b/src/Util/ContainerResolver.php index 5d0f0f6..53ea41a 100644 --- a/src/Util/ContainerResolver.php +++ b/src/Util/ContainerResolver.php @@ -3,6 +3,7 @@ namespace Psalm\LaravelPlugin\Util; use Illuminate\Contracts\Container\BindingResolutionException; +use PhpParser\Node\Arg; use Psalm\LaravelPlugin\Providers\ApplicationProvider; use Psalm\NodeTypeProvider; use Psalm\Type\Atomic\TLiteralString; @@ -59,7 +60,7 @@ final class ContainerResolver } /** - * @param array<\PhpParser\Node\Arg> $call_args + * @param array $call_args */ public static function resolvePsalmTypeFromApplicationContainerViaArgs(NodeTypeProvider $nodeTypeProvider, array $call_args): ?Union { diff --git a/src/Util/ProxyMethodReturnTypeProvider.php b/src/Util/ProxyMethodReturnTypeProvider.php index 42214e7..2942bfc 100644 --- a/src/Util/ProxyMethodReturnTypeProvider.php +++ b/src/Util/ProxyMethodReturnTypeProvider.php @@ -2,7 +2,9 @@ namespace Psalm\LaravelPlugin\Util; +use PhpParser\Node\Expr\MethodCall; use Psalm\Context; +use Psalm\Internal\Analyzer\StatementsAnalyzer; use Psalm\Type\Atomic\TNamedObject; use Psalm\Type\Union; use function in_array; @@ -16,8 +18,8 @@ final class ProxyMethodReturnTypeProvider * @psalm-param TNamedObject $typeToCall the fake object to execute a fake method call on */ public static function executeFakeCall( - \Psalm\Internal\Analyzer\StatementsAnalyzer $statements_analyzer, - \PhpParser\Node\Expr\MethodCall $fake_method_call, + StatementsAnalyzer $statements_analyzer, + MethodCall $fake_method_call, Context $context, TNamedObject $typeToCall ) : ?Union {