Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
Library version | 10.2.0 |
I am using this inside a Laravel bootstrapped project. After installation and exporting configuration, when I excecute php artisan insights
, I get following errors
$ php artisan insights
Symfony\Component\Debug\Exception\FatalThrowableError:
Argument 1 passed to NunoMaduro\PhpInsights\Domain\Configuration::resolveIde()
must be of the type string, null given, called in
[workspace]/vendor/nunomaduro/phpinsights/src/Domain/Configuration.php on line 202
at [workspace]/vendor/nunomaduro/phpinsights/src/Domain/Configuration.php:252
248| }
249| return true;
250| };
251| }
> 252| private function resolveIde(string $ide): FileLinkFormatterContract
253| {
254| $links = [
255| =>
256| =>
Exception trace:
1 NunoMaduro\PhpInsights\Domain\Configuration::resolveIde()
[workspace]/vendor/nunomaduro/phpinsights/src/Domain/Configuration.php:202
2 NunoMaduro\PhpInsights\Domain\Configuration::resolveConfig()
[workspace]/vendor/nunomaduro/phpinsights/src/Domain/Configuration.php:90
3 NunoMaduro\PhpInsights\Domain\Configuration::__construct()
[workspace]/vendor/nunomaduro/phpinsights/src/Application/ConfigResolver.php:73
4 NunoMaduro\PhpInsights\Application\ConfigResolver::resolve("[workspace]")
[workspace]/vendor/nunomaduro/phpinsights/src/Application/Adapters/Laravel/Commands/InsightsCommand.php:38
5 NunoMaduro\PhpInsights\Application\Adapters\Laravel\Commands\InsightsCommand::handle()
[workspace]/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
Config
I am using the default config that comes with the installation.
insights.php
<?php
declare(strict_types=1);
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineFunctions;
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenFinalClasses;
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses;
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenPrivateMethods;
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits;
use NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Classes;
use SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff;
return [
/*
|--------------------------------------------------------------------------
| Default Preset
|--------------------------------------------------------------------------
|
| This option controls the default preset that will be used by PHP Insights
| to make your code reliable, simple, and clean. However, you can always
| adjust the `Metrics` and `Insights` below in this configuration file.
|
| Supported: "default", "laravel", "symfony", "magento2", "drupal"
|
*/
'preset' => 'laravel',
/*
|--------------------------------------------------------------------------
| IDE
|--------------------------------------------------------------------------
|
| This options allow to add hyperlinks in your terminal to quickly open
| files in your favorite IDE while browsing your PhpInsights report.
|
| Supported: "textmate", "macvim", "emacs", "sublime", "phpstorm",
| "atom", "vscode".
|
| If you have another IDE that is not in this list but which provide an
| url-handler, you could fill this config with a pattern like this:
|
| myide://open?url=file://%f&line=%l
|
*/
'ide' => null,
/*
|--------------------------------------------------------------------------
| Configuration
|--------------------------------------------------------------------------
|
| Here you may adjust all the various `Insights` that will be used by PHP
| Insights. You can either add, remove or configure `Insights`. Keep in
| mind that all added `Insights` must belong to a specific `Metric`.
|
*/
'exclude' => [
// 'path/to/directory-or-file'
],
'add' => [
Classes::class => [ForbiddenFinalClasses::class],
],
'remove' => [
AlphabeticallySortedUsesSniff::class,
DeclareStrictTypesSniff::class,
DisallowMixedTypeHintSniff::class,
ForbiddenDefineFunctions::class,
ForbiddenNormalClasses::class,
ForbiddenTraits::class,
TypeHintDeclarationSniff::class,
],
'config' => [
ForbiddenPrivateMethods::class => [
'title' =>
'The usage of private methods is not idiomatic in Laravel.',
],
],
];
Please let me know if you need any further details.
PHP 7.2.22
Laravel 6.5.0
OS Mac OS 10.14.6
version 1.9.0 is working just fine.