Giter VIP home page Giter VIP logo

idea-php-generics-plugin's Introduction

IntelliJ IDEA / PhpStorm PHPStan / Psalm / Generics

Use Replacements:

Build Status Version Downloads Downloads last month Donate to this project using Paypal

Key Value
Plugin url https://plugins.jetbrains.com/plugin/12754-php-generics
Id de.espend.idea.php.generics
Changelog CHANGELOG

!!! Work in progress !!!

Supported

types

/**
 * @[psalm-|phpstan-]template T
 * @[psalm-|phpstan-]param class-string<T> $class
 * @[psalm-|phpstan-]return T
 */
function instantiator(string $class) {
    return new $class();
}

class Foo {}

$a = instantiator(Foo::class); // Psalm knows the result is an object of type Foo

class-string

  • Inspections for not given wrong parameter
    /**
     * @[psalm-|phpstan-]template T as Exception
     * @[psalm-|phpstan-]param T::class $type
     * @return T
     */
    function a(string $type): Exception
    {
        return new $type;
    }

templates

    $collection = new FooCollection();
    
    // its now a type of "Foobar"
    $foobar = $collection->getValue();
    $foobar->get<caret>Foobar(); // method is clickable and autocompletes
    /**
     * @[psalm-|phpstan-]template T
     */
    class Collection
    {
        /**
         * @[psalm-|phpstan-]return T
         */
        public function getValue() {}
    }

    /**
     * @[psalm-|phpstan-]extends Collection<Foobar>
     */
    class FooCollection extends Collection {}

    class Foobar
    {
        public function getFoobar() {}
    }

Object-like arrays

https://psalm.dev/docs/annotating_code/type_syntax/array_types/

    a(['<caret>' => ''])
    /**
     * @[psalm-|phpstan-]param array{foo: string, bar: int} $type
     */
    function a(array $type): Exception
    {
    }

psalm-immutable and psalm-readonly

Inspection to show disallowed write access

class PsalmReadOnly {
    /**
     * @psalm-readonly
     */
    public string $readOnly;
}

/**
 * @psalm-immutable
 */
class PsalmImmutable {
    public string $readOnly;
}

Follows into errors hints

(new PsalmReadOnly())->readOnly = 'test';
(new PsalmImmutable())->readOnly = 'test';

Quality Tools

Provides support for quality tools inspection via directly call PHPStan or Psalm reporting via codestyle format

Limitation / Issues

Screenshots

class-string Object-like arrays Psalm Immutable Quality Tool Template Types

TODO

https://youtrack.jetbrains.com/issue/WI-47158

/**
 * @template T
 */
class Map
{
    /**
     * @param array<string, T>
     */
    public function __construct(array $data = []) {}
    /**
     * @return T
     */
    public function get(string $key) {}
    /**
     * @param T $value
     */
    public function set(string $key, $value): void {}
}
// Automatically inferred as Map<string>
$map = new Map([0 => 'Foo', 1 => 'Bar']);
$map->set(2, true); // Expected string

https://youtrack.jetbrains.com/issue/WI-45248

    class Assert
    {
        /**
         * @psalm-template ExpectedType of object
         * @psalm-param class-string<ExpectedType> $class
         * @psalm-assert ExpectedType $value
         */
        public static function isInstanceOf($value, $class, $message = '')
        {
        }
    }

phpstan/phpdoc-parser#30

/**
* @param array{'foo': int, "bar": string} $a
* @param array{0: int, 1?: int} $a
* @param array{int, int} $a
* @param array{foo: int, bar: string} $a
* @param array{foo:string, bar:?int} $a
*/

Others

 /** @var array<int, string> */

idea-php-generics-plugin's People

Contributors

akovalyov avatar dbrekelmans avatar haehnchen avatar henkpoley avatar orklah avatar simpod avatar

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

idea-php-generics-plugin's Issues

iterable autocompletion

would be super nice for this plugin to support autocompletion for iterable<int, Some> similar like Some[] already works.

That's a huge time saver :)

Exception in the latest EAP

