Undefined class? Follow
Greetings to everyone here. I have heard wonderful things about PHPStorm. I have been a Coda user for a little over a year since switching to Mac but am giving the trial of PHPStorm a fair shot.
I created a new project based on a current local directory I had already been working on in Coda. In the project file list I see all the files and folders in the site directory I specified as expected. Being excited to try out code completion on custom classes, I opened up my root index.php page where I require_once()'ed some classes and created some objects based on those classes. So a snippet looks like this:
require_once 'classes/db.class';
$db = new db();
PHPStorm has highlighted the 'db' I have indicated above and gives me a message of "Undefined class db _more_(F1)" and using the keyboard shortcut basically gives me the same information. The directory and declaration are all correct and work in a browser. The only thing I can think of is that the .class extensions prevents PHPStorm from going in and retrieving the properties and methods. While the file contains PHP, I prefer the .class naming convention seen in Java. Am I correct or am I missing something?
Please sign in to leave a comment.
Menu -> File -> Settinsg -> File Types. Try adding *.class pattern to "PHP files" entry.
Should work straight away. If not -- close and reopen project.
Perfect! Thanks!