cantera
cantera

Reputation: 24985

Helping IDE resolve file paths in included files

I have a standard front controller / bootstrap configuration, with the front controller at root/index.php and the bootstrap at root/app/bootstrap.php.

The front controller loads the boostrap file with require_once 'app/bootstrap.php';.

The bootstrap then loads necessary files using paths relative to the front controller, such as require_once 'model/model.php';.

My IDE (PhpStorm 3.0.2) flags the file paths in the bootstrap with a warning that says "Can't resolve target of expression..."

Is there a comment and/or code that can I add to the bootstrap file to help my IDE recognize and resolve the directory/inclusion scheme?

Upvotes: 4

Views: 4369

Answers (1)

Matt Gibson
Matt Gibson

Reputation: 14949

The following ought to work. Annoyingly, it doesn't work if you use $config->directoryroot, but there's a bug open about that here so it should work itself out in future builds.

$directoryroot = '/full/system/path/to/docroot';

require_once($directoryroot.'/app/bootstrap.php');

Upvotes: 2

Related Questions