Skip to content

Commit

Permalink
Use search for abstract function implementations when providing used …
Browse files Browse the repository at this point in the history
…keys completion
  • Loading branch information
klesun committed May 23, 2018
1 parent 11125f6 commit c12fad2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,24 @@ private L<String> findClsMagicCtorUsedKeys(NewExpressionImpl newEx, int order)
});
}

private static L<? extends Function> getImplementations(Function meth)
{
L<Function> result = Tls.cast(Method.class, meth)
.fap(m -> MethCallRes.findOverridingMethods(m)).map(a -> a);
result.add(meth);
return result;
}

private L<String> findKeysUsedOnExpr(PhpExpression arrCtor)
{
return opt(arrCtor.getParent())
.fop(toCast(ParameterList.class))
.fap(argList -> {
int order = L(argList.getParameters()).indexOf(arrCtor);
return resolveFunc(argList)
.thn(asd -> System.out.println("resolved func " + asd.getClass() + " " + asd.getName()))
.fap(meth -> list(
resolveArgUsedKeys(meth, order),
getImplementations(meth)
.fap(ipl -> resolveArgUsedKeys(ipl, order)),
opt(meth.getName())
.flt(n -> n.equals("array_merge") || n.equals("array_replace"))
.fap(n -> resolveReplaceKeys(argList, order))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static boolean nameIs(MethodReferenceImpl call, String cls, String mth)
return callCls.equals(cls) && callMet.equals(mth);
}

private static L<Method> findOverridingMethods(Method meth)
public static L<Method> findOverridingMethods(Method meth)
{
return opt(PhpIndex.getInstance(meth.getProject()))
.fop(idx -> opt(meth.getContainingClass())
Expand Down
8 changes: 8 additions & 0 deletions tests/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@ public function testSelfSuggestion()
// not implemented follow
//============================

public function provideAbstractMethodUsedKeys()
{
$result = (new \Gtl\AmadeusSoapActions\AmadeusGetFareRulesAction('GENERIC'))
->execute([
''
]);
}

private static function makeCoolOutfit($materials)
{
return [
Expand Down

0 comments on commit c12fad2

Please sign in to comment.