Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError : Argument 2 passed to Illuminate\View\FileViewFinder::__construct() must be of the type array, null given #31179

Closed
ls-dac-chartrand opened this issue Jan 20, 2020 · 3 comments

Comments

@ls-dac-chartrand
Copy link

  • Laravel Version: 6.11.0
  • PHP Version: 7.3.1

Description:

After upgrading laravel/framework 6.11.0 I get: TypeError : Argument 2 passed to Illuminate\View\FileViewFinder::__construct() must be of the type array, null given

More info

Fails on \Illuminate\View\ViewServiceProvider::registerViewFinder, thinks $app['config']['view.paths'] is null.

Can I get more context on this PR?

If I change the code in loadViewsFrom back to:

        $view = $this->app['view'];

        $this->callAfterResolving('view', function ($view) use ($path, $namespace) {
            if (isset($this->app->config['view']['paths']) &&
                is_array($this->app->config['view']['paths'])) {
                foreach ($this->app->config['view']['paths'] as $viewPath) {
                    if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) {
                        $view->addNamespace($namespace, $appPath);
                    }
                }
            }

            $view->addNamespace($namespace, $path);

The problem goes away.

@driesvints
Copy link
Member

Can you copy/paste your view.php config file?

@ls-dac-chartrand
Copy link
Author

<?php

declare(strict_types=1);

return [

    /*
    |--------------------------------------------------------------------------
    | View Storage Paths
    |--------------------------------------------------------------------------
    |
    | Most templating systems load templates from disk. Here you may specify
    | an array of paths that should be checked for your views. Of course
    | the usual Laravel view path has already been registered for you.
    |
    */

    'paths' => [
        resource_path('views'),
    ],

    /*
    |--------------------------------------------------------------------------
    | Compiled View Path
    |--------------------------------------------------------------------------
    |
    | This option determines where all the compiled Blade templates will be
    | stored for your application. Typically, this is within the storage
    | directory. However, as usual, you are free to change this value.
    |
    */

    'compiled' => env(
        'VIEW_COMPILED_PATH',
        realpath(storage_path('framework/views'))
    ),

];

@ls-dac-chartrand
Copy link
Author

Close issue. Unit test was doing Config::offsetUnset('view') before running. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants