Skip to content

Conversation

@PrinsFrank
Copy link

As described on a similar PR in the ide-helper, when a serviceprovider is not deferrable, the service provider of a package is registered before any custom service providers in a project are registered.

I am currently working on a project with a custom FileSystemServiceProvider, where requiring the debugbar causes an error in Container.php on line 879 Target class [files] does not exist and Container.php on line 877 Class "files" does not exist. This issue was also mentioned in #1112.

Simplest bug reproduction in code

./app/Providers/CustomFileSystemProvider.php

<?php
declare(strict_types=1);

namespace App\Providers;

use Illuminate\Filesystem\FilesystemServiceProvider;

class CustomFileSystemServiceProvider extends FilesystemServiceProvider
{
    // Overwrite anything in here, or keep this empty for a simple reproduction
}

./config/app.php

'providers' => [
    //Illuminate\Filesystem\FilesystemServiceProvider::class,
    App\Providers\CustomFileSystemServiceProvider::class,

This PR adds the DeferrableProvider interface to the package's service provider, and adds the provided services to a provides method so these services can be registered when needed.

@caimaxtingle
Copy link

+1 also getting this issue, please approve asap

@PrinsFrank
Copy link
Author

@barryvdh Can you look at this PR?

@PrinsFrank
Copy link
Author

@barryvdh Can this get merged? Our team has been running on this fork since november with no issues, and there are is also someone else running into this issue in #1306.

…er-deferrable-to-allow-for-custom-filesystem-provider
@PrinsFrank
Copy link
Author

As #1197 is now merged I'll close this PR.

@PrinsFrank PrinsFrank closed this May 19, 2022
@PrinsFrank PrinsFrank deleted the make-service-provider-deferrable-to-allow-for-custom-filesystem-provider branch May 19, 2022 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants