本文整理汇总了Java中com.jetbrains.php.lang.psi.elements.FunctionReference类的典型用法代码示例。如果您正苦于以下问题:Java FunctionReference类的具体用法?Java FunctionReference怎么用?Java FunctionReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FunctionReference类属于com.jetbrains.php.lang.psi.elements包,在下文中一共展示了FunctionReference类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildVisitor
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpElement(PhpPsiElement element) {
if (!PlatformPatterns.psiElement(PhpElementTypes.FUNCTION_CALL).accepts(element)) {
return;
}
Set<String> constants = getRemovedGlobalFuntions(element);
FunctionReference constantReference = (FunctionReference) element;
if (constants.contains(constantReference.getFQN())) {
problemsHolder.registerProblem(element, "Global function removed with TYPO3 9, consider using an alternative");
}
}
};
}
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:20,代码来源:FunctionCallMatcherInspection.java
示例2: isFunctionParameter
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
private static boolean isFunctionParameter(PsiElement psiElement, int parameterIndex, String... funcName) {
PsiElement variableContext = psiElement.getContext();
if(!(variableContext instanceof ParameterList)) {
return false;
} else {
ParameterList parameterList = (ParameterList) variableContext;
PsiElement context = parameterList.getContext();
if(!(context instanceof FunctionReference)) {
return false;
} else {
FunctionReference methodReference = (FunctionReference) context;
String name = methodReference.getName();
return (name != null && Arrays.asList(funcName).contains(name) && getParameterIndex(parameterList, psiElement) == parameterIndex);
}
}
}
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:18,代码来源:PsiUtil.java
示例3: isFunctionReference
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
public static boolean isFunctionReference(@NotNull PsiElement psiElement, @NotNull String functionName, int parameterIndex) {
PsiElement parameterList = psiElement.getParent();
if(!(parameterList instanceof ParameterList)) {
return false;
}
ParameterBag index = PhpElementsUtil.getCurrentParameterIndex(psiElement);
if(index == null || index.getIndex() != parameterIndex) {
return false;
}
PsiElement functionCall = parameterList.getParent();
if(!(functionCall instanceof FunctionReference)) {
return false;
}
return functionName.equals(((FunctionReference) functionCall).getName());
}
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:20,代码来源:PsiElementUtils.java
示例4: visitFunctionReference
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
private void visitFunctionReference(FunctionReference functionReference) {
if(!"view".equals(functionReference.getName())) {
return;
}
PsiElement[] parameters = functionReference.getParameters();
if(parameters.length < 1 || !(parameters[0] instanceof StringLiteralExpression)) {
return;
}
String contents = ((StringLiteralExpression) parameters[0]).getContents();
if(StringUtils.isBlank(contents)) {
return;
}
views.add(Pair.create(contents, parameters[0]));
}
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:20,代码来源:BladeTemplateUtil.java
示例5: applyFix
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement item = descriptor.getPsiElement();
PsiElement context = item.getContext();
if (context instanceof ArrayCreationExpression) {
ArrayCreationExpression params = (ArrayCreationExpression) item.getParent();
PsiUtil.deleteArrayElement(item);
if (!params.getHashElements().iterator().hasNext()) {
if (params.getPrevSibling() instanceof PsiWhiteSpace) {
params.getPrevSibling().delete();
}
params.getPrevSibling().delete();
params.delete();
}
}
if (context instanceof ParameterList && context.getParent() instanceof FunctionReference) {
FunctionReference functionReference = (FunctionReference) context.getParent();
if (functionReference.getName() != null && functionReference.getName().equals("compact")) {
PsiUtil.deleteFunctionParam(item);
if (functionReference.getParameters().length == 0) {
PsiUtil.deleteFunctionParam(functionReference);
}
}
}
}
开发者ID:nvlad,项目名称:yii2support,代码行数:30,代码来源:UnusedParameterLocalQuickFix.java
示例6: visitElement
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
@Override
public void visitElement(PsiElement element) {
if(element instanceof FunctionReference) {
this.visitFunction((FunctionReference) element);
}
super.visitElement(element);
}
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:9,代码来源:PhpEnvironmentCallsVisitor.java
示例7: visitElement
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
@Override
public void visitElement(PsiElement element) {
if(element instanceof MethodReference) {
visitMethodReference((MethodReference) element);
}
if(element instanceof FunctionReference) {
visitFunctionReference((FunctionReference) element);
}
super.visitElement(element);
}
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:14,代码来源:BladeTemplateUtil.java
示例8: extractKey
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
public static PsiElement extractKey(FunctionReference translationCall) {
PsiElement parameter = translationCall.getParameters()[0];
if (PlatformPatterns.psiElement(PhpElementTypes.CONCATENATION_EXPRESSION).accepts(parameter)) {
BinaryExpression binaryExpression = (BinaryExpression) parameter;
parameter = binaryExpression.getLeftOperand();
}
return parameter;
}
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:10,代码来源:TranslationUtils.java
示例9: parse
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
public void parse(PsiFile psiFile, TranslationCallHandler handler) {
Collection<FunctionReference> calls = PsiTreeUtil.collectElementsOfType(psiFile, FunctionReference.class);
for (FunctionReference call : calls) {
if (TranslationUtils.isTranslationCall(call)) {
PsiElement psiElement = TranslationUtils.extractKey(call);
String key = PsiUtils.getContent(psiElement);
key = StringUtils.strip(key, ".");
if (key != null) {
handler.handleKey(key, psiElement);
}
}
}
}
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:14,代码来源:TranslationCallParser.java
示例10: isTranslationCall
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
public static boolean isTranslationCall(FunctionReference call) {
return call.getParameters().length > 0 && (call.getName().equals("t") || call.getText().startsWith("I18n::labels"));
}
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:4,代码来源:TranslationUtils.java
示例11: isEnvFunction
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
/**
* Checks whether this function reference is reference for env functions, like env or getenv
* @param functionReference Checking reference
* @return true if condition filled
*/
public static boolean isEnvFunction(FunctionReference functionReference) {
String name = functionReference.getName();
return (name != null && Arrays.asList("getenv", "env").contains(name));
}
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:12,代码来源:PsiUtil.java
示例12: visitFunction
import com.jetbrains.php.lang.psi.elements.FunctionReference; //导入依赖的package包/类
private void visitFunction(FunctionReference expression) {
if(!PsiUtil.isEnvFunction(expression)) return;
PsiElement[] parameters = expression.getParameters();
if(parameters.length == 0) return;
if(!(parameters[0] instanceof StringLiteralExpression)) return;
String key = ((StringLiteralExpression)parameters[0]).getContents();
collectedItems.add(new KeyUsagePsiElement(key, parameters[0]));
}
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:15,代码来源:PhpEnvironmentCallsVisitor.java
注:本文中的com.jetbrains.php.lang.psi.elements.FunctionReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论