As discussed at WI-6027 Generic support for factory design pattern in PHP chaining (e.g. Magento, Doctrine, Kohana, ZF2, etc..)
Imagine you have something like these "service" or "helper" provider interfaces/objects
You can make the following cases to work:
By using example metadata below It can reside anywhere, but we recommend using .phpstorm.meta.php file in project root.
2016.2 + -> you can have multiple separate files in FOLDER named `.phpstorm.meta.php`
We use PHP code as a config - so we can use existing API to analyse it. The specific format is chosen also to facilitate existing editor features to help as much as possible - completion works, references are resolved, usage search and refactoring will work too.
More dynamic return type possibilities
Packaging metadata/stub files into plugin
you can now EASILY package these into public plugins by adding XML descriptor and uploading .zip to our plugin site, see example at https://github.com/artspb/phpstorm-library-plugin