diff --git a/src/AppInterfaceProvider.php b/src/AppInterfaceProvider.php index 2d8b0bc..6a16c3f 100644 --- a/src/AppInterfaceProvider.php +++ b/src/AppInterfaceProvider.php @@ -35,7 +35,6 @@ class AppInterfaceProvider implements ) : ?bool { if ($method_name_lowercase === 'offsetget' || $method_name_lowercase === 'offsetset' - || $method_name_lowercase === '__call' ) { return true; } @@ -55,7 +54,6 @@ class AppInterfaceProvider implements ) : ?bool { if ($method_name_lowercase === 'offsetget' || $method_name_lowercase === 'offsetset' - || $method_name_lowercase === '__call' ) { return true; } diff --git a/src/Plugin.php b/src/Plugin.php index 41e3a93..382d4c9 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -25,17 +25,18 @@ class Plugin implements PluginEntryPointInterface public function __invoke(RegistrationInterface $registration, ?SimpleXMLElement $config = null) : void { - $app = ApplicationHelper::bootApp(); + try { + $app = ApplicationHelper::bootApp(); + $fake_filesystem = new FakeFilesystem(); + $view_factory = $this->getViewFactory($app, $fake_filesystem); + $cache_dir = __DIR__ . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR; - $fake_filesystem = new FakeFilesystem(); - - $view_factory = $this->getViewFactory($app, $fake_filesystem); - - $cache_dir = __DIR__ . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR; - - $this->ingestFacadeStubs($registration, $app, $fake_filesystem, $view_factory, $cache_dir); - $this->ingestMetaStubs($registration, $app, $fake_filesystem, $view_factory, $cache_dir); - $this->ingestModelStubs($registration, $app, $fake_filesystem, $cache_dir); + $this->ingestFacadeStubs($registration, $app, $fake_filesystem, $view_factory, $cache_dir); + $this->ingestMetaStubs($registration, $app, $fake_filesystem, $view_factory, $cache_dir); + $this->ingestModelStubs($registration, $app, $fake_filesystem, $cache_dir); + } catch (\Throwable $t) { + return; + } require_once 'ReturnTypeProvider/AuthReturnTypeProvider.php'; $registration->registerHooksFromClass(ReturnTypeProvider\AuthReturnTypeProvider::class); diff --git a/src/Stubs/Container.stubphp b/src/Stubs/Container.stubphp new file mode 100644 index 0000000..0bba7ac --- /dev/null +++ b/src/Stubs/Container.stubphp @@ -0,0 +1,26 @@ + """ + Scenario: Application interface does not error + Given I have the following code + """ + app->foo("a", "b"); + } + } + """ + When I run Psalm + Then I see these errors + | Type | Message | + | UndefinedInterfaceMethod | Method Illuminate\Contracts\Foundation\Application::foo does not exist | + Scenario: the container resolves correct types Given I have the following code """