Closed bburnichon closed 8 years ago
i'll try to look at it and publish new version that should contain fix for #35 as well
Another issue is the way typehints are interpreted in defining closures:
class MyContainer extends Pimple
{
}
class MyServiceProvider
{
public function register(Pimple $container)
{
$container['foo'] = 'foo value';
$container['bar'] = function (MyContainer $container) {
return $container['foo'];
};
$container['baz'] = $container::share(function (MyContainer $container) {
return $container['foo'];
});
}
}
$provider = new MyServiceProvider();
$container = new MyContainer();
$provider->register($container);
Type is not inferred for factories:
Type is inferred to type calling Pimple::share()
instead of defined in closure
pls could you try to install plugin based on master http://silex.sorien.sk/download/master and recheck
i've just found out that i need to setup whole build env :/
@Sorien I retested on the initial issue. There are no changes ($myOtherInt
has no type hint). For the Silex Service Providers, both case are now type hinted as Pimple
even though I explicitly type hinted as MyContainer
@Haehnchen pls is there any way how PhpTypeProvider2.getBySignature can return simple (int) php element
when i call
Collection<? extends PhpNamedElement> collection = phpIndex.getBySignature('#C\int', null, 0);
return collection;
it returns empty collection ... (it's causing bug in first example)
you can add string values. hopefully this should also work with primitives types; just try to use int[]
. doing same with class returns Foo[]
fr.adrienbrault.idea.symfony2plugin.doctrine.ObjectRepositoryResultTypeProvider#getBySignature
String name = method.getName();
if(name.equals("findAll") || name.equals("findBy")) {
method.getType().add(phpClass.getFQN() + "[]");
return phpNamedElementCollections;
}
@bburnichon first issue should be hopefully fixed at master (with tests) if you want to test it just download from http://silex.sorien.sk/download/master (this plugin build is autogenerated by Travis after each commit)
@Sorien I confirm that first issue is resolved.
@bburnichon second issue should be fixed with last commit as well
@Sorien checked second issue is also fixed.
I checked #34 & #35 on my setup. Both issues are solved.
Great work!
ok i'll wait few days in no other bugs are found i'll release new version
Probably linked to #35. But easier to reproduce. I thought it was a phpstorm issue first.
https://youtrack.jetbrains.com/issue/WI-31170