Comments (13)
Isn't that a bug with PhpStorm itself? That seems weird that $actor
is correctly recognized as an instance of ActorInterface
, but the following method calls don't work. I know I've had similar problems over some versions (it seems it's something that breaks often). I'm just guessing though…
from phpstorm-phpdi.
That looks like unrelated to the way this plugin works, from the first sight.
Could you show how the getUser
method is defined on the ActorInterface
(with the docblock)?
from phpstorm-phpdi.
@mnapoli It's not only here where the issue comes up; it's anywhere. After calling a method on any obejct returned by get()
, that returned value will have no type information as it it were NULL. This was only an example that I gave.
@pulyaevskiy it should return a user
/**
* Returns the actor as a user. An exception is thrown if the current actor
* is not a user.
*
* @throw ActorException
* @return User
*/
function getUser();
I'm on PHPStorm 10 by the way
from phpstorm-phpdi.
@aszeremi-workangel
I'm on PHPStorm 10 by the way
Aha, I haven't tested the plugin with the latest version yet, so wouldn't be surprised if there is some issues.
Will take a look asap and get back with updates here.
from phpstorm-phpdi.
@aszeremi-workangel
So, I installed PHPStorm 10 and I can't seem to reproduce your issue.
I have tried the same pattern and everything works just fine.
I have only couple suggestions in mind:
- You can try to invalidate all caches in PHPStorm, sometimes it helps.
- Double check that
User
class is properly imported withuse
statement inActorInterface
file.
You can also try to create a gist which reproduces this issue for you, so I can try to reproduce it on my end.
from phpstorm-phpdi.
@pulyaevskiy based on my code examples it's evident that I typed everything correctly, otherwise even in the case of manual type-commenting I would get the same issue.
But I'll give it a try again on different computers
from phpstorm-phpdi.
I just want to remind that for me it happens quite often that PhpStorm breaks the autocompletion for some use cases (usually the most exotic ones) from version to version. Maybe it could be another plugin interfering, who knows.
from phpstorm-phpdi.
@aszeremi-workangel
based on my code examples it's evident that I typed everything correctly
Sorry but that's not evident for me. There is just too many things which can be causing this issue.
I agree with @mnapoli that there is also a chance of another plugin interfering.
I would be happy to help if I can get some more information:
- What's the OS you're running?
- List of installed plugins?
- Gist with a code snippet (or a sample git repository) which reproduces this issue for you.
from phpstorm-phpdi.
It appears I am not able to reproduce it here at home either. I'll try again at work.
from phpstorm-phpdi.
Yes, I'm still getting this issue at work
OS:
Ubuntu 14.04
Custom plugins:
.ignore, BashSupport, Markdown, Markdown support, Mongo Plugin, MultiMarkdown, PHP-DI plugin, Require.js plugin
Code snippet that works anywhere where last method call is showed as yellow:
$this->getServiceLocator()->get(\DateTime::class)->format('bla')->format('bla');
from phpstorm-phpdi.
@aszeremi-workangel
Thanks for the information! One note:
format()
method on \DateTime
returns string, so last method call is invalid and should be highlighted as yellow... unless I'm missing something?
from phpstorm-phpdi.
This was a bad example this time.
And I can't actually reproduce this on my company phpstorm, so I'm closing this for you
from phpstorm-phpdi.
@aszeremi-workangel @mnapoli
Thank you guys for the feedback!
Please let me know if you experience similar issue in future. I'm curious to find the reason.
Just for the record: @aszeremi-workangel I installed all the plugins you listed, one by one, and still couldn't reproduce this issue.
Personally for me (and in our team, afaik) everything has been working without issues so far. If there was any issues it was mostly because we didn't docblock it properly or some wrong use
statement.
from phpstorm-phpdi.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpstorm-phpdi.