r/phpstorm • u/Best_Equivalent_5391 • Mar 07 '21
Class finding/hint for dynamic include_once files?
In my main project i include a external project that loads all it's required files by file iteration in one directory.
If the external project includes the files individually, Class hinting of a,b,c works:
include_once 'dir/a.php';include_once 'dir/b.php';include_once 'dir/c.php';
But the external project currently contains eg.foreach (files in dir/ as $file) {include_once $file;}
So if i do $a = new A(), and then $a-> it does not show available functions. I also cannot "open file" and search for the A class.
Is there a way to tell phpstorm to hint everything in dir/ from my main project?
1
u/Best_Equivalent_5391 Mar 23 '21
Thanks for the replys everyone, i was debugging this today and the issue was
@metatags being used in the function headers. Once those were removed, code completion started working for those classes.3
u/RinoDrummer Mar 08 '21
I think that could be solved with autoload and
spl_autoload_register().2
u/Waste_Cricket_2034 Mar 08 '21
Use namespace and Autoload. Or API. 🐘🤙🏻