Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpstorm meta plugin file #15

Closed
ragboyjr opened this issue Nov 25, 2018 · 3 comments · Fixed by #21
Closed

phpstorm meta plugin file #15

ragboyjr opened this issue Nov 25, 2018 · 3 comments · Fixed by #21

Comments

@ragboyjr
Copy link

By adding the following .phpstorm.meta.php into the root of the repo, you can get better code completion when using magento's DI ObjectManager get method.

<?php

namespace PHPSTORM_META
{
    override(\Magento\Framework\ObjectManagerInterface::get(0), map(['' => '@']));
}

It looks like this file can be easily added into the system via the library root feature shown here: https://github.com/artspb/phpstorm-library-plugin

@davidhiendl
Copy link

This functionality would be useful, but you should add support for ->create(...) as well as ->get(...):

namespace PHPSTORM_META {
    override(\Magento\Framework\ObjectManagerInterface::get(0), map(['' => '@']));
    override(\Magento\Framework\ObjectManagerInterface::create(0), map(['' => '@']));
}

@danmooney2
Copy link
Member

danmooney2 commented Mar 20, 2019

Would this go in your Magento project or would it be inside the plugin itself? Update: works great inside a Magento project root. Would phpstorm-library-plugin help to delegate it to any Magento project from inside plugin repo itself?

@davidhiendl
Copy link

davidhiendl commented Mar 20, 2019

It can be provided via the plugin (which would be the optimal solution) but you can also add it manually to your project by creating a file at:
$PROJECT_ROOT/.phpstorm.meta.php/<filname of your choosing>.php
such as $PROJECT_ROOT/.phpstorm.meta.php/di-autocomplete.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants