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

array_keys() expects parameter 1 to be array, null given in src/Application/Adapters/Laravel/Preset.php #70

Closed
mjpramos opened this issue May 16, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@mjpramos
Copy link

I'm trying to install phpinsights on a non framework project and although my PHP version is 7.2.10 (MAMP on MacOS), I get the error stating that my PHP version is 7.1.23.

@nunomaduro nunomaduro added question Further information is requested and removed question Further information is requested labels May 16, 2019
@nunomaduro
Copy link
Owner

That's because you are using a different php binary in your CLI. Let's keep this open, maybe someone would like to help you.

@ManojKiranA
Copy link

Hey dude that's​ not issue.Actually I was running my project in php 7.1.23 but still I had installed package and it's was working fine . Just try composer require nunomaduro/phpinsights --dev --ignore-platform-reqs

@mjpramos
Copy link
Author

mjpramos commented May 16, 2019

I updated my PHP CLI following the answer here link
Installation ran smoothly.

But now, when I try to use it, it gives me:

Fatal error: Uncaught TypeError: array_keys() expects parameter 1 to be array, null given in /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Preset.php:70
Stack trace:
#0 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Preset.php(70): array_keys(NULL)
#1 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/ConfigResolver.php(67): NunoMaduro\PhpInsights\Application\Adapters\Laravel\Preset::shouldBeApplied(Array)
#2 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/ConfigResolver.php(36): NunoMaduro\PhpInsights\Application\ConfigResolver::guess('/Applications/M...')
#3 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Console/Commands/AnalyseCommand.php(88): NunoMaduro\PhpInsights\Application\ConfigResolver::resolve(Array, '/Applications/M...')
#4 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Console/Commands/AnalyseCommand.php(68): NunoM in /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Preset.php on line 70

Thanks/Obg

@ManojKiranA
Copy link

I updated my PHP CLI following the answer here link
Installation ran smoothly.

But now, when I try to use it, it gives me:

Fatal error: Uncaught TypeError: array_keys() expects parameter 1 to be array, null given in /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Preset.php:70
Stack trace:
#0 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Preset.php(70): array_keys(NULL)
#1 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/ConfigResolver.php(67): NunoMaduro\PhpInsights\Application\Adapters\Laravel\Preset::shouldBeApplied(Array)
#2 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/ConfigResolver.php(36): NunoMaduro\PhpInsights\Application\ConfigResolver::guess('/Applications/M...')
#3 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Console/Commands/AnalyseCommand.php(88): NunoMaduro\PhpInsights\Application\ConfigResolver::resolve(Array, '/Applications/M...')
#4 /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Console/Commands/AnalyseCommand.php(68): NunoM in /Applications/MAMP/htdocs/cr/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Preset.php on line 70

Thanks/Obg

Are you trying in laravel app or some other can​ you specify that

@nunomaduro
Copy link
Owner

nunomaduro commented May 16, 2019

Can I see your composer.json? I think I know the issue. I need to adapt the code to be prepared to a composer.json without requirements section.

@mjpramos
Copy link
Author

As I said in my first post, it's non framework. Just some simple PHP classes.
My composer.json:

{ "require-dev": { "nunomaduro/phpinsights": "^1.0" } }

@nunomaduro
Copy link
Owner

@nunomaduro nunomaduro added the bug Something isn't working label May 16, 2019
@nunomaduro nunomaduro changed the title [InvalidArgumentException] Package nunomaduro/phpinsights at version has a PHP requirement incompatible with your PHP version (7.1.23) array_keys() expects parameter 1 to be array, null given in src/Application/Adapters/Laravel/Preset.php May 16, 2019
Jibbarth added a commit to Jibbarth/phpinsights that referenced this issue May 16, 2019
Check if composer require is setted and contains an array
Add tests on ConfigResolver::guess
Jibbarth added a commit to Jibbarth/phpinsights that referenced this issue May 16, 2019
Check if composer require is setted and contains an array
Add tests on ConfigResolver::guess
Jibbarth added a commit to Jibbarth/phpinsights that referenced this issue May 16, 2019
Check if composer require is setted and contains an array
Add tests on ConfigResolver::guess
Jibbarth added a commit to Jibbarth/phpinsights that referenced this issue May 16, 2019
Check if composer require is setted and contains an array
Add tests on ConfigResolver::guess
Jibbarth added a commit to Jibbarth/phpinsights that referenced this issue May 16, 2019
Check if composer require is setted and contains an array in differents Frameworks Presets
Add tests on ConfigResolver::guess
Jibbarth added a commit to Jibbarth/phpinsights that referenced this issue May 16, 2019
Check if composer require is setted and contains an array in differents Frameworks Presets
Add tests on ConfigResolver::guess
@Jibbarth
Copy link
Collaborator

@mjpramos Can you run a composer update and tell us if it's fixed for you ?

@mjpramos
Copy link
Author

Thanks! Works perfectly now :)

@nunomaduro
Copy link
Owner

Thanks @Jibbarth for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants