Merge branch 'master' into patch-1

This commit is contained in:
feek 2021-06-09 10:55:26 -07:00 committed by GitHub
commit d43d48f8c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 13 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -0,0 +1,26 @@
<?php
namespace Illuminate\Contracts\Container;
use Closure;
use Psr\Container\ContainerInterface;
interface Container extends ContainerInterface, \ArrayAccess
{
/**
* @param mixed $offset
* @return mixed
*
* @since 5.0.0
*/
public function offsetGet($offset);
/**
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
* @return void
*
* @since 5.0.0
*/
public function offsetSet($offset, $value);
}

View File

@ -146,6 +146,6 @@ Feature: collection types
| InvalidReturnType | The declared return type 'bool' for CollectionTypes::failingTest is incorrect, got 'null\|string' |
| NullableReturnStatement | The declared return type 'bool' for CollectionTypes::failingTest is not nullable, but the function returns 'null\|string' |
| InvalidReturnStatement | The inferred type 'null\|string' does not match the declared return type 'bool' for CollectionTypes::failingTest |
| InvalidScalarArgument | Argument 2 of Illuminate\Support\Collection::put expects string, int(2) provided |
| InvalidScalarArgument | Argument 2 of Illuminate\Support\Collection::put expects string, 2 provided |
And I see no other errors

View File

@ -16,6 +16,24 @@ Feature: Container
</psalm>
"""
Scenario: Application interface does not error
Given I have the following code
"""
<?php
use App\Jobs\PullContact;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider {
public function register() {
$this->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
"""