当前位置: 首页>>代码示例>>Java>>正文


Java PhpType.getTypes方法代码示例

本文整理汇总了Java中com.jetbrains.php.lang.psi.resolve.types.PhpType.getTypes方法的典型用法代码示例。如果您正苦于以下问题:Java PhpType.getTypes方法的具体用法?Java PhpType.getTypes怎么用?Java PhpType.getTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jetbrains.php.lang.psi.resolve.types.PhpType的用法示例。


在下文中一共展示了PhpType.getTypes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasOnlyTypes

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
private static boolean hasOnlyTypes(
    @NotNull final PsiElement fileSample,
    @NotNull final String functionName,
    @NotNull final PhpType... expectedTypesList
) {
    final Collection<String> returnTypes = new ArrayList<>(valueOf(PhpFunctionUtil.getReturnType(getFunction(fileSample, functionName))).getTypes());

    for (final PhpType expectedTypes : expectedTypesList) {
        for (final String expectedType : expectedTypes.getTypes()) {
            if (!returnTypes.contains(expectedType)) {
                return false;
            }

            returnTypes.remove(expectedType);
        }
    }

    return returnTypes.isEmpty();
}
 
开发者ID:rentalhost,项目名称:laravel-insight,代码行数:20,代码来源:PhpFunctionUtilTest.java

示例2: getType

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
@Nullable
@Override
public PhpType getType(PsiElement psiElement) {
    if (!(psiElement instanceof FieldReference)) {
        return null;
    }
    FieldReference fieldReference = (FieldReference)psiElement;
    PhpExpression classReference = fieldReference.getClassReference();
    if (classReference == null) {
        return null;
    }
    PhpType referenceType = classReference.getType();
    String fieldReferenceName = fieldReference.getName();
    if (!StringUtil.startsWithUppercaseCharacter(fieldReferenceName)) {
        return null;
    }
    for (String type : referenceType.getTypes()) {
        if (type.contains("Controller")) {
            return new PhpType().add("\\" + fieldReferenceName)
                    .add("\\" + fieldReferenceName + "Component");
        }
    }
    return null;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:25,代码来源:ControllerFieldTypeProvider.java

示例3: getType

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
@Nullable
@Override
public PhpType getType(PsiElement psiElement) {
    if (!(psiElement instanceof FieldReference)) {
        return null;
    }
    FieldReference fieldReference = (FieldReference)psiElement;
    PhpExpression classReference = fieldReference.getClassReference();
    if (classReference == null) {
        return null;
    }
    PhpType types = classReference.getType();
    String fieldReferenceName = fieldReference.getName();
    if (!StringUtil.startsWithUppercaseCharacter(fieldReferenceName)) {
        return null;
    }
    for (String type : types.getTypes()) {
        if (type.contains("#Vthis")) {
            return new PhpType().add("\\" + fieldReferenceName + "Helper");
        }
    }
    return null;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:24,代码来源:ViewHelperTypeProvider.java

示例4: isPhpTypeEqual

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
private static boolean isPhpTypeEqual(@NotNull PhpType phpType, @NotNull PhpClass phpClass) {

        Symfony2InterfacesUtil util = null;

        for (String s : phpType.getTypes()) {
            if(util == null) {
                util = new Symfony2InterfacesUtil();
            }

            if(util.isInstanceOf(phpClass, s)) {
                return true;
            }
        }

        return false;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:17,代码来源:PhpTypeProviderUtil.java

示例5: resolveTwigMethodName

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
private static Collection<TwigTypeContainer> resolveTwigMethodName(Collection<TwigTypeContainer> previousElement, String typeName, Collection<List<TwigTypeContainer>> twigTypeContainer) {

        ArrayList<TwigTypeContainer> phpNamedElements = new ArrayList<>();

        for(TwigTypeContainer phpNamedElement: previousElement) {

            if(phpNamedElement.getPhpNamedElement() != null) {
                for(PhpNamedElement target : getTwigPhpNameTargets(phpNamedElement.getPhpNamedElement(), typeName)) {
                    PhpType phpType = target.getType();
                    for(String typeString: phpType.getTypes()) {
                        PhpNamedElement phpNamedElement1 = PhpElementsUtil.getClassInterface(phpNamedElement.getPhpNamedElement().getProject(), typeString);
                        if(phpNamedElement1 != null) {
                            phpNamedElements.add(new TwigTypeContainer(phpNamedElement1));
                        }
                    }
                }
            }

            for(TwigTypeResolver twigTypeResolver: TWIG_TYPE_RESOLVERS) {
                twigTypeResolver.resolve(phpNamedElements, previousElement, typeName, twigTypeContainer, null);
            }

        }

        return phpNamedElements;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:27,代码来源:TwigTypeResolveUtil.java

示例6: getGotoDeclarationTargets

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    if (!PlatformPatterns.psiElement().withParent(FieldReference.class).accepts(psiElement)) {
        return PsiElement.EMPTY_ARRAY;
    }
    PsiElement parent = psiElement.getParent();
    if (parent == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    FieldReference fieldReference = (FieldReference)parent;
    String fieldName = fieldReference.getName();
    if (fieldName == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    PhpExpression classReference = fieldReference.getClassReference();
    if (classReference == null) {
        return null;
    }
    PhpType types = classReference.getType();
    String fieldReferenceName = fieldReference.getName();
    if (!StringUtil.startsWithUppercaseCharacter(fieldReferenceName)) {
        return null;
    }
    for (String type : types.getTypes()) {
        if (type.contains("#Vthis")) {
            Collection<PhpClass> classes = PsiUtil.getViewHelperClasses(fieldName, psiElement.getProject());
            return classes.toArray(new PsiElement[classes.size()]);
        }
    }
    return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:36,代码来源:ViewHelperGotoDeclarationHandler.java

示例7: isString

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
private boolean isString(@NotNull PhpType type) {
    for (String s : type.getTypes()) {
        if(StringUtils.stripStart(s, "\\").equalsIgnoreCase("string")) {
            return true;
        }
    }

    return false;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:10,代码来源:TwigExtensionInsertHandler.java

示例8: isPhpTypeEqual

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
private static boolean isPhpTypeEqual(@NotNull PhpType phpType, @NotNull PhpClass phpClass) {

        for (String s : phpType.getTypes()) {
            if(PhpElementsUtil.isInstanceOf(phpClass, s)) {
                return true;
            }
        }

        return false;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:11,代码来源:PhpTypeProviderUtil.java

示例9: getByType

import com.jetbrains.php.lang.psi.resolve.types.PhpType; //导入方法依赖的package包/类
private static Collection<PhpClass> getByType(PhpType type, PhpIndex phpIndex, Set<String> visited, @Nullable Set<String> phpIndexVisited, int phpIndexDepth)
{
	Set<String> types = type.getTypes();
	return getByType(types.toArray(new String[types.size()]), phpIndex, visited, phpIndexVisited, phpIndexDepth);
}
 
开发者ID:nextras,项目名称:orm-intellij,代码行数:6,代码来源:PhpIndexUtils.java


注:本文中的com.jetbrains.php.lang.psi.resolve.types.PhpType.getTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。