olivernybroe / phpinsights-intellij

The IntelliJ integration of phpinsights
MIT License
18 stars 2 forks source link

[BUG] Php parse error #14

Open juslintek opened 4 years ago

juslintek commented 4 years ago

I constantly get these in the Event log, when using PhpInsights on:

PhpStorm 2020.1
Build #PS-201.6668.153, built on April 13, 2020
Licensed to G2 Ocean / Linas Jusys
You have a perpetual fallback license for this version
Subscription is active until May 11, 2021
Runtime version: 11.0.6+8-b765.25 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 16
Registry: run.processes.with.pty=TRUE
Non-Bundled Plugins: com.atlassian.bitbucket.references, ru.adelf.idea.dotenv, de.espend.idea.laravel, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.annotation, dk.lost_world.phpinsights, org.endpointdeps.EndpointDependencies, de.espend.idea.php.generics, org.sonarlint.idea

I constantly get these errors in event log when typing something inside of array or similar:

14:18   PHP Insights - Failed parsing result
            java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 path $
            Fatal error: Multiple access type modifiers are not allowed in  on line 16

             (show balloon)

14:18   PHP Insights
            0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
            PHP Fatal error:  Multiple access type modifiers are not allowed in  on line 16
            Exclude ShipmentTrackingResource.php from PHP Insights analysis.

14:20   PHP Insights - Failed parsing result
            java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 path $
            Parse error: syntax error, unexpected '=', expecting ']' in  on line 210

             (show balloon)

14:20   PHP Insights
            0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
            PHP Parse error:  syntax error, unexpected '=', expecting ']' in  on line 210
            Exclude ShipmentController.php from PHP Insights analysis.

14:20   PHP Insights - Failed parsing result
            java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 path $
            Parse error: syntax error, unexpected '=', expecting ']' in  on line 210

             (show balloon)

14:20   PHP Insights
            0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
            PHP Parse error:  syntax error, unexpected '=', expecting ']' in  on line 210
            Exclude ShipmentController.php from PHP Insights analysis.

image

As well got this error from PhpStorm API:

Details: Current thread: Thread[Alarm Pool,4,Idea Thread Group] 529708380
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 444342867

java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:164)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1009)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.evaluateValidity(FileManagerImpl.java:587)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.evaluateValidity(FileManagerImpl.java:583)
    at com.intellij.psi.impl.source.PsiFileImpl.isValid(PsiFileImpl.java:162)
    at com.phpinsights.phpinsights.PhpInsightsAnnotator.isContextValid(PhpInsightsAnnotator.java:130)
    at com.phpinsights.phpinsights.PhpInsightsAnnotator.doAnnotate(PhpInsightsAnnotator.java:87)
    at com.phpinsights.phpinsights.PhpInsightsAnnotator.doAnnotate(PhpInsightsAnnotator.java:42)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:205)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$800(ExternalToolPass.java:41)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$null$0(ExternalToolPass.java:181)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:271)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$600(ExternalToolPass.java:41)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:181)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:625)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:570)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:257)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:180)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
    at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:273)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:287)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:242)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:367)
    at com.intellij.util.Alarm$Request.run(Alarm.java:357)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:220)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:210)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
olivernybroe commented 4 years ago

Thanks for reporting this, I think this is caused by a usage of a deprecated API in 2020.1.

olivernybroe commented 4 years ago

@juslintek Just released a new version which hopefully should fix this issue for you.

It will be available in the marketplace in two days (reviewing process) or you can download it from releases in GitHub.

If the issue still occurs, I'll reopen this issue.

juslintek commented 4 years ago

Hi, will provide feedback after a few days of usage :-)

juslintek commented 4 years ago

Okay, so previous errors disappeared, but errors such as this still appear:

13:08   PHP Insights
            Can not correctly run the tool with parameters:
            analyse
            /private/var/folders/_8/1zyhztyj0szg4nvpdphkny1c0000gn/T/phpinsights_temp.tmp/_ide_helper.php
            --format=json
            --config-path=/Users/juslintek/Projects/myg2/config/insights.php
            Possible tool process hangup after 5 sec
            Exclude _ide_helper.php from PHP Insights analysis.

Guess this needs an option to set custom timeout.

Wonder if it works async or sync. If async, could be by default longer timeout, so it wouldn't block anything and on editor, insight results can update with a slight delay, based on the response from the scan.

But guess that is another issue or feature request. But without this feature, you can have limited rulesets and limited file sizes.

As well would be nice to have the possibility to ignore inspection on autogenerated files, which are very large.

olivernybroe commented 4 years ago

@juslintek It is using phpstorms own inspection system, so you should be possible to ignore that file. Doesn't it actually give you a clickable link in that error message to ignore it?

It runs async, so yeah, we can increase the timeout, and might actually make sense to just make it configurable 👍

juslintek commented 4 years ago

Yes, it provides the link, sorry. And as well there is a context menu item titles "Add to Ignore List of..." to do that for the file-types add to inspections.

olivernybroe commented 4 years ago

@juslintek Nice :)

But let's open a new issue about customizing the time out.

juslintek commented 4 years ago

Got related error to current issue:


Details: Current thread: Thread[Alarm Pool,4,Idea Thread Group] 1795570619
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 388866177

java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:164)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1009)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.evaluateValidity(FileManagerImpl.java:587)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.evaluateValidity(FileManagerImpl.java:583)
    at com.intellij.psi.impl.source.PsiFileImpl.isValid(PsiFileImpl.java:162)
    at com.phpinsights.phpinsights.PhpInsightsAnnotator.isContextValid(PhpInsightsAnnotator.java:130)
    at com.phpinsights.phpinsights.PhpInsightsAnnotator.doAnnotate(PhpInsightsAnnotator.java:87)
    at com.phpinsights.phpinsights.PhpInsightsAnnotator.doAnnotate(PhpInsightsAnnotator.java:42)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:205)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$800(ExternalToolPass.java:41)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$null$0(ExternalToolPass.java:181)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:271)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$600(ExternalToolPass.java:41)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:181)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:166)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:153)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:257)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:180)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
    at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:273)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:287)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:242)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:367)
    at com.intellij.util.Alarm$Request.run(Alarm.java:357)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:220)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:210)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
olivernybroe commented 4 years ago

Damn... Alright reopening and hoping I can figure out why it is failing.

Could you explain what steps you do to get this error?

juslintek commented 4 years ago

Open laravel project with nunomaduro/phpinsights installed publish its configs, change them to:

<?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\DisallowArrayTypeHintSyntaxSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff;

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' => 'phpstorm',
    /*
    |--------------------------------------------------------------------------
    | 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,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff::class,

            // PSR-1
            PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowAlternativePHPTagsSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowShortOpenTagSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff::class,

            // PSR-12
            PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\EndFileNewlineSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\ClosingTagSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowTabIndentSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseKeywordSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseConstantSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseTypeSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\PropertyDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MethodScopeSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ScopeKeywordSpacingSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\MethodDeclarationSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionClosingBraceSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\FunctionDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\LowercaseFunctionKeywordsSniff::class,
            PHP_CodeSniffer\Standards\PEAR\Sniffs\Functions\ValidDefaultValueSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\MultiLineFunctionDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\FunctionCallArgumentSpacingSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionCallSignatureSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ControlSignatureSniff::class,
            PHP_CodeSniffer\Standards\PSR12\Sniffs\ControlStructures\ControlStructureSpacingSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ScopeClosingBraceSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ForEachLoopDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ForLoopDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\LowercaseDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures\InlineControlStructureSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ElseIfDeclarationSniff::class,
            PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff::class,
            PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\IncrementDecrementSpacingSniff::class,
            PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\CastSpacingSniff::class,

            // Additional
            PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer::class, // G2O1.01.003
            PHP_CodeSniffer\Standards\Generic\Sniffs\Strings\UnnecessaryStringConcatSniff::class, // G2O1.01.005
            PhpCsFixer\Fixer\Comment\MultilineCommentOpeningClosingFixer::class, // G2O1.01.007
            PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer::class, // G2O1.01.007
            SlevomatCodingStandard\Sniffs\Arrays\TrailingArrayCommaSniff::class, // G2O1.01.010

            PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer::class, //  G2O1.03.004
            SlevomatCodingStandard\Sniffs\Operators\DisallowEqualOperatorsSniff::class, // G2O1.03.006
        ],
    ],

    'remove' => [
        SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff::class,
        PhpCsFixer\Fixer\Import\OrderedImportsFixer::class,
        SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff::class,
        ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff::class,
        PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\TodoSniff::class,
        SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class,
        SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff::class,
        PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer::class,
        PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer::class,

        // Doubtable
        SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff::class,
        NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff::class,
        ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
        PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UselessOverridingMethodSniff::class,
        SlevomatCodingStandard\Sniffs\ControlStructures\DisallowEmptySniff::class,
        PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterNotSniff::class,
        ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff::class,
        ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff::class,
        SlevomatCodingStandard\Sniffs\TypeHints\NullTypeHintOnLastPositionSniff::class,
        SlevomatCodingStandard\Sniffs\Namespaces\NamespaceSpacingSniff::class,
        PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff::class,
        PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\ClassDeclarationSniff::class,

        // Temporary
        ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff::class,
        PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class,

        // Default 'laravel'
        AlphabeticallySortedUsesSniff::class,
        DeclareStrictTypesSniff::class,
        DisallowMixedTypeHintSniff::class,
        ForbiddenDefineFunctions::class,
        ForbiddenNormalClasses::class,
        ForbiddenTraits::class,
        DisallowArrayTypeHintSyntaxSniff::class,
        SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::class,
        SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff::class,
        SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff::class,

        // Laravel incompatible
        SlevomatCodingStandard\Sniffs\Classes\ModernClassNameReferenceSniff::class,
    ],

    'config' => [
        // Default 'laravel'
        ForbiddenPrivateMethods::class => [
            'title' => 'The usage of private methods is not idiomatic in Laravel.',
        ],

        // PSR-12
        PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineEndingsSniff::class => [
            'eolChar' => '\n',
        ],
        PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff::class => [
            'lineLimit' => 120,
            'absoluteLineLimit' => 0,
        ],
        PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff::class => [
            'ignoreBlankLines' => true,
        ],
        PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ScopeIndentSniff::class => [
            'ignoreIndentationTokens' => ['T_COMMENT', 'T_DOC_COMMENT_OPEN_TAG'],
        ],
        PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\FunctionDeclarationArgumentSpacingSniff::class => [
            'equalsSpacing' => 1,
        ],

        // Additional
        PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\OperatorSpacingSniff::class => [
            'ignoreNewlines' => true,
        ], // G2O1.01.006
        NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh::class => [
            'maxComplexity' => 25,
        ], // G2O1.03.002
        PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer::class => [
            'default' => 'single_space',
        ],
        PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class => [
            'order' => [
                'use_trait',
                'constant_public',
                'constant_protected',
                'constant_private',
                'property_public',
                'property_protected',
                'property_private',
                'construct',
                'destruct',
                'magic',
                'phpunit',
                'method_public',
                'method_protected',
                'method_private',
            ],
        ],
    ],
];

Set in inspection configuration to use this configuration. And try opening files, try generating ide-helper with https://github.com/barryvdh/laravel-ide-helper it generates really large files.

Can not correctly run the tool with parameters: analyse /private/var/folders/_8/1zyhztyj0szg4nvpdphkny1c0000gn/T/phpinsights_temp.tmp1/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php --format=json --config-path=/Users/juslintek/Projects/myg2/config/insights.php  Possible tool process hangup after 5 sec Exclude Builder.php from PHP Insights analysis.