Haehnchen / idea-php-toolbox

Collections of tools and improvements to make PhpStorm a little bit better
http://phpstorm.espend.de/php-toolbox
MIT License
158 stars 20 forks source link

Add argument provider #41

Open nazar-pc opened 8 years ago

nazar-pc commented 8 years ago

My use case:

\cs\Event::instance()->on('<caret>');
\cs\Event::instance()->once('<caret>');
\cs\Event::instance()->off('<caret>');

are all dependent on $event argument used in following call:

\cs\Event::instance()->fire($event, ...);

So basically I need to find all ->fire() calls with events names and be able to use them for autocompletion in ->on(), ->once() and ->off() calls.

I imagine this something like:

{
    "name"   : "events",
    "source" : {
        "contributor" : "argument",
        "parameter"   : "cs\\Event::fire",
        "index"       : 0
    }
}

which means that argument with index 0 of method cs\\Event::fire.

King2500 commented 7 years ago

Other use cases in Symfony context: Meta config:

{
    "registrar": [
        {
            "provider": "symfony.parameterbag_keys",
            "language": "php",
            "signature": [
                "Symfony\\Component\\HttpFoundation\\ParameterBag::get",
                "Symfony\\Component\\HttpFoundation\\ParameterBag::set",
                "Symfony\\Component\\HttpFoundation\\ParameterBag::has",
                "Symfony\\Component\\HttpFoundation\\Request::get"
            ]
        }
    ],
    "providers": [
        {
            "name": "symfony.parameterbag_keys",
            "source": {
                "contributor": "argument",
                "parameters": [
                    "Symfony\\Component\\HttpFoundation\\ParameterBag::get",
                    "Symfony\\Component\\HttpFoundation\\ParameterBag::set",
                    "Symfony\\Component\\HttpFoundation\\ParameterBag::has",
                    "Symfony\\Component\\HttpFoundation\\Request::get"
                ]
            }
        }
    ]
}

Some PHP code:

$bla = $request->query->get('bla');

In other places, you get autocompletion and maybe goto:

if($request->query->has('<CARET>'))

Similar applies to Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface