Phpstorm doesn't autocomplete protected methods in child classes

Hi,

Recently I've ran into weird problem: PhpStorm doesn't autocomplete inherited protected methods.

F.e.

class A {
   public function foo() {}

   protected function bar () {}
}

class B extends A {

   public function baz() {
      $this->...
   }

}


In case above it'll not propose bar() See attachement, please.

I've asked Google few times, but couldn't find the answer. Also checked settings and found nothing relevant.
Does anyone knows, what is the problem?

PhpStorm 9.0



Attachment(s):
phpstorm_protected_autocomplete.png
4 comments
Comment actions Permalink

Hi there,

Works fine here. Please try "File | Invalidate caches..." and restart IDE.

Also try your code snippet in brand new empty project.

-----

In any case: based on screenshot you most likely have more than one class A & B in the same project (these classes defined twice). Please verify that.

screen01.png

Notice the absence of "override" icons on my screenshot (blue dots with with arrow down next to it) in editor gutter area.

0
Comment actions Permalink

Okay, answering myself.

The problem was in a fact, that I've installed TYPO3 via Composer  on my Windows machine and instead of symlinks there were real copies of a files made.
So, as result I've had exactly same code in folders: /typo3/ and /typo3_src/typo3/, which resulted in such strange behaviour of PhpStorm.

Removing one of the folders saved a situation, but still this is some strange issue. Should I fire a bug report or it is expected behaviour?

0
Comment actions Permalink

Bazzik wrote:
 
In any case: based on screenshot you most likely have more than one class A & B in the same project (these classes defined twice). Please verify that.

Thank you for an answer. Yes, you're right - I did't pay attention to it, but there were some dummy interfaces A and B with PhpUnit supplied in global namespace with methods foo() and baz(). So, I was "lucky" to blindly name my classes with same names and even same method names =)

0
Comment actions Permalink
Removing one of the folders saved a situation,

You could just mark it as Excluded.

Should I fire a bug report or it is expected behaviour?

Strange behaviour is expected (based on past tickets with kind of similar cause) -- with such case/report you most likely will be pointed to workaround (i.e. excluding one of the duplicate folders). Although not offering one of the methods if 2 declarations are exactly the same could make a difference here...

On related note:

0

Please sign in to leave a comment.