本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}