Warnings for "cannot resolve directory" and "cannot resolve file" in code moved to include file

I see similar posts to my issue, some with responses suggesting suppressing warnings (and some people saying they don't want to), some suggesting using Resource root.  My problem is not the same as the person who wanted inspections to allow for files that have a section of code started in one file and finished in another.  But it's similar in that if the inspection was able to evaluate file references from the perspective of the file doing the include there wouldn't be an issue.

I started off with code in a PHP file that was intended to be rendered.  Then moved chunks of code into include files.  The included files generate warnings for statements referencing files whose location did not cause a problem when the code sections were in the original file.

The directory structure is like this:

Root (on the web, not the project root)

-- private

----- shared

---------- header.php (with section moved from public/staff/index.php

----- public

----------- staff

--------------- index.php (this is the file that will be accessed)

----------- -stylesheets

----------------stylesheet.css (referenced in includes)

It seems to me that my choices include the following:

  1. Write code in the file that will be accessed, and only move if after inspection and testing.
  2. Write the code in the include file, suppress warnings for the file, and test with Xdebug.

Am I missing a better way to configure and use PhpStorm?  Suppressing warnings for the include function doesn't seem like a great idea.

Thanks

1 comment
Comment actions Permalink

It's a bit complicated to wrap one's head around the setup without having a copy of the project. Could you please build a tiny zip with a file per each directory that would demonstrate the issue?

Thank you!

1

Please sign in to leave a comment.