Laravel-ide-helper: error in ide-helper:generate

Created on 26 Sep 2019  路  7Comments  路  Source: barryvdh/laravel-ide-helper

hi
i install ide hleper in laravel 6 and see this error
when run
php artisan ide-helper:generate

`> @php artisan ide-helper:generate

ErrorException : array_merge(): Argument #2 is not an array

at C:\Users\behro\Documents\websitehamaiesh elmi\laravel-backend\vendor\barryvdh\laravel-ide-helper\src\Generator.php:53
49|
50| // Find the drivers to add to the extra/interfaces
51| $this->detectDrivers();
52|

53| $this->extra = array_merge($this->extra, $this->config->get('ide-helper.extra'));
54| $this->magic = array_merge($this->magic, $this->config->get('ide-helper.magic'));
55| $this->interfaces = array_merge($this->interfaces, $this->config->get('ide-helper.interfaces'));
56| // Make all interface classes absolute
57| foreach ($this->interfaces as &$interface) {

Exception trace:

1 array_merge([])
C:\Users\behro\Documents\websitehamaiesh elmi\laravel-backend\vendor\barryvdh\laravel-ide-helper\src\Generator.php:53

2 Barryvdh\LaravelIdeHelper\Generator::__construct(Object(Illuminate\Config\Repository), Object(Illuminate\View\Factory), Object(Illuminate\Console\OutputStyle), "")
C:\Users\behro\Documents\websitehamaiesh elmi\laravel-backend\vendor\barryvdh\laravel-ide-helper\src\Console\GeneratorCommand.php:112
`

Most helpful comment

I had the same error. This is how I solved it.

php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config

php artisan config:cache

That's it

All 7 comments

Also getting this error recently. I have extra, magic and interfaces defined as arrays in the ide-helper config file. Still getting ErrorException : array_merge(): Expected parameter 2 to be an array, null given in vendor/barryvdh/laravel-ide-helper/src/Generator.php:53 ($this->extra = array_merge($this->extra, $this->config->get('ide-helper.extra'));)

Tried clearing all the caches etc, but no help.

I had the same error. This is how I solved it.

php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config

php artisan config:cache

That's it

Your config was cached, you need to clear it:

php artisan config:clear

Configs usually should only be cached in production.

config:clear did it for me, why don't we throw this command into the generate artisan?

$this->call('config:clear');

I would not expect a helper library to change the application state. In my opinion if someone decides to cache the config he/she should be the one who clears those cached values.

Supporting the last comment.

Also: ide-helper is meant to run in dev only and dev is not meant to be cached

@barryvdh config caching in dev produces this problems and it's generally bad practice to do this, I vote for closing this issue :}

(the readme doesn't mention this, I made myself a note to follow-up on this, but the issue isn't required for this)

Was this page helpful?
0 / 5 - 0 ratings