You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Tomáš Procházka (Jira)" <ji...@apache.org> on 2020/06/26 16:50:00 UTC
[jira] [Created] (NETBEANS-4506) Nette DI container type inference
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: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists