Are there any directives to ignore code during indexing?

My situation is simple:

I am unit testing a php class calles \space1\A. Class A has a member class called \space2\B. I wish to stub class \space2\B and so my unit test file for class \space1\A looks like this:

My situation is simple:  I am unit testing a class calles \space1\A. Class A has a member class called \space2\B. I wish to stub class \space2\B and so my unit test file for class \space1\A looks like this:

namespace space2 {
     class B {
        function xyz(){
            // this function and this class are just fakes to prevent the loading of their real counterparts
        }
     }
}

namespace {
   class testA extends PHPUnit_Framework_TestCase {
       // test code here
   } 
}


So the problem is that PhpStorm sees this duplicate class declaration of class B and highlights it as an error.
Is there a way I can prevent this difficulty?

Thanks!

Update: currently I'm doing this using the eval function, but it far offends my taste in good code, so if you were going to offer this as a solution, please don't.

2 comments
Comment actions Permalink

Hi Leo,

If it's not in the same file then use "Mark as plain text" on such file in Project View panel. If it's in the same file (together with test case class) then there is nothing that you can do here.

0
Comment actions Permalink

I thought this might be the case. Another reason to loosely couple in design. Thanks Andriy.

0

Please sign in to leave a comment.