pbyrne84 / DynamicReturnTypePlugin

135 stars 7 forks source link

Hint multiple classes #24

Closed willemstuursma closed 10 years ago

willemstuursma commented 10 years ago

In PHPStorm you can have hints that an object is of multiple classes. This is useful for signaling that an object is both of a class and implements an interface.

/** @var Foo|PHPUnit_Framework_MockObject_MockObject */
$foo = $this->getMock("Foo");

However this does not work with the DynamicReturnTypePlugin, you can only suggest one type of class for a method call. I tried adding it do the dynamicReturnTypeMeta.json using

"mask": "%s|PHPUnit_Framework_MockObject_MockObject"

but that does not work (breaks typehints all together).

Could you add this feature?

idr0id commented 10 years ago

:+1:

pbyrne84 commented 10 years ago

I asked Alexy as he is the man with the knowledge on the deep internals http://devnet.jetbrains.com/message/5513098#5513098

PabloEmigrante commented 10 years ago

:+1:

UFOMelkor commented 10 years ago

:+1:

JanTvrdik commented 10 years ago

:+1:

pbyrne84 commented 10 years ago

There is a jar here that should cover it https://github.com/pbyrne84/DynamicReturnTypePlugin/blob/master/deploy/DynamicReturnTypePlugin.zip

Unzip it to your plugin directory over the current one and see if it solves your your problem. plugin mininum is now phpstorm 8.01 jre 7

pbyrne84 commented 10 years ago

Fixed on master. Will release next week after some normal day to day use. Jar file is now java 6 compatible as it seems some people still use it.

Thanks.