Git Product home page Git Product logo

Comments (13)

mnapoli avatar mnapoli commented on June 29, 2024

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.

pulyaevskiy avatar pulyaevskiy commented on June 29, 2024

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.

 avatar commented on June 29, 2024

@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.

pulyaevskiy avatar pulyaevskiy commented on June 29, 2024

@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.

pulyaevskiy avatar pulyaevskiy commented on June 29, 2024

@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 with use statement in ActorInterface 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.

 avatar commented on June 29, 2024

@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.

mnapoli avatar mnapoli commented on June 29, 2024

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.

pulyaevskiy avatar pulyaevskiy commented on June 29, 2024

@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:

  1. What's the OS you're running?
  2. List of installed plugins?
  3. Gist with a code snippet (or a sample git repository) which reproduces this issue for you.

from phpstorm-phpdi.

 avatar commented on June 29, 2024

It appears I am not able to reproduce it here at home either. I'll try again at work.

from phpstorm-phpdi.

 avatar commented on June 29, 2024

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.

pulyaevskiy avatar pulyaevskiy commented on June 29, 2024

@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.

 avatar commented on June 29, 2024

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.

pulyaevskiy avatar pulyaevskiy commented on June 29, 2024

@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 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.