mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-26 20:34:48 +01:00
chore: add imports
This commit is contained in:
parent
3d5109adb9
commit
a07dd7fae8
@ -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 = '';
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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<Arg> $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;
|
||||
|
@ -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)])
|
||||
) {
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -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<string, string> */
|
||||
public static function getClassLikeNames() : array
|
||||
@ -92,7 +98,7 @@ class ModelRelationshipPropertyHandler implements
|
||||
/**
|
||||
* @param array<PhpParser\Node\Arg> $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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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<Arg> $call_args
|
||||
*/
|
||||
public static function resolvePsalmTypeFromApplicationContainerViaArgs(NodeTypeProvider $nodeTypeProvider, array $call_args): ?Union
|
||||
{
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user