Tomáš Procházka created NETBEANS-4506:
-----------------------------------------

             Summary: Nette DI container type inference
                 Key: NETBEANS-4506
                 URL: https://issues.apache.org/jira/browse/NETBEANS-4506
             Project: NetBeans
          Issue Type: New Feature
          Components: php - Nette
    Affects Versions: 12.0
            Reporter: Tomáš Procházka


It would be helpful for usage of Nette DI container 
(https://github.com/nette/di) to suppport type inference for 
{{\Nette\DI\Container::getByType()}} and 
{{\Nette\DI\Container::createInstance()}} methods.
These methods return object with same instance as their first parameter.

Following example demonstrates expected behavior.
For both variables {{$builder}} and {{$builder2}} can NetBeans "know" from 
first parameter that their type is {{MyBuilder}} and offer method {{build()}}. 
Currently methods from {{\Nette\DI\Container}} are offered.

{code:php}
<?php

class MyBuilder {
    public function build() {  }
}
    
$container = new \Nette\DI\Container();
$builder = $container->getByType( MyBuilder::class );
$builder-> // Method build() is offered.

$builder2 = $container->createInstance( MyBuilder::class );
$builder2-> // Method build() is offered.
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to