Git Product home page Git Product logo

collector-intellij's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

collector-intellij's Issues

Error adding Custom Plugin Repository

Hello,

I am using PHPStorm 2020.3 EAP and when I try to add the custom repository https://plugins.jetbrains.com/plugins/eap/15246 it says that there is nothing found.

Screen Shot 2020-10-23 at 10 49 54 AM

Any thoughts on what the issue might be or should I just go ahead and download it manually for now?

Thanks,
Skyler

Support specifying type on collections

It would be really awesome if we could find a way to make phpstorm understand the type which a collection returns.

This might be possible in phpstorm 2020.3 as they are adding generic supports via template syntax.

Let's analyse if we can add something like the following syntax

@return Collection<ComplianceForm>

First stable release

So, I have been giving this some thought and I think we are ready to make the first stable release.

We do not have that many features yet, however that does not mean a stable release is not due.
The EAP channel will be kept, but instead used for our EAP features.

I think the product is stable enough for us to mark the first 0.0.1 release!

Add dummy higher order collection autocompletion

Right now when using higher order collections, phpstorm does not understand the results afterwards.

I think we should add support for autocompletion of higher order collection, but just ignore validation the higher order argument which is called.
Validating if the higher order argument is correct could be done in a later PR, as that requires a substantial amount of work.

[Security] Workflow build.yml is using vulnerable action gradle/wrapper-validation-action

The workflow build.yml is referencing action gradle/wrapper-validation-action using references v1.0.3. However this reference is missing the commit 89eda1fdc0167f59521d2bb10767f7169fb4d018 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

Multiple `use` issues when refactoring foreach to collection

I've come across a few situations that cause "Refactor foreach to collection" to not work correctly when it decides which variables need to be in use. I've provided detail on each issue below. Thanks!


Issue 1: missing variable from use

Using the main variable $foo in the loop doesn't lead to it being included in use:

// original
foreach ($foo as $baz) {
    blah($foo, $baz);
}

// refactored
// missing `$foo` variable in `use`
collect($foo)->each(function ($baz) {
    blah($foo, $baz);
});

Issue 2: duplicate variable in use

Adding a property accessor to the main variable $foo causes the main variable to be included twice in use:

// original
foreach ($foo->bar as $baz) {
    blah($foo, $baz);
}

// refactored
// duplicate `$foo` variable in `use`
collect($foo->bar)->each(function ($baz) use ($foo, $foo) {
    blah($foo, $baz);
});

Issue 3: unnecessary variable in use

If you have a property accessor on the main variable $foo but you don't use the main variable in the loop, it is still included in use:

// original
foreach ($foo->bar as $baz) {
    blah($baz);
}

// refactored
// unnecessary `$foo` variable in `use`
collect($foo->bar)->each(function ($baz) use ($foo) {
    blah($baz);
});

If you remove the property accessor from the main variable $foo then this issue doesn't happen:

// original
foreach ($foo as $baz) {
    blah($baz);
}

// refactored
// perfect!
collect($foo)->each(function ($baz) {
    blah($baz);
});

Closure to Arrow Function - Pint style matching

I have been using this plugin for a while and have pretty much always (with maybe 1 or 2 exceptions) accepted the refactor provided.

One minor issue/annoyance is the Closure/Callback to Arrow Function replacement. Since the Laravel ecosystem comes bundled with Pint now, Pint has become our defacto styling standard with minimal tweaks. One of the standards that Pint sets is that there are spaces before function/method parameters:

function foo ($bar) { }
$collection->map(function ($item) { });
$collection->map(fn ($item) => $item);

Currently, the plugin's handles the conversion from a callback to arrow function like this:

$collection->map(function ($item) { return $item; });

// Becomes:

$collection->map(fn($item) => $item);

This immediately triggers our Pint syntax highlighter that it now needs to fix the formatting.

What would be ideal is for the plugin to detect if there was a space between "function" and the opening parenthesis, and copy that over the arrow function if it exists. This would solve the problem for those that use Pint with defaults, and those who have tweaked Pint's settings or don't care about spaces.

It makes my PHPSTORM code inspections to be so slow

This is the exception information reported by PHPSTORM.(I will attach the idea.log later)

Snipaste_2022-03-25_15-29-15

I find it easier to trigger these exceptions when my code is in a foreach with too many judgments. (usually PHPSTORM sends me a notification in the bottom right corner)

As soon as this happens to PHPSTORM, my PHPSTORM's code check becomes unresponsive, like freeze frame there.

1648188266378_Snipaste_2022-03-25_14-04-18

Like this judgment, it's in a foreach , these check hints shouldn't exist because I perfected my statement, but in fact it stays like this until I restart PHPSTORM, which is annoying.

The following idea.log is what I collected after clearing the idea.log and reopening PHPSTORM, I hope it will help you.

Please reply to me if any additions are needed.

Also, I currently have no way to provide the source code for the problem (it belongs to my organization), so I may not be able to provide a MWRE yet, but I will try to reproduce and add to it later.

idea-copied.log

IDE Fatal Errors

I found exception in plugin Collector..

PhpStorm Version 2021.2.2

image

stacktrace.txt

java.lang.UnsupportedOperationException: Empty collection can't be reduced.
	at dev.nybroe.collector.types.HigherOrderTypeProvider.getBySignature(HigherOrderTypeProvider.kt:80)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:776)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:171)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:237)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:757)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getBySignature(PhpExceptionAnalysisService.java:371)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.collectThrownExceptions(PhpExceptionAnalysisService.java:304)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.lambda$getPreventingRecursion$4(PhpExceptionAnalysisService.java:271)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getPreventingRecursion(PhpExceptionAnalysisService.java:268)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:234)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:223)
	at com.jetbrains.php.lang.inspections.PhpThrownExceptionsAnalyzer.getExceptionClasses(PhpThrownExceptionsAnalyzer.java:76)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$Companion.getExceptionClasses(PhpUnhandledExceptionInspection.kt:142)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.analyze(PhpUnhandledExceptionInspection.kt:65)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.visitPhpMethodReference(PhpUnhandledExceptionInspection.kt:52)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:44)
	at com.jetbrains.php.lang.psi.elements.impl.PhpASTElementImpl.accept(PhpASTElementImpl.java:26)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:64)
	at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:55)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:326)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$4(LocalInspectionsPass.java:285)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:159)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:151)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$5(LocalInspectionsPass.java:283)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$6(LocalInspectionsPass.java:283)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:61)
	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:49)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitPriorityElementsAndInit(LocalInspectionsPass.java:298)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:210)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:121)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:414)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:407)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:406)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:382)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:380)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

induced.txt

Following exceptions happened soon after this one, most probably they are induced.


2021-10-12T08:44:41.299
java.lang.UnsupportedOperationException: Empty collection can't be reduced.
	at dev.nybroe.collector.types.HigherOrderTypeProvider.getBySignature(HigherOrderTypeProvider.kt:80)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:776)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:171)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:237)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:757)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getBySignature(PhpExceptionAnalysisService.java:371)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.collectThrownExceptions(PhpExceptionAnalysisService.java:304)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.lambda$getPreventingRecursion$4(PhpExceptionAnalysisService.java:271)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getPreventingRecursion(PhpExceptionAnalysisService.java:268)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:234)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:223)
	at com.jetbrains.php.lang.inspections.PhpThrownExceptionsAnalyzer.getExceptionClasses(PhpThrownExceptionsAnalyzer.java:76)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$Companion.getExceptionClasses(PhpUnhandledExceptionInspection.kt:142)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.analyze(PhpUnhandledExceptionInspection.kt:65)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.visitPhpMethodReference(PhpUnhandledExceptionInspection.kt:52)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:44)
	at com.jetbrains.php.lang.psi.elements.impl.PhpASTElementImpl.accept(PhpASTElementImpl.java:26)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:64)
	at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:55)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:326)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$4(LocalInspectionsPass.java:285)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:159)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:151)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$5(LocalInspectionsPass.java:283)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$6(LocalInspectionsPass.java:283)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool.awaitJoin(ForkJoinPool.java:1708)
	at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1039)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:71)
	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:49)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitPriorityElementsAndInit(LocalInspectionsPass.java:298)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:210)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:121)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:414)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:407)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:406)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:382)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:380)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

java.lang.AssertionError

CompositeException (2 nested):
------------------------------
[1]: java.lang.AssertionError
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:820)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:848)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:848)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:773)
	at com.intellij.psi.impl.source.tree.injected.InjectedFileViewProvider.rootChangedImpl(InjectedFileViewProvider.java:33)
	at com.intellij.psi.impl.source.tree.injected.MultipleRootsInjectedFileViewProvider.rootChanged(MultipleRootsInjectedFileViewProvider.java:57)
	at com.intellij.psi.impl.source.PsiFileImpl.subtreeChanged(PsiFileImpl.java:364)
	at com.jetbrains.php.lang.psi.PhpFileImpl.subtreeChanged(PhpFileImpl.java:239)
	at com.intellij.psi.impl.source.tree.CompositeElement.subtreeChanged(CompositeElement.java:77)
	at com.intellij.psi.impl.source.tree.TreeElement.invalidate(TreeElement.java:338)
	at com.intellij.psi.impl.source.tree.TreeElement.rawRemove(TreeElement.java:325)
	at com.intellij.psi.impl.source.tree.TreeElement.rawReplaceWithList(TreeElement.java:332)
	at com.intellij.psi.impl.source.tree.CompositeElement.replace(CompositeElement.java:823)
	at com.intellij.psi.impl.source.tree.CompositeElement.lambda$replaceChild$1(CompositeElement.java:626)
	at com.intellij.psi.impl.source.tree.ChangeUtil$1.runInner(ChangeUtil.java:147)
	at com.intellij.pom.impl.PomTransactionBase.run(PomTransactionBase.java:28)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$1(PomModelImpl.java:111)
	at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:481)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:104)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:223)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:238)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:222)
	at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
	at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:142)
	at com.intellij.psi.impl.source.tree.CompositeElement.replaceChild(CompositeElement.java:625)
	at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.replaceChild(CodeEditUtil.java:162)
	at com.intellij.extapi.psi.ASTDelegatePsiElement.replaceChildInternal(ASTDelegatePsiElement.java:385)
	at com.intellij.extapi.psi.ASTDelegatePsiElement.replace(ASTDelegatePsiElement.java:375)
	at dev.nybroe.collector.quickFixes.ForeachToCollectionQuickFix.applyFix(ForeachToCollectionQuickFix.kt:52)
	at dev.nybroe.collector.quickFixes.ForeachToCollectionQuickFix.applyFix(ForeachToCollectionQuickFix.kt:14)
	at com.intellij.codeInspection.ex.QuickFixWrapper.invoke(QuickFixWrapper.java:75)
	at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.lambda$invoke$0(IntentionActionWithTextCaching.java:224)
	at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:147)
	at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:224)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention$5(ShowIntentionActionsHandler.java:257)
	at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:86)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1003)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1029)
	at com.intellij.openapi.application.WriteAction.run(WriteAction.java:85)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:257)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke$4(ShowIntentionActionsHandler.java:233)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:232)
	at com.intellij.codeInsight.intention.impl.IntentionListStep.chooseActionAndInvoke(IntentionListStep.java:135)
	at com.intellij.codeInsight.intention.impl.IntentionListStep.lambda$applyAction$3(IntentionListStep.java:127)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
	at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1538)
	at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:101)
	at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179)
	at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:172)
	at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1535)
	at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:162)
	at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326)
	at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:139)
	at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:169)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:219)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:207)
	at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:266)
	at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:434)
	at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:406)
	at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:356)
	at com.intellij.ui.popup.list.ListPopupImpl$1.actionPerformed(ListPopupImpl.java:269)
	at com.intellij.ui.popup.WizardPopup.proceedKeyEvent(WizardPopup.java:378)
	at com.intellij.ui.popup.WizardPopup.dispatch(WizardPopup.java:354)
	at com.intellij.ui.popup.PopupDispatcher.dispatchKeyEvent(PopupDispatcher.java:112)
	at com.intellij.ui.popup.PopupDispatcher.dispatch(PopupDispatcher.java:148)
	at com.intellij.ide.IdePopupManager.dispatch(IdePopupManager.java:109)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:710)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

[2]: java.lang.AssertionError
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:820)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:848)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:848)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:805)
	at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.calculateMinEditSequence(DocumentWindowImpl.java:773)
	at com.intellij.psi.impl.source.tree.injected.InjectedFileViewProvider.rootChangedImpl(InjectedFileViewProvider.java:33)
	at com.intellij.psi.impl.source.tree.injected.MultipleRootsInjectedFileViewProvider.rootChanged(MultipleRootsInjectedFileViewProvider.java:57)
	at com.intellij.psi.impl.source.PsiFileImpl.subtreeChanged(PsiFileImpl.java:364)
	at com.intellij.psi.impl.source.tree.CompositeElement.subtreeChanged(CompositeElement.java:77)
	at com.intellij.psi.impl.source.tree.TreeElement.invalidate(TreeElement.java:338)
	at com.intellij.psi.impl.source.tree.TreeElement.rawRemove(TreeElement.java:325)
	at com.intellij.psi.impl.source.tree.TreeElement.rawReplaceWithList(TreeElement.java:332)
	at com.intellij.psi.impl.source.tree.TreeElement.applyReplaceOnReparse(TreeElement.java:234)
	at com.intellij.psi.impl.DiffLog$ReplaceEntry.doActualPsiChange(DiffLog.java:108)
	at com.intellij.psi.impl.DiffLog.performActualPsiChange(DiffLog.java:45)
	at com.intellij.pom.core.impl.PomModelImpl$1.runInner(PomModelImpl.java:246)
	at com.intellij.pom.impl.PomTransactionBase.run(PomTransactionBase.java:28)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$1(PomModelImpl.java:111)
	at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:481)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:104)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:223)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:233)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:222)
	at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$reparseFile$3(PomModelImpl.java:243)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.lambda$performActionWithFormatterDisabled$4(CodeStyleManagerImpl.java:459)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:128)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:487)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:458)
	at com.intellij.pom.core.impl.PomModelImpl.reparseParallelTrees(PomModelImpl.java:223)
	at com.intellij.pom.core.impl.PomModelImpl.commitTransaction(PomModelImpl.java:191)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$1(PomModelImpl.java:152)
	at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:481)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:104)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:223)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:238)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:222)
	at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
	at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:142)
	at com.intellij.psi.impl.source.tree.CompositeElement.replaceChild(CompositeElement.java:625)
	at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.replaceChild(CodeEditUtil.java:162)
	at com.intellij.extapi.psi.ASTDelegatePsiElement.replaceChildInternal(ASTDelegatePsiElement.java:385)
	at com.intellij.extapi.psi.ASTDelegatePsiElement.replace(ASTDelegatePsiElement.java:375)
	at dev.nybroe.collector.quickFixes.ForeachToCollectionQuickFix.applyFix(ForeachToCollectionQuickFix.kt:52)
	at dev.nybroe.collector.quickFixes.ForeachToCollectionQuickFix.applyFix(ForeachToCollectionQuickFix.kt:14)
	at com.intellij.codeInspection.ex.QuickFixWrapper.invoke(QuickFixWrapper.java:75)
	at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.lambda$invoke$0(IntentionActionWithTextCaching.java:224)
	at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:147)
	at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:224)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention$5(ShowIntentionActionsHandler.java:257)
	at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:86)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1003)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1029)
	at com.intellij.openapi.application.WriteAction.run(WriteAction.java:85)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:257)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke$4(ShowIntentionActionsHandler.java:233)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:232)
	at com.intellij.codeInsight.intention.impl.IntentionListStep.chooseActionAndInvoke(IntentionListStep.java:135)
	at com.intellij.codeInsight.intention.impl.IntentionListStep.lambda$applyAction$3(IntentionListStep.java:127)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
	at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1538)
	at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:101)
	at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179)
	at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:172)
	at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1535)
	at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:162)
	at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326)
	at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:139)
	at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:169)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:219)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:207)
	at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:266)
	at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:434)
	at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:406)
	at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:356)
	at com.intellij.ui.popup.list.ListPopupImpl$1.actionPerformed(ListPopupImpl.java:269)
	at com.intellij.ui.popup.WizardPopup.proceedKeyEvent(WizardPopup.java:378)
	at com.intellij.ui.popup.WizardPopup.dispatch(WizardPopup.java:354)
	at com.intellij.ui.popup.PopupDispatcher.dispatchKeyEvent(PopupDispatcher.java:112)
	at com.intellij.ui.popup.PopupDispatcher.dispatch(PopupDispatcher.java:148)
	at com.intellij.ide.IdePopupManager.dispatch(IdePopupManager.java:109)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:710)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

------------------------------

PhpStorm 2022.1.3
Build #PS-221.5921.28, built on June 22, 2022
Licensed to Yurij Finiv
Subscription is active until July 17, 2022.
Runtime version: 11.0.15+10-b2043.56 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.4
GC: G1 Young Generation, G1 Old Generation
Memory: 3048M
Cores: 8
Registry:
ide.intellij.laf.enable.animation=true
ide.windowSystem.autoShowProcessPopup=true
run.processes.with.pty=TRUE
editor.distraction.free.mode=true
ide.balloon.shadow.size=0

Non-Bundled Plugins:
ski.chrzanow.foldableprojectview (1.1.2)
pl.tigersoft.intellij.faker (1.2.0)
net.sjrx.intellij.plugins.systemdunitfiles (0.3.8)
lermitage.intellij.iconviewer (1.14.0.193)
lermitage.intellij.extratci (1.21.0.201)
io.aesy.regex101 (0.2)
intellij.webp (221.5921.12)
ideanginx9 (0.1.9)
dev.meanmail.plugin.nginx-intellij-plugin (2021.3-2022.1)
de.ehmkah.projects.imgdiff (1.11.0)
com.xiaobing1024.laravel (1.1.1)
com.wakatime.intellij.plugin (14.0.6)
com.ultrahob.zerolength.plugin2 (0.93)
com.mintlify.document (1.1.6)
com.materkey.codepoints (1.0.2)
com.mallowigi.idea (18.1.0)
com.intellij.properties (221.5921.15)
com.wix.sasslint (1.1.2)
com.github.czy211.licensetemplate (2.0.0)
com.github.copilot (1.1.27.1718-nightly)
com.github.chengpohi (1.9)
cc.moky.intellij.plugin.svga-support (1.0.8)
bundled-phpstorm-help (221.5921.28)
com.intellij.jira (4.0.2)
String Manipulation (9.5.0)
LiveTemplatePreview (0.3)
Key Promoter X (2022.2)
zielu.gittoolbox (212.9.0)
mobi.hsz.idea.gitignore (4.4.0)
pers.fw.doc_en (1.1)
nl.deschepers.laraveltinker (2.3.4)
de.espend.idea.php.annotation (8.2.2)
com.pestphp.pest-intellij (1.7.0)
com.kalessil.phpStorm.phpInspectionsEA (4.0.7.1)
fr.adrienbrault.idea.symfony2plugin (2022.1.230)
dev.nybroe.collector (0.4.0)
com.boboram.laravelenvswitch (0.1.5)
com.alicannklc.laravel.snippets (1.1.1)
nz.hailwood.inertiajs (0.1.5)
jones.restarteslintaction.restart-eslint-action (0.0.1)
io.snyk.snyk-intellij-plugin (2.4.36)
intellij.prettierJS (221.5921.12)
com.mallowigi.colorHighlighter (11.0.0)
com.laravel_idea.tailwind (1.3.2)
org.i18nally.jetbrainsideplugin (1.4.1.2)
izhangzhihao.rainbow.brackets (6.25)
com.mallowigi (64.0.0)
com.github.blarc.gitlab-template-lint-plugin (0.0.9)
com.intellij.kubernetes (221.5921.12)
ru.adelf.idea.dotenv (2022.1)
com.laravel_idea.plugin (5.6.0.221)

Convert flatten and map to flat maps

If a map is followed by a flatten, it can be converted to a flatmap

By looking at Laravel docs

The flatMap method iterates through the collection and passes each value to the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items. Then, the array is flattened by a level

According to this we should be able to convert

collect($array)->map(...)->flatten(1);
// or 
collect($array)->map(...)->collapse();

to

collect($array)->flatMap(...);

Let's start with this simple example and I don't think that should give any issues 👍

Refactor to arrow functions when single-line statement

The following example

$users = User::all();

$myActionVar = "super sweet action";

collect($users)->each(function ($user) use ($myActionVar) {
    $user->doAction($myActionVar);
});

could be rewritten to

$users = User::all();

$myActionVar = "super sweet action";

collect($users)->each(fn($user) => $user->doAction($myActionVar));

Wrong recursive call on collection detected

first: thumbs up for your awesome work, it's a great efficiency increase in my workflow 👍

issue: if I have a function that returns mixed content a recursive call on collection warning is shown

image

->get_config() returns \Illuminate\Config\Repository|\Illuminate\Contracts\Foundation\Application|mixed

image

notes: collector v. 0.2.0.EAP.1

java.lang.Exception

Outdated stub in index: file:///.../vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php indexing timestamp = 1658842200000, binary = false, byte size = 28402, char size = 28311, doc=null, docSaved=true, wasIndexedAlready=true, queried at 1658842200000
doc length=-1
file length=28402
cached PSI class com.jetbrains.php.lang.psi.PhpFileImpl
PSI length=28402
projects with file: 1
physical file exists; length = 28402

java.lang.Exception
	at com.intellij.psi.stubs.StubTreeLoaderImpl.diagnoseLengthMismatch(StubTreeLoaderImpl.java:191)
	at com.intellij.psi.stubs.StubTreeLoaderImpl.checkLengthMatch(StubTreeLoaderImpl.java:157)
	at com.intellij.psi.stubs.StubTreeLoaderImpl.readFromVFile(StubTreeLoaderImpl.java:124)
	at com.intellij.psi.stubs.StubTreeLoaderImpl.readOrBuild(StubTreeLoaderImpl.java:49)
	at com.intellij.psi.impl.source.PsiFileImpl.getStubTree(PsiFileImpl.java:634)
	at com.intellij.psi.impl.source.PsiFileImpl.getGreenStubTree(PsiFileImpl.java:956)
	at com.intellij.psi.impl.source.PsiFileImpl.getStubbedSpine(PsiFileImpl.java:255)
	at com.intellij.psi.stubs.StubProcessingHelperBase.lambda$getAllSpines$0(StubProcessingHelperBase.java:85)
	at com.intellij.util.containers.ContainerUtil.map(ContainerUtil.java:1790)
	at com.intellij.psi.stubs.StubProcessingHelperBase.getAllSpines(StubProcessingHelperBase.java:85)
	at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:65)
	at com.intellij.psi.stubs.StubIndexEx.lambda$processElements$4(StubIndexEx.java:138)
	at com.intellij.psi.stubs.StubIndexEx.processElements(StubIndexEx.java:185)
	at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:99)
	at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:87)
	at com.jetbrains.php.PhpIndexImpl.getElements(PhpIndexImpl.java:658)
	at com.jetbrains.php.PhpIndexImpl.getByName(PhpIndexImpl.java:1110)
	at com.jetbrains.php.PhpIndexImpl.getByFQN(PhpIndexImpl.java:1085)
	at com.jetbrains.php.PhpIndexImpl.getByFqnCacheAware(PhpIndexImpl.java:1171)
	at com.jetbrains.php.PhpIndexImpl.getClassesByFQNInternal(PhpIndexImpl.java:1165)
	at com.jetbrains.php.PhpIndexImpl.getAnyByFQN(PhpIndexImpl.java:1210)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.findSuper(PhpType.java:909)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.findSuper(PhpType.java:887)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.isConvertibleFrom(PhpType.java:803)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.isConvertibleFrom(PhpType.java:740)
	at dev.nybroe.collector.UtilKt.isCollection(Util.kt:52)
	at dev.nybroe.collector.UtilKt.isCollectionMethod(Util.kt:31)
	at dev.nybroe.collector.UtilKt.isCollectionMethod(Util.kt:34)
	at dev.nybroe.collector.inspections.WhereFirstInspection$buildVisitor$1.visitPhpMethodReference(WhereFirstInspection.kt:18)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:44)
	at com.jetbrains.php.lang.psi.elements.impl.PhpASTElementImpl.accept(PhpASTElementImpl.java:26)
	at com.intellij.codeInsight.daemon.impl.InspectionRunner.lambda$processInOrder$10(InspectionRunner.java:317)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1154)
	at com.intellij.codeInsight.daemon.impl.InspectionRunner.lambda$processInOrder$11(InspectionRunner.java:325)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:215)
	at com.intellij.codeInsight.daemon.impl.InspectionRunner.lambda$processInOrder$12(InspectionRunner.java:331)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:159)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:151)
	at com.intellij.codeInsight.daemon.impl.InspectionRunner.lambda$processInOrder$13(InspectionRunner.java:294)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
	at com.intellij.codeInsight.daemon.impl.InspectionRunner.lambda$processInOrder$14(InspectionRunner.java:294)
	at com.intellij.concurrency.JobLauncherImpl$1MyProcessQueueTask.lambda$call$0(JobLauncherImpl.java:297)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at `com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)`
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.concurrency.JobLauncherImpl$1MyProcessQueueTask.call(JobLauncherImpl.java:282)
	at com.intellij.concurrency.JobLauncherImpl$1MyProcessQueueTask.call(JobLauncherImpl.java:270)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1428)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

PhpStorm 2022.2.1
Build #PS-222.3739.61, built on August 18, 2022
Licensed to Yurij Finiv
Subscription is active until September 17, 2022.
Runtime version: 17.0.3+7-b469.37 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.5.1
GC: G1 Young Generation, G1 Old Generation
Memory: 3048M
Cores: 8
Metal Rendering is ON
Registry:
    ide.intellij.laf.enable.animation=true
    ide.windowSystem.autoShowProcessPopup=true
    run.processes.with.pty=TRUE
    editor.distraction.free.mode=true
    ide.balloon.shadow.size=0
    ide.images.show.chessboard=true

Non-Bundled Plugins:
    ski.chrzanow.foldableprojectview (1.1.3)
    lermitage.intellij.iconviewer (1.15.0.193)
    lermitage.intellij.extratci (1.23.0.201)
    krasa.CpuUsageIndicator (1.14)
    io.aesy.regex101 (0.2)
    intellij.webp (222.3739.16)
    ideanginx9 (0.1.9)
    de.ehmkah.projects.imgdiff (1.11.0)
    com.xiaobing1024.laravel (1.1.1)
    com.wakatime.intellij.plugin (14.1.0)
    com.villains.intelij.plugin.trashpandatheme (2.0.0)
    com.tabnine.TabNine (0.7.23)
    com.mroche.JsonHelper (1.2.0)
    com.mintlify.document (1.1.6)
    com.materkey.codepoints (1.0.2)
    com.mallowigi.idea (18.1.0)
    com.intellij.properties (222.3739.16)
    com.wix.sasslint (1.1.2)
    com.github.plaskowski.embeddedbrowserintellijplugin (1.2.0)
    com.github.czy211.licensetemplate (2.0.0)
    com.github.chengpohi (1.9.5)
    com.gerry.redis (2.5)
    com.flreey.codekits (2022.09.1)
    cc.moky.intellij.plugin.svga-support (1.0.8)
    cat.dcat.jbplug.mactabbing (1.1.0)
    bundled-phpstorm-help (222.3739.61)
    com.intellij.jira (4.2.0)
    String Manipulation (9.5.1)
    MultiHighlight (3.0.0)
    LiveTemplatePreview (0.3)
    Key Promoter X (2022.2)
    com.chuntung.plugin.gistsnippet (1.1.0)
    zielu.gittoolbox (212.9.9)
    mobi.hsz.idea.gitignore (4.4.2)
    com.mallowigi (72.0.0)
    pers.fw.doc_en (1.1)
    nl.deschepers.laraveltinker (2.4.0)
    de.espend.idea.php.annotation (8.2.3)
    com.pestphp.pest-intellij (1.8.1)
    com.kalessil.phpStorm.phpInspectionsEA (4.0.7.1)
    dev.nybroe.collector (0.4.0)
    com.funivan.idea.phpClean (2022.08.30)
    com.alicannklc.laravel.snippets (1.1.1)
    jones.restarteslintaction.restart-eslint-action (0.0.1)
    intellij.prettierJS (222.3739.24)
    izhangzhihao.rainbow.brackets (6.25)
    dev.ekvedaras.laravelquery (3.3.0)
    org.i18nally.jetbrainsideplugin (1.4.1.3)
    io.snyk.snyk-intellij-plugin (2.4.43)
    fr.adrienbrault.idea.symfony2plugin (2022.1.234)
    com.mallowigi.colorHighlighter (12.0.0)
    com.github.blarc.gitlab-template-lint-plugin (0.0.12)
    com.intellij.kubernetes (222.3739.24)
    ru.adelf.idea.dotenv (2022.2)
    com.laravel_idea.plugin (5.8.1.222)

[foreach-to-collection] non-fixable warning given for @foreach blade directive

Hi there,

First of all, thank you for creating this plugin!

When running my inspections through my entire project, I ran into this case where it reports the 'foreach' used instead of 'Collection' inspection in a Blade template. Blade uses [directives for loops](https://laravel.com/docs/8.x/blade#loops), which use traditional foreach (...) { }` syntax.

@foreach ($items as $item)
  <li>{{ $item }}</li>
@endforeach

The warning caused by the plugin cannot be refactored automatically because of the different syntax, and I don't think the Collection alternative should be preferred in contrast to Blade directives.

Is it possible to detect the difference as a plugin, and can we ignore cases like the one above?

Kind regards,
Erik Gaal

Map to pluck

In many cases when we map we just want a single item from an array. This can also be done with the much simpler syntax pluck.

Before

$data = [
    ['name' => 'Test 1'],
    ['name' => 'Test 2'],
];

collect($data)->map(function($element) {
    return $element['name'];
});

After

$data = [
    ['name' => 'Test 1'],
    ['name' => 'Test 2'],
];

collect($data)->pluck('name');

foreach statement with $key => $value doesn't refactored to collection

When trying to refactor the foreach statement with a $key => $value to a collection it doesn't do anything.

foreach ($keys as $key => $value) {
     if (is_numeric($key)) {
         [$key, $value] = [$value, null];
     }

    $config[$key] = Arr::get($this->items, $key, $value);
}

The expected is to be:

collect($keys)->each(function ($value, $key) {
    if (is_numeric($key)) {
         [$key, $value] = [$value, null];
     }

    $config[$key] = Arr::get($this->items, $key, $value);
});

Tried to solved it but I'm not very familiar with Kotlin 😅

Another `use` issue when refactoring foreach to collection

I found another use issue when refactoring foreach to a collection. I upgraded to v0.0.1-EAP.6 so that #19 and #20 are fixed, but this issue still happens:

When the object property IS NOT in quotes it works great:

// original
foreach ($array as $value) {
    echo $value->property;
}

// refactored
// correct!
collect($array)->each(function ($value) {
    echo $value->property;
});

When the object property IS in quotes it refactors incorrectly:

// original
foreach ($array as $value) {
    echo "$value->property";
}

// refactored
// no variable name in the `use` statement
collect($array)->each(function ($value) use ($) {
    echo "$value->property";
});

com.intellij.diagnostic.PluginException: Tool #ForeachToCollectionInspection registers INFORMATION level problem in batch mode

IntelliJ IDEA Ultimate 2021.2.2

  com.intellij.diagnostic.PluginException: Tool #ForeachToCollectionInspection registers INFORMATION level problem in batch mode on PHP file. INFORMATION level 'warnings' are invisible in the editor and should not become visible in batch mode. Moreover, cause INFORMATION level fixes act more like intention actions, they could e.g. change semantics and thus should not be suggested for batch transformations [Plugin: dev.nybroe.collector]
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.doInspectInBatch(LocalInspectionsPass.java:154)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.inspectFile(GlobalInspectionContextImpl.java:475)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$runTools$4(GlobalInspectionContextImpl.java:338)
	at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:112)
	at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$1(DumbService.java:156)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:854)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:61)
	at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:149)
	at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:112)
	at com.intellij.openapi.project.DumbService.tryRunReadActionInSmartMode(DumbService.java:129)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$runTools$10(GlobalInspectionContextImpl.java:327)
	at com.intellij.concurrency.JobLauncherImpl$1MyTask.lambda$call$0(JobLauncherImpl.java:293)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.concurrency.JobLauncherImpl$1MyTask.call(JobLauncherImpl.java:280)
	at com.intellij.concurrency.JobLauncherImpl$1MyTask.call(JobLauncherImpl.java:270)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Indentation causes invalid `flatMap` code replacement

I have the following code:

collect($shopifyOrder->fulfillments)
    ->map(
        fn (ShopifyFulfillment $fulfillment) => $this->mapLineItems($order, $shopifyOrder, $fulfillment)
    )
    ->flatten(1);

It correctly suggests that I should use flatMap, but when I apply the refactoring, it ends up like this:

collect($shopifyOrder->fulfillments)
    flatMapmap(
        fn (ShopifyFulfillment $fulfillment) => $this->mapLineItems($order, $shopifyOrder, $fulfillment)
    );

Note the flatMapmap( instead of ->flatMap(

However, if I change the original code by pulling ->map( up to the previous line:

collect($shopifyOrder->fulfillments)->map(
        fn (ShopifyFulfillment $fulfillment) => $this->mapLineItems($order, $shopifyOrder, $fulfillment)
    )
    ->flatten(1);

It correctly refactors:

collect($shopifyOrder->fulfillments)->flatMap(
        fn (ShopifyFulfillment $fulfillment) => $this->mapLineItems($order, $shopifyOrder, $fulfillment)
    );

I'd be happy to provide more examples or to help in any way. Thanks!

Exception (java.lang.AssertionError)

I'm getting the above exception on the latest PhpStorm with Collector 0.3.5.

The stack trace is at the end of this post.
If you need any further info in order to fix this bug please let me know, I'll do what I can.

java.lang.AssertionError: #-#-#-#-#-#o#Э#A#M#C\App\Http\Livewire\Kurasu\Table.mount
	at com.jetbrains.php.lang.psi.resolve.types.PhpExcludeTypeTP.getBySignature(PhpExcludeTypeTP.java:63)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:776)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at dev.nybroe.collector.types.HigherOrderTypeProvider.getBySignature(HigherOrderTypeProvider.kt:60)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:776)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:171)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:237)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:757)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getBySignature(PhpExceptionAnalysisService.java:371)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.collectThrownExceptions(PhpExceptionAnalysisService.java:304)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.lambda$getPreventingRecursion$4(PhpExceptionAnalysisService.java:271)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getPreventingRecursion(PhpExceptionAnalysisService.java:268)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:234)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:223)
	at com.jetbrains.php.lang.inspections.PhpThrownExceptionsAnalyzer.getExceptionClasses(PhpThrownExceptionsAnalyzer.java:76)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$Companion.getExceptionClasses(PhpUnhandledExceptionInspection.kt:142)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.analyze(PhpUnhandledExceptionInspection.kt:65)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.visitPhpMethodReference(PhpUnhandledExceptionInspection.kt:52)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:44)
	at com.jetbrains.php.lang.psi.elements.impl.PhpASTElementImpl.accept(PhpASTElementImpl.java:26)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:64)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:353)
	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:172)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:109)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$10(LocalInspectionsPass.java:353)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Add PHP tests to validate refactorings

Right now we have tests stored with before and after results, however I think we should add some PHP code to actually tests that the before and after snippets are in fact giving the same results.

`java.lang.AssertionError: #顶#M#P#P#g#F\App\Console\Commands\collect.map.events`

java.lang.AssertionError: #顶#M#P#P#g#F\App\Console\Commands\collect.map.events
java.lang.AssertionError: #顶#M#P#P#g#F\App\Console\Commands\collect.map.events
	at com.jetbrains.php.lang.psi.resolve.types.PhpExcludeTypeTP.getBySignature(PhpExcludeTypeTP.java:63)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:776)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at com.jetbrains.php.lang.psi.resolve.types.generics.PhpGenericsBaseExtendedWithGenericTypeProvider.decodeExtendedClassesAndSubstitutedTemplates(PhpGenericsBaseExtendedWithGenericTypeProvider.java:113)
	at com.jetbrains.php.lang.psi.resolve.types.generics.PhpGenericsBaseExtendedWithGenericTypeProvider.getExtendedClassesToSubstitutedTemplates(PhpGenericsBaseExtendedWithGenericTypeProvider.java:89)
	at com.jetbrains.php.lang.psi.resolve.types.generics.PhpGenericsBaseExtendedWithGenericTypeProvider.complete(PhpGenericsBaseExtendedWithGenericTypeProvider.java:67)
	at com.jetbrains.php.PhpIndexImpl.lambda$doCompleteType$1(PhpIndexImpl.java:158)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:158)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:94)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.global(PhpType.java:688)
	at com.jetbrains.php.lang.psi.resolve.types.PhpArrayAccessTP.doComplete(PhpArrayAccessTP.java:133)
	at com.jetbrains.php.lang.psi.resolve.types.PhpIteratedAccessTP.complete(PhpIteratedAccessTP.java:37)
	at com.jetbrains.php.PhpIndexImpl.lambda$doCompleteType$1(PhpIndexImpl.java:158)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:158)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:94)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.global(PhpType.java:688)
	at com.jetbrains.php.lang.psi.resolve.types.PhpExcludeTypeTP.complete(PhpExcludeTypeTP.java:46)
	at com.jetbrains.php.PhpIndexImpl.lambda$doCompleteType$1(PhpIndexImpl.java:158)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:158)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:237)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:757)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at dev.nybroe.collector.types.HigherOrderTypeProvider.getBySignature(HigherOrderTypeProvider.kt:60)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:776)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:171)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:115)
	at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:237)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:757)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:662)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:649)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getBySignature(PhpExceptionAnalysisService.java:371)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.collectThrownExceptions(PhpExceptionAnalysisService.java:304)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.lambda$getPreventingRecursion$4(PhpExceptionAnalysisService.java:271)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getPreventingRecursion(PhpExceptionAnalysisService.java:268)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:234)
	at com.jetbrains.php.lang.inspections.exception.PhpExceptionAnalysisService.getThrownExceptions(PhpExceptionAnalysisService.java:223)
	at com.jetbrains.php.lang.inspections.PhpThrownExceptionsAnalyzer.getExceptionClasses(PhpThrownExceptionsAnalyzer.java:76)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$Companion.getExceptionClasses(PhpUnhandledExceptionInspection.kt:142)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.analyze(PhpUnhandledExceptionInspection.kt:65)
	at com.jetbrains.php.lang.inspections.probablyBug.PhpUnhandledExceptionInspection$buildVisitor$1.visitPhpMethodReference(PhpUnhandledExceptionInspection.kt:52)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:44)
	at com.jetbrains.php.lang.psi.elements.impl.PhpASTElementImpl.accept(PhpASTElementImpl.java:26)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:64)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:353)
	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:172)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:109)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$10(LocalInspectionsPass.java:353)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

I think the code that crashes it is something like this:

class DTO extends Spatie\DataTransferObject\DataTransferObject {
     /** @var \App\Console\Commands\ClassA[] */
    public array $classesA = [];
}

class ClassA  extends Spatie\DataTransferObject\DataTransferObject {
    /** @var \App\Console\Commands\ClassB[] */
    public array $classesB = [];
}

class ClassB {
    public function __construct(
        /** @var \App\Console\Commands\Event[] */
        public array $events,
    ) {
    }
}

// ...

foreach (collect($dto->classesA) as $classA) {
    foreach (collect($classA->classesB)->map->events->flatten() as $event) {
        // ...
    }
}

I know it is not how it should be written but anyway 😀 Feel free to close if you think it is not worth the effort since the code was changed by now.

Installation misses requirement of enabled inspections

Hey,

at first nothing worked - after checking the PR code I've seen that it's added as an inspection. It should be added to the installation part that it should be checked that the inspections are enabled as otherwise also the refactoring isn't available.

`where->first` to `firstWhere` refactor

Let's add a new migration!

This time we want to migrate where->first to firstWhere.
By making this migrating we can save a bunch of lookups in the collection as we don't have to look filter all elements first and then taking the first one, but can simply stop when the first one is found.

This can only be applied if first takes no arguments.

Suggesting collection methods on higher order calls

When doing $collection->map-> it suggests methods from the collection class.

This is because Laravel's typehint is actually wrong, however we should check if we can fix this so it does not suggest any methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.