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

Error when running #1180

Closed
CovertError opened this issue Mar 16, 2021 · 4 comments · Fixed by #1184
Closed

Error when running #1180

CovertError opened this issue Mar 16, 2021 · 4 comments · Fixed by #1184
Labels

Comments

@CovertError
Copy link

Versions:

  • ide-helper Version: latest
  • Laravel Version: 8.29.0
  • PHP Version: 7.3.21

Description:

php artisan ide-helper:generate

ErrorException

array_merge(): Expected parameter 2 to be an array, null given

at C:\Users\ASUS\PhpstormProjects\project\vendor\barryvdh\laravel-ide-helper\src\Generator.php:57
53▕
54▕ // Find the drivers to add to the extra/interfaces
55▕ $this->detectDrivers();
56▕
➜ 57▕ $this->extra = array_merge($this->extra, $this->config->get('ide-helper.extra'));
58▕ $this->magic = array_merge($this->magic, $this->config->get('ide-helper.magic'));
59▕ $this->interfaces = array_merge($this->interfaces, $this->config->get('ide-helper.interfaces'));
60▕ // Make all interface classes absolute
61▕ foreach ($this->interfaces as &$interface) {

1 C:\Users\ASUS\PhpstormProjects\project\vendor\barryvdh\laravel-ide-helper\src\Generator.php:57
array_merge([])

2 C:\Users\ASUS\PhpstormProjects\united\Management\vendor\barryvdh\laravel-ide-helper\src\Console\GeneratorCommand.php:115
Barryvdh\LaravelIdeHelper\Generator::__construct(Object(Illuminate\Config\Repository), Object(Illuminate\View\Factory), Object(Il
luminate\Console\OutputStyle), "")

-->

Steps To Reproduce:

running php artisan ide-helper:generate

@mfn
Copy link
Collaborator

mfn commented Mar 16, 2021

Does your config/ide-helper.php contain the 'extra' key? If not, please add it (can be an empty array) or if you don't have the config, I suggest to publish it via php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config

You can also try the above command with --force to update your existing one, but be aware it gets overwritten, so have a backup ready!

@mfn
Copy link
Collaborator

mfn commented Mar 16, 2021

Just realized, this is the same as

Please check and try the solution posted there, e.g. clearing the cache, and let us know if it worked.

@mfn
Copy link
Collaborator

mfn commented Mar 16, 2021

Works on a fresh project, even without the config:

$ composer create-project laravel/laravel ide-helper-issue-1180
…
$ cd ide-helper-issue-1180
…
$ composer require --dev barryvdh/laravel-ide-helper
…
$ php artisan ide-helper:generate
A new helper file was written to _ide_helper.php
$

I guess you've the configs cached and need to clear the cache first.

@netpok
Copy link
Contributor

netpok commented Mar 17, 2021

Did you freshly install ide help? Is there a chance that your configs are cached?

Try php artisan config:clear first.

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

Successfully merging a pull request may close this issue.

3 participants