pbyrne84 / DynamicReturnTypePlugin

135 stars 7 forks source link

Not the desired effect #73

Open wuchuguang opened 6 years ago

wuchuguang commented 6 years ago

phpstorm product root path

dynamicReturnTypeMeta.json

{
  "functionCalls": [
    {
      "method": "make",
      "position": 0,
      "fileReturnTypeReplacementCall":["JavaScriptReplacementCallback.js","replaceWithJavaScriptMask"]
    }
  ]
}

JavaScriptReplacementCallback.js

//noinspection JSUnusedGlobalSymbols
/**
 * @type{com.ptby.dynamicreturntypeplugin.scripting.api.ExecutingScriptApi}
 */
var api;

//noinspection JSUnusedGlobalSymbols
function replaceWithJavaScriptMask(  returnTypeNameSpace, returnTypeClass ) {
    return "Test_" + returnTypeClass + "_Model";
}

//noinspection JSUnusedGlobalSymbols
function replaceWithJavaScriptAliasing( returnTypeNameSpace, returnTypeClass  ){

    if( returnTypeNameSpace === 'Entity' ) {
        if( returnTypeClass === 'User' ) {
            return 'Test_Foo_Model';
        }else if( returnTypeClass === 'Test' ){
            return 'DynamicReturnTypePluginTestEnvironment\\TestClasses\\TestEntity[]';
        }
    }

    if( returnTypeNameSpace === '' ) {
        return returnTypeClass;

    }

    return returnTypeNameSpace + "\\" + returnTypeClass;
}

when i write php code like make($class)->xxx //not display something