PhpStorm doesn't knows about methods/variables in my code

Perhaps I misunderstood how PhpStorm works, I never worked with an IDE before.

I created a new project, put in all my code and opened some files. There are many error/info messages telling me methods not found, variable not defined, and more. 

The code itself is correct and works fine (locally and an the web server). However, I thought PhpStorm (magically) knows where the methods are defined, knows about the parameters, sees where variables are created in other file and so on. Was this a misassumption? 

Do I need to configure something to get this work correctly or change my code accordingly?

Project is a CMS https://github.com/processwire/processwire and I am working inside /site-xxxx/templates/ and /site-xxxx/modules/

4 comments
Comment actions Permalink

PhpStorm requires php objects to be located inside a project or added as "include paths".

Could you please provide an example of a missing class (one that PhpStorm is unable to find) that you know does exist & you can locate it using PhpStorm?

0
Comment actions Permalink

Thanks for the quick help!

The class/object is from within my project. As an example I have copied this repo: https://github.com/processwire/processwire and opened the file https://github.com/processwire/processwire/blob/master/site-default/templates/home.php

Please have a look at screenshot #1

And this one is an example from my project.

0
Comment actions Permalink

I believe this could be helpful here:

https://processwire.com/talk/topic/17566-phpstorm-for-processwire-developers/ (f.e., the advice with adding variable type hints in DocBlock)

Also, if you are using ProcessWire, this one could be a good thread to vote for:

https://youtrack.jetbrains.com/issue/WI-36647

1
Comment actions Permalink

Thanks for the two links 

0

Please sign in to leave a comment.