com.intellij.openapi.extensions.ExtensionException: Extension class de.espend.idea.php.quality.phpstan.configuration.PhpStanValidatorConfigurationManager does not implement interface com.jetbrains.php.config.interpreters.PhpInterpretersStateListener (adapter=ExtensionComponentAdapter(impl=de.espend.idea.php.quality.phpstan.configuration.PhpStanValidatorConfigurationManager, plugin=PluginDescriptor(name=PHPStan / Psalm / Generics, id=de.espend.idea.php.generics, path=/Users/anatoly/Library/Application Support/JetBrains/Toolbox/apps/PhpStorm/ch-0/202.4357.31/PhpStorm 2020.2 EAP.app.plugins/PHP Generics)))
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.checkExtensionType(ExtensionPointImpl.java:228)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapter(ExtensionPointImpl.java:478)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:407)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:256)
	at com.intellij.openapi.extensions.ExtensionPointName.getExtensions(ExtensionPointName.java:38)
	at com.jetbrains.php.config.interpreters.PhpInterpretersManagerImpl.registerInterpreterStateListeners(PhpInterpretersManagerImpl.java:121)
	at com.jetbrains.php.config.interpreters.PhpInterpretersManagerImpl.<init>(PhpInterpretersManagerImpl.java:56)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:53)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:654)
	at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:49)
	at com.intellij.serviceContainer.ServiceComponentAdapter.access$createAndInitialize(ServiceComponentAdapter.kt:13)
	at com.intellij.serviceContainer.ServiceComponentAdapter$doCreateInstance$1.run(ServiceComponentAdapter.kt:43)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:187)
	at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:42)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:115)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:69)
	at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:408)
	at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:391)
	at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:24)
	at com.jetbrains.php.config.interpreters.PhpInterpretersManagerImpl.getInstance(PhpInterpretersManagerImpl.java:48)
	at com.jetbrains.php.config.PhpProjectConfigurationFacade.getInterpreter(PhpProjectConfigurationFacade.java:77)
	at com.jetbrains.php.testFramework.run.PhpTestRunConfiguration.getInterpreter(PhpTestRunConfiguration.java:390)
	at com.jetbrains.php.testFramework.run.PhpTestRunConfiguration.<init>(PhpTestRunConfiguration.java:84)
	at com.jetbrains.php.codeception.run.CodeceptionRunConfiguration.<init>(CodeceptionRunConfiguration.java:65)
	at com.jetbrains.php.codeception.run.CodeceptionRunConfigurationType$1.createTemplateConfiguration(CodeceptionRunConfigurationType.java:25)
	at com.intellij.execution.configurations.ConfigurationFactory.createTemplateConfiguration(ConfigurationFactory.java:68)
	at com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl.readExternal(RunnerAndConfigurationSettingsImpl.kt:211)
	at com.intellij.execution.impl.RunConfigurationSchemeManager.readData(RunConfigurationSchemeManager.kt:61)
	at com.intellij.execution.impl.RunConfigurationSchemeManager.createScheme(RunConfigurationSchemeManager.kt:44)
	at com.intellij.execution.impl.RunConfigurationSchemeManager.createScheme(RunConfigurationSchemeManager.kt:22)
	at com.intellij.configurationStore.LazySchemeProcessor.createScheme$default(scheme-impl.kt:65)
	at com.intellij.configurationStore.schemeManager.SchemeLoader.loadScheme(schemeLoader.kt:175)
	at com.intellij.configurationStore.schemeManager.SchemeManagerImpl$loadSchemes$isLoadOnlyFromProvider$2.invoke(SchemeManagerImpl.kt:194)
	at com.intellij.configurationStore.schemeManager.SchemeManagerImpl$loadSchemes$isLoadOnlyFromProvider$2.invoke(SchemeManagerImpl.kt:43)
	at com.intellij.configurationStore.SchemeManagerIprProvider.processChildren(SchemeManagerIprProvider.kt:48)
	at com.intellij.configurationStore.schemeManager.SchemeManagerImpl.loadSchemes(SchemeManagerImpl.kt:192)
	at com.intellij.configurationStore.schemeManager.SchemeManagerImpl.reload(SchemeManagerImpl.kt:253)
	at com.intellij.execution.impl.RunManagerImpl.loadState(RunManagerImpl.kt:761)
	at com.intellij.execution.impl.RunManagerImpl.loadState(RunManagerImpl.kt:73)
	at com.intellij.configurationStore.ComponentStoreImpl.doInitComponent(ComponentStoreImpl.kt:438)
	at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:373)
	at com.intellij.configurationStore.ComponentStoreImpl.initPersistenceStateComponent(ComponentStoreImpl.kt:138)
	at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:102)
	at com.intellij.configurationStore.ComponentStoreWithExtraComponents.initComponent(ComponentStoreWithExtraComponents.kt:50)
	at com.intellij.serviceContainer.ComponentManagerImpl.initializeComponent$intellij_platform_serviceContainer(ComponentManagerImpl.kt:355)
	at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:53)
	at com.intellij.serviceContainer.ServiceComponentAdapter.access$createAndInitialize(ServiceComponentAdapter.kt:13)
	at com.intellij.serviceContainer.ServiceComponentAdapter$doCreateInstance$1.run(ServiceComponentAdapter.kt:43)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:628)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:192)
	at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:42)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:115)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:69)
	at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:408)
	at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:391)
	at com.intellij.execution.impl.ProjectRunConfigurationInitializer.serviceCreated(ProjectRunConfigurationInitializer.kt:28)
	at com.intellij.openapi.project.ProjectLoadHelper$Companion$notifyThatComponentCreated$$inlined$runHandler$1.accept(projectLoader.kt:110)
	at com.intellij.openapi.project.ProjectLoadHelper$Companion$notifyThatComponentCreated$$inlined$runHandler$1.accept(projectLoader.kt)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processWithPluginDescriptor(ExtensionPointImpl.java:291)
	at com.intellij.openapi.project.ProjectLoadHelper$Companion.notifyThatComponentCreated(projectLoader.kt:114)
	at com.intellij.openapi.project.ProjectLoadHelper.notifyThatComponentCreated(projectLoader.kt)
	at com.intellij.openapi.project.impl.ProjectImpl.init(ProjectImpl.java:291)
	at com.intellij.openapi.project.impl.ProjectManagerImpl.initProject(ProjectManagerImpl.java:320)
	at com.intellij.platform.PlatformProjectOpenProcessorKt.convertAndLoadProject(PlatformProjectOpenProcessor.kt:409)
	at com.intellij.platform.PlatformProjectOpenProcessorKt.prepareProject(PlatformProjectOpenProcessor.kt:300)
	at com.intellij.platform.PlatformProjectOpenProcessorKt.access$prepareProject(PlatformProjectOpenProcessor.kt:1)
	at com.intellij.platform.PlatformProjectOpenProcessor$Companion$openExistingProject$$inlined$runInAutoSaveDisabledMode$lambda$1.invoke(PlatformProjectOpenProcessor.kt:187)
	at com.intellij.platform.PlatformProjectOpenProcessor$Companion$openExistingProject$$inlined$runInAutoSaveDisabledMode$lambda$1.invoke(PlatformProjectOpenProcessor.kt:58)
	at com.intellij.platform.ProjectUiFrameAllocator$run$1$progressTask$1.run(ProjectFrameAllocator.kt:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:934)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:490)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:79)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:628)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	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.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)

PhpStorm 2020.2 EAP
Build #PS-202.4357.31, built on May 28, 2020
PhpStorm EAP User
Expiration date: June 27, 2020
Runtime version: 11.0.7+10-b912.1 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.5
GC: ParNew, ConcurrentMarkSweep
Memory: 4062M
Cores: 4
Registry: run.processes.with.pty=TRUE
Non-Bundled Plugins: com.wakatime.intellij.plugin, name.kropp.intellij.makefile, net.seesharpsoft.intellij.plugins.csv, some.awesome, NEON support, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.annotation, de.espend.idea.php.generics, fr.adrienbrault.idea.symfony2plugin

Error validating psalm path on windows

I'm eager to use the psalm inspection added in 0.5.0, thanks for your work on this.

Unfortunately I'm getting an error when setting the local psalm path. I'm on Windows 10, which I think causes the issue compared to Linux. I don't have php installed on windows; I use Debian 10 with php installed through WSL. I don't think this affects the plugin, since I have my PHP interpreter set correctly to Debian via "Languages & Frameworks > PHP"

When clicking "Validate" after setting the path, I get the following error message at the bottom of the window:
Cannot run program "C:\Users\<redacted>\vendor\vimeo\psalm\psalm" (in directory "C:\Users\<redacted>"): CreateProcess error=193, %1 is not a valid Win32 application

If I press "Apply" anyway and enable the inspection, it shows the actual exception name in a popup balloon when it tries to inspect the file: com.intellij.execution.process.ProcessNotCreatedException

Got two java.lang.ArrayIndexOutOfBoundsException

The first one:

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at de.espend.idea.php.generics.type.TemplateAnnotationTypeProvider.complete(TemplateAnnotationTypeProvider.java:66)
	at com.jetbrains.php.PhpIndexImpl.lambda$completeType$1(PhpIndexImpl.java:129)
	at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:117)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:129)
	at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:708)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:617)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:508)
	at de.espend.idea.php.generics.utils.PhpTypeProviderUtil.getResolvedParameter(PhpTypeProviderUtil.java:159)
	at de.espend.idea.php.generics.utils.PhpTypeProviderUtil.getResolvedParameter(PhpTypeProviderUtil.java:136)
	at de.espend.idea.php.generics.type.TemplateAnnotationTypeProvider.getBySignature(TemplateAnnotationTypeProvider.java:103)
	at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:644)
	at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:508)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:142)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:100)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.global(PhpType.java:460)
	at com.jetbrains.php.completion.PhpLookupElement.getPhpType(PhpLookupElement.java:342)
	at com.jetbrains.php.completion.PhpCompletionSorting.getType(PhpCompletionSorting.java:551)
	at com.jetbrains.php.completion.PhpCompletionSorting.access$500(PhpCompletionSorting.java:56)
	at com.jetbrains.php.completion.PhpCompletionSorting$PhpReceiverTypeWeigher.weigh(PhpCompletionSorting.java:524)
	at com.jetbrains.php.completion.PhpCompletionSorting$PhpReceiverTypeWeigher.weigh(PhpCompletionSorting.java:503)
	at com.intellij.codeInsight.lookup.LookupElementWeigher.weigh(LookupElementWeigher.java:41)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:76)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.lookup.Classifier.addElement(Classifier.java:40)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:88)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.lookup.Classifier.addElement(Classifier.java:40)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:88)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.lookup.Classifier.addElement(Classifier.java:40)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:88)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.lookup.Classifier.addElement(Classifier.java:40)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:88)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.lookup.Classifier.addElement(Classifier.java:40)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:88)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.lookup.Classifier.addElement(Classifier.java:40)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:88)
	at com.intellij.codeInsight.lookup.CachingComparingClassifier.addElement(CachingComparingClassifier.java:20)
	at com.intellij.codeInsight.completion.BaseCompletionLookupArranger.addElement(BaseCompletionLookupArranger.kt:129)
	at com.intellij.codeInsight.completion.CompletionLookupArrangerImpl.addElement(CompletionLookupArrangerImpl.java:26)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.lambda$addItem$1(LookupImpl.java:276)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.withLock(LookupImpl.java:1229)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.addItem(LookupImpl.java:274)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.addItemToLookup(CompletionProgressIndicator.java:452)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.addItem(CompletionProgressIndicator.java:443)
	at com.intellij.codeInsight.completion.AsyncCompletion$1.lambda$null$0(CompletionThreading.java:145)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
	at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
	at com.intellij.codeInsight.completion.AsyncCompletion$1.lambda$consume$1(CompletionThreading.java:145)
	at com.intellij.codeInsight.completion.AsyncCompletion$1WeighItems.run(CompletionThreading.java:113)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:95)
	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.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:255)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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)

And the other one:

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at de.espend.idea.php.generics.type.TemplateAnnotationTypeProvider.complete(TemplateAnnotationTypeProvider.java:66)
	at com.jetbrains.php.PhpIndexImpl.lambda$completeType$1(PhpIndexImpl.java:129)
	at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:117)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:129)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:100)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.global(PhpType.java:460)
	at com.jetbrains.php.lang.inspections.PhpVoidFunctionResultUsedInspection.analyzeCall(PhpVoidFunctionResultUsedInspection.java:50)
	at com.jetbrains.php.lang.inspections.PhpVoidFunctionResultUsedInspection.access$000(PhpVoidFunctionResultUsedInspection.java:23)
	at com.jetbrains.php.lang.inspections.PhpVoidFunctionResultUsedInspection$1.visitPhpMethodReference(PhpVoidFunctionResultUsedInspection.java:41)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:31)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:69)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$null$6(LocalInspectionsPass.java:320)
	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:168)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:126)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:115)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:110)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:320)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:105)
	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.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:117)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:96)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:168)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:168)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:96)
	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:177)

IDE Exception Short name 'ClassStringLocalInspection' is not unique class

Hi,

I get these errors peroidically when using PHPStorm

com.intellij.diagnostic.PluginException: Short name 'ClassStringLocalInspection' is not unique
class 'de.espend.idea.php.generics.inspection.PsalmLocalImmutableInspection' in PluginDescriptor(name=PHP Generics, classpath=C:\Users\chris\.PhpStorm2019.3\config\plugins\PHP Generics)
and
class'de.espend.idea.php.generics.inspection.ClassStringLocalInspection' in PluginDescriptor(name=PHP Generics, classpath=C:\Users\chris\.PhpStorm2019.3\config\plugins\PHP Generics)
conflict [Plugin: de.espend.idea.php.generics]
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.checkForDuplicateShortName(InspectionToolRegistrar.java:134)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.registerInspection(InspectionToolRegistrar.java:81)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.registerInspections(InspectionToolRegistrar.java:61)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.lambda$new$0(InspectionToolRegistrar.java:41)
	at com.intellij.openapi.util.NotNullLazyValue$2.compute(NotNullLazyValue.java:67)
	at com.intellij.openapi.util.NotNullLazyValue.getValue(NotNullLazyValue.java:38)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.createTools(InspectionToolRegistrar.java:174)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.createTools(InspectionProfileImpl.java:459)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.initialize(InspectionProfileImpl.java:481)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools(InspectionProfile.kt:110)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.initialize(InspectionProfileImpl.java:476)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools(InspectionProfile.kt:110)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools$default(InspectionProfile.kt:103)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools(InspectionProfile.kt)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.getAllTools(InspectionProfileImpl.java:770)
	at com.intellij.ide.ui.InspectionsTopHitProvider.getOptions(InspectionsTopHitProvider.java:31)
	at com.intellij.ide.ui.OptionsTopHitProvider.getCachedOptions(OptionsTopHitProvider.java:78)
	at com.intellij.ide.ui.OptionsTopHitProvider.access$600(OptionsTopHitProvider.java:39)
	at com.intellij.ide.ui.OptionsTopHitProvider$Activity.lambda$cacheAll$2(OptionsTopHitProvider.java:267)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processWithPluginDescriptor(ExtensionPointImpl.java:292)
	at com.intellij.openapi.extensions.ExtensionPointName.processWithPluginDescriptor(ExtensionPointName.java:157)
	at com.intellij.ide.ui.OptionsTopHitProvider$Activity.cacheAll(OptionsTopHitProvider.java:263)
	at com.intellij.ide.ui.OptionsTopHitProvider$Activity.lambda$runActivity$0(OptionsTopHitProvider.java:248)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:193)
	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)

using

PhpStorm 2019.3.3
Build #PS-193.6494.47, built on February 13, 2020
Licensed to Chris Seufert
Subscription is active until June 2, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: run.processes.with.pty=TRUE
Non-Bundled Plugins: com.github.camork.fileExpander, com.intellij.lang.jsgraphql, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.annotation, de.espend.idea.php.generics, intellij.prettierJS

How can I help?

I found this plugin and I thought it was really cool.

I see that it is work in progress and that there are a bunch of PHPStorm issues. Are they all blockers? Are we waiting for them to fix the issues and then the work here can continue?

Psalm / PhpStan config path

First, many thanks for this plugin. ๐Ÿ‘

Could you add a config path for Pslam and PhpStan, so that I can choose a different config file? For example: we use different config files for new and old files, so that new modules are a bit stricter than older code and this config files are not in the root directory of the project.

PHPStan errors still shown after PHPStan config change

I guess the below is a caching issue?

Initial situation:

  • everything set up for PHPStan (Quality Tools, Inspections)
  • some ignoreErrors entries in PHPStan config file
  • no reported errors running vendor/bin/phpstan analyse
  • no errors shown in PhpStorm editor

Steps to reproduce:

  1. Remove an entry from ignoreErrors affecting a test file
  2. Open the test file
  3. Undo the ignoreErrors change
  4. Revisit/reopen test file
  5. Compare PHPStan errors reported in PhpStorm editor vs vendor/bin/phpstan analyse (latter reports none)

Expected: Errors disappear from PhpStorm editor (at least after reopening the file)

Actual: PhpStorm editor still shows PHPStan errors

psalm: "The reference cache must be an array"

I am trying to use the "PHPStan / Psalm / Generics"-Plugin for PhpStorm but I see some error in my local error log.

unserialize(): Error at offset 552956 of 552960 bytes

โ‡‰ If I look for the file on the filesystem, this file is already deleted, so maybe the plugin is using psalm in a non-optimal way (or it's related to a Java Exception from the Plugin?!), or why do we try to fetch non-existing cache files?

UnexpectedValueException: The reference cache must be an array
#5 phar:///home/lmoelleken/vdmg/Framework/thirdparty/psalm.phar/src/Psalm/Internal/Provider/FileReferenceCacheProvider.php(154): getCachedMethodMemberReferences
#4 phar:///home/lmoelleken/vdmg/Framework/thirdparty/psalm.phar/src/Psalm/Internal/Provider/FileReferenceProvider.php(402): loadReferenceCache
#3 phar:///home/lmoelleken/vdmg/Framework/thirdparty/psalm.phar/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(770): checkPaths
#2 phar:///home/lmoelleken/vdmg/Framework/thirdparty/psalm.phar/src/psalm.php(398): require_once
#1 phar:///home/lmoelleken/vdmg/Framework/thirdparty/psalm.phar/psalm(5): require
#0 Framework/thirdparty/psalm.phar(14): null

psalm closed this issue because it's produced by third-party solutions: vimeo/psalm#3300

Typehint for classes not working

Typehinting functions with class-string keyword working perfectly:

works-great

Typehinting classes is not working. Its not implemented yet or i have a typo in my code?

not-working

Thank you very much. BTW amazing job.

PHPStan Feedback

Hey there, as promised I've been checking out your phpstan plugin for PHPStorm, and overall I'm hugely impressed by what you've done. Bravo, sir. I think this could be a game-changer for us all.

All that said, I have some early feedback, if you're interested. Diving right in:

  1. It would be nice to have some way to "build" the entire project. Currently, I have to run phpstan in a separate step and look up the files it finds, or just sort of meander randomly through my files looking for the error indicators. Could your tool be integrated into the "Code" menu?

  2. Shouldn't the errors render little marks in the scroll gutter?
    image

  3. I get the same error, constantly:

image

I've clicked the "Exclude" link, and verified that it's added to the ignore list, but the error persists. Is there a more detailed log somewhere I can inspect?

I'll keep playing with it. More soon. Keep up the great work.

Doesn't seem to install correctly in PHPStorm 2020.1

Looks like a great plugin, but maybe I don't quite fathom exactly what is supposed to happen. I began by installing from your website (I downgraded my PHPStorm version from 2020.1 to 2019.3):

image

image

If I open PHPStorm plugins, and search for "phpstan" in the marketplace, I can see it marked as "installed":

image

But I don't see any "PHPStan" section in Settings > Languages & Frameworks > PHP > Quality Tools:

image

Am I missing something? Let me know if I can provide any more information. Thanks much.

Plugin seems to be passing the wrong arguments to phpstan when analysing a source file

I'm using a remote interpreter, and in my setup I get the following error from logs

17:58	PHPStan
				phpstan: Can not correctly run the tool with parameters:
				analyse
				--error-format=checkstyle
				null
				Possible tool process hangup after 5 sec.

The plugin seems to be executing phpstan passing null as an argument for phpstan.

My phpstan setup is already validated in the IDE. The same happens if I increase timeout.

Templates don't work with @extends

I'd like to use templates to describe generic interfaces of repository classes. For example:

namespace App\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * @template T of object
 * @method T|null find(array|int $id)
 * @method T[] findBy(array $criteria)
 */
abstract class BaseRepository extends EntityRepository {
  // methods are actually implemented in the EntityRepository class,
  // but I can't change its docblocks since it's a 3rd party package,
  // hence the @method annotations at the beginning
}
namespace App\Repository;

use App\Entity\Dog;

/** @extends BaseRepository<Dog> */
class DogRepository extends BaseRepository {
  // ...
}

Now when I type $dogRepository->find(1)->, the IDE doesn't see the correct type; instead it thinks the method returns a non-existent type App\Repository\T.

Just reporting for posterity, I know the plugin is WIP, awesome work by the way!

Add icon next to suggestion

I use LSP, deep-assoc and this plugin and autocomplete is pretty good. But I often get duplication and clicking on one produces weird code like this:

$definedAddress->getSystemAddress()getSystemAddress() // duplicated

The problem is I don't know which plugin suggested which option in order to report a bug or make a reproducer.

Is it possible to have an icon next to suggestions like deep-assoc plugin has?

If of any importance; LSP is v1.6.0, the only version that works currently (new 1.6.1 doesn't work).

Problem with PhpStorm 2020.2 EAP - PS-202.5958.28

com.intellij.openapi.extensions.ExtensionException: Extension class de.espend.idea.php.quality.phpstan.configuration.PhpStanValidatorConfigurationManager does not implement interface com.jetbrains.php.config.interpreters.PhpInterpretersStateListener (adapter=ExtensionComponentAdapter(impl=de.espend.idea.php.quality.phpstan.configuration.PhpStanValidatorConfigurationManager, plugin=PluginDescriptor(name=PHPStan / Psalm / Generics, id=de.espend.idea.php.generics, path=/home/iux/.local/share/JetBrains/PhpStorm2020.2/PHP Generics, version=0.7.0)))

PhpStorm 2020.2 EAP
Build #PS-202.5958.28, built on June 25, 2020
PhpStorm EAP User
Expiration date: July 25, 2020
Runtime version: 11.0.7+10-b944.13 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.7.6-arch1-1
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 16
Registry: run.processes.with.pty=TRUE, debugger.watches.in.variables=false, ide.balloon.shadow.size=0
Non-Bundled Plugins: Jenkins Control Plugin, Scratch, String Manipulation, com.alayouni.ansiHighlight, com.chrisrm.idea.MaterialThemeUI, com.github.leomillon.uuidgenerator, com.jonathonstaff.ideaascii, com.mallowigi, de.netnexus.camelcaseplugin, ms.konovalov.intellij.hidpi-profiles, name.kropp.intellij.makefile, net.seesharpsoft.intellij.plugins.csv, org.intellij.RegexpTester, org.zalando.intellij.swagger, intellij.prettierJS, com.aurimasniekis.phppsr4namespacedetector, com.dryabov.phpStorm.phpregexp, de.espend.idea.laravel, de.espend.idea.php.annotation, net.king2500.plugins.PhpAdvancedAutoComplete, de.espend.idea.php.generics, lv.midiana.misc.phpstorm-plugins.deep-keys, fr.adrienbrault.idea.symfony2plugin, izhangzhihao.rainbow.brackets, ru.adelf.idea.dotenv, org.asciidoctor.intellij.asciidoc
Current Desktop: KDE

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

In file: LightVirtualFile: \fragment.php

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at de.espend.idea.php.generics.type.TemplateAnnotationTypeProvider.complete(TemplateAnnotationTypeProvider.java:66)
	at com.jetbrains.php.PhpIndexImpl.lambda$completeType$1(PhpIndexImpl.java:129)
	at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:117)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:129)
	at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:100)
	at com.jetbrains.php.lang.psi.resolve.types.PhpType.global(PhpType.java:460)
	at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.lambda$resolveInHierarchy$0(MemberReferenceImpl.java:177)
	at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158)
	at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
	at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:117)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:75)
	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
	at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:73)
	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:154)
	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:136)
	at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveInHierarchy(MemberReferenceImpl.java:174)
	at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveGlobal(MemberReferenceImpl.java:159)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.resolveGlobal(MethodReferenceImpl.java:85)
	at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.lambda$static$0(PhpReferenceImpl.java:156)
	at com.intellij.psi.impl.source.resolve.ResolveCache$PolyVariantResolver.resolve(ResolveCache.java:67)
	at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolve$1(ResolveCache.java:152)
	at com.intellij.openapi.util.Computable.get(Computable.java:17)
	at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$3(ResolveCache.java:225)
	at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:117)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:75)
	at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:202)
	at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:152)
	at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:167)
	at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:160)
	at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.multiResolve(PhpReferenceImpl.java:150)
	at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.resolve(PhpReferenceImpl.java:136)
	at com.jetbrains.php.lang.annotator.PhpAnnotatorVisitor.visitPhpMethodReference(PhpAnnotatorVisitor.java:582)
	at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:31)
	at com.jetbrains.php.lang.annotator.PhpAnnotator.annotate(PhpAnnotator.java:17)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:129)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:110)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:346)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:280)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:306)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:309)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:93)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:309)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:277)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:222)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:52)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:442)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:435)
	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.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:434)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:410)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:168)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:168)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:408)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:171)
	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:177)

PhpStorm 2020.1.1
Build #PS-201.7223.96, built on April 30, 2020
Licensed to Enkora Oy / Artem Goutsoul
Subscription is active until February 6, 2021
Runtime version: 11.0.6+8-b765.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1450M
Cores: 12
Registry: ide.windowSystem.autoShowProcessPopup=true, run.processes.with.pty=TRUE, debugger.watches.in.variables=false, ide.tooltip.initialDelay=187
Non-Bundled Plugins: CMD Support, Jetbrains TeamCity Plugin, Key Promoter X, Scratch, Statistic, String Manipulation, org.intellij.tasks.navigation, com.intellij.ideolog, net.seesharpsoft.intellij.plugins.csv, com.dmarcotte.handlebars, com.jetbrains.lang.ejs, ru.adelf.idea.dotenv, NEON support, lv.midiana.misc.phpstorm-plugins.deep-keys, lv.midiana.misc.idea-plugins.deep-js-completion, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.annotation, de.espend.idea.php.generics, org.psliwa.idea.composer, some.awesome

Problem loading PHP Generics in PhpStorm 2019.3.3

A red exclamation mark appears in the bottom right of PhpStorm, it reads:

com.intellij.diagnostic.PluginException: Short name 'ClassStringLocalInspection' is not unique
class 'de.espend.idea.php.generics.inspection.PsalmLocalImmutableInspection' in PluginDescriptor(name=PHP Generics, classpath=C:\Users\hjpol\.PhpStorm2019.3\config\plugins\PHP Generics)
and
class'de.espend.idea.php.generics.inspection.ClassStringLocalInspection' in PluginDescriptor(name=PHP Generics, classpath=C:\Users\hjpol\.PhpStorm2019.3\config\plugins\PHP Generics)
conflict [Plugin: de.espend.idea.php.generics]
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.checkForDuplicateShortName(InspectionToolRegistrar.java:134)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.registerInspection(InspectionToolRegistrar.java:81)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.registerInspections(InspectionToolRegistrar.java:61)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.lambda$new$0(InspectionToolRegistrar.java:41)
	at com.intellij.openapi.util.NotNullLazyValue$2.compute(NotNullLazyValue.java:67)
	at com.intellij.openapi.util.NotNullLazyValue.getValue(NotNullLazyValue.java:38)
	at com.intellij.codeInspection.ex.InspectionToolRegistrar.createTools(InspectionToolRegistrar.java:174)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.createTools(InspectionProfileImpl.java:459)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.initialize(InspectionProfileImpl.java:481)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools(InspectionProfile.kt:110)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.initialize(InspectionProfileImpl.java:476)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools(InspectionProfile.kt:110)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools$default(InspectionProfile.kt:103)
	at com.intellij.codeInspection.ex.NewInspectionProfile.initInspectionTools(InspectionProfile.kt)
	at com.intellij.codeInspection.ex.InspectionProfileImpl.getAllTools(InspectionProfileImpl.java:770)
	at com.intellij.ide.ui.InspectionsTopHitProvider.getOptions(InspectionsTopHitProvider.java:31)
	at com.intellij.ide.ui.OptionsTopHitProvider.getCachedOptions(OptionsTopHitProvider.java:78)
	at com.intellij.ide.ui.OptionsTopHitProvider.access$600(OptionsTopHitProvider.java:39)
	at com.intellij.ide.ui.OptionsTopHitProvider$Activity.lambda$cacheAll$2(OptionsTopHitProvider.java:267)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processWithPluginDescriptor(ExtensionPointImpl.java:292)
	at com.intellij.openapi.extensions.ExtensionPointName.processWithPluginDescriptor(ExtensionPointName.java:157)
	at com.intellij.ide.ui.OptionsTopHitProvider$Activity.cacheAll(OptionsTopHitProvider.java:263)
	at com.intellij.ide.ui.OptionsTopHitProvider$Activity.lambda$runActivity$0(OptionsTopHitProvider.java:248)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:193)
	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)

Exception in phpstorm 2020.1

Exception is thrown as soon as plugin is installed.

phpstorm details:

PhpStorm 2020.1
Build #PS-201.6668.153, built on April 13, 2020
Licensed to Massimiliano Arione
Subscription is active until August 14, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.4.0-25-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1936M
Cores: 4
Registry: run.processes.with.pty=TRUE, documentation.show.toolbar=true
Non-Bundled Plugins: com.alayouni.ansiHighlight, com.bashorov.mainMenuToggler, com.intellij.ideolog, name.kropp.intellij.makefile, org.jetbrains.plugins.node-remote-interpreter, de.espend.idea.php.toolbox, de.espend.idea.php.annotation, fr.adrienbrault.idea.symfony2plugin, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.phpunit, izhangzhihao.rainbow.brackets, de.espend.idea.php.generics
Current Desktop: ubuntu:GNOME

Stacktrace:

com.intellij.diagnostic.PluginException: Short name 'ClassStringLocalInspection' is not unique
class 'de.espend.idea.php.generics.inspection.PsalmLocalImmutableInspection' in PluginDescriptor(name=PHP Generics, id=de.espend.idea.php.generics, path=/home/garak/.local/share/JetBrains/PhpStorm2020.1/PHP Generics)
and
class'de.espend.idea.php.generics.inspection.ClassStringLocalInspection' in PluginDescriptor(name=PHP Generics, id=de.espend.idea.php.generics, path=/home/garak/.local/share/JetBrains/PhpStorm2020.1/PHP Generics)
conflict [Plugin: de.espend.idea.php.generics]
at com.intellij.codeInspection.ex.InspectionToolRegistrar.checkForDuplicateShortName(InspectionToolRegistrar.java:132)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.registerInspection(InspectionToolRegistrar.java:79)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.access$000(InspectionToolRegistrar.java:30)
at com.intellij.codeInspection.ex.InspectionToolRegistrar$1.extensionAdded(InspectionToolRegistrar.java:64)
at com.intellij.codeInspection.ex.InspectionToolRegistrar$1.extensionAdded(InspectionToolRegistrar.java:61)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.notifyListeners(ExtensionPointImpl.java:686)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.lambda$registerExtensions$17(ExtensionPointImpl.java:876)
at com.intellij.ide.plugins.DynamicPlugins.loadPluginDescriptor(DynamicPlugins.kt:544)
at com.intellij.ide.plugins.DynamicPlugins.access$loadPluginDescriptor(DynamicPlugins.kt:89)
at com.intellij.ide.plugins.DynamicPlugins$loadPlugin$1.run(DynamicPlugins.kt:494)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:976)
at com.intellij.ide.plugins.DynamicPlugins.loadPlugin(DynamicPlugins.kt:491)
at com.intellij.ide.plugins.PluginInstaller.installAndLoadDynamicPlugin(PluginInstaller.java:269)
at com.intellij.ide.plugins.PluginInstaller.lambda$prepareToInstall$0(PluginInstaller.java:70)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:310)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:739)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Warnings get stuck, only restarting fixes it

This issue is the result of tweeting with the PhpStorm support: https://twitter.com/_ricardoboss/status/1300732016376401925

image

There are warnings getting stuck until I disable the plugin or restart PhpStorm.

Version Info:

PhpStorm 2020.2.1
Build #PS-202.6948.87, built on August 27, 2020
Runtime version: 11.0.8+10-b944.31 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: run.processes.with.pty=TRUE, ide.allow.merge.buttons=false, ide.tooltip.initialDelay=699
Non-Bundled Plugins: CMD Support, com.intellij.ideolog, com.intellij.properties, com.jetbrains.colorful.toolwindow.icons, com.wix.sasslint, org.jetbrains.plugins.stylus, Gitflow, mobi.hsz.idea.gitignore, Dart, com.intellij.plugins.html.instantEditing, spy-js, Karma, com.hasintech.intellij.angularTemplates, com.intellij.plugins.webcomponents, com.jetbrains.lang.ejs, com.jetbrains.plugins.jade, com.jetbrains.plugins.yeoman, com.dmarcotte.handlebars, com.jetbrains.plugins.meteor, com.github.masahirosuzuka.PhoneGapIntelliJPlugin, NEON support, de.espend.idea.laravel, de.espend.idea.php.annotation, fr.adrienbrault.idea.symfony2plugin, ru.adelf.idea.dotenv

Argument Must not be null

Installed plugin
Set path to phpstan (installed globally using composer)
Enabled inspection

Now on every file edit, i get error
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'parameter' of com/intellij/execution/configurations/GeneralCommandLine.addParameter must not be null

What did i missed? Is there any doc of installing plugin?

Plugin is not compatible with PhpStorm 2020.3

Unfortunately, we've changed the API for quality tools in 2020.3, and the plugin stopped to be compatible.

ExternalToolPass: 

com.intellij.diagnostic.PluginException: annotator: de.espend.idea.php.quality.phpstan.PhpStanAnnotatorQualityToolAnnotator@55928e4b (class de.espend.idea.php.quality.phpstan.PhpStanAnnotatorQualityToolAnnotator) [Plugin: de.espend.idea.php.generics]
	at com.intellij.ide.plugins.PluginManagerCore.createPluginException(PluginManagerCore.java:323)
	at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:12)
	at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:59)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.process(ExternalToolPass.java:255)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.collectInformationWithProgress(ExternalToolPass.java:137)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:54)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:401)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1137)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:394)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:393)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:369)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:172)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:367)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:185)
	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)
Caused by: java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract com.jetbrains.php.tools.quality.QualityToolType getQualityToolType()' of abstract class com.jetbrains.php.tools.quality.QualityToolAnnotator.
	at com.jetbrains.php.tools.quality.QualityToolAnnotator.collectAnnotatorInfo(QualityToolAnnotator.java:83)
	at com.jetbrains.php.tools.quality.QualityToolAnnotator.collectInformation(QualityToolAnnotator.java:137)
	at com.jetbrains.php.tools.quality.QualityToolAnnotator.collectInformation(QualityToolAnnotator.java:71)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.collectInformationWithProgress(ExternalToolPass.java:134)
	... 19 more

I'll open PR ASAP to restore compatibility with 2020.3. Sorry for the inconvenience!

Not working with remote interpreter

Hi, thanks for the plugin!

Unfortunately there seem to be a little bug using it with remote, or at least "project interpreter" (which is a remote one). If I select this, and try to configure the path, the "local" settings just get multiplied.

image

Quality Tools Configuration Dialog Bug

Every time I open the window a few Local entries are added:
image

Also there doesn't seem + - buttons to add an interpreter (I'd like to add a Docker one, since we have our environment completely dockerized)...

Missing import reported for non-doctrine annotations

In version 7.0.0 are reported missing imports, which is really nice for Doctrine annotations.

But I got reported non-doctrine annotations too. These should be imho ignored

Specifically all @phpstan-* and @psalm-* and also all from Doctrine ignore list (e.g. phpcsSuppress from Slevomat CS and dataProvider from PHPUnit are reported)

"At least one path must be specified to analyse"

Plugin: 0.7.0
PhpStorm: 2020.2.1

Enabled in Inspections:
image

Configured using a remote interpreter:
image

image

Error shown in bubble and even log:

08:49	PHPStan
						phpstan: Note: Using configuration file /vagrant/project/phpstan.neon.
						At least one path must be specified to analyse.
						Exclude SomeClass.php from PHPStan analysis.

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.