Examples of PhpDocComment


Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

                if(typeName.equals("bool") || typeName.equals("boolean")) {
                    values.addAll(Arrays.asList("false", "true"));
                }

                // @Enum({"AUTO", "SEQUENCE"})
                PhpDocComment docComment = field.getDocComment();
                if(docComment != null) {
                    PhpDocTag[] phpDocTags = docComment.getTagElementsByName("@Enum");
                    for(PhpDocTag phpDocTag: phpDocTags) {
                        PhpPsiElement phpDocAttrList = phpDocTag.getFirstPsiChild();
                        if(phpDocAttrList != null) {
                            String enumArrayString = phpDocAttrList.getText();
                            Pattern targetPattern = Pattern.compile("\"(\\w+)\"");
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

            if(type.toString().equals("array")) {
                completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.ARRAY)));
                return;
            }

            PhpDocComment docComment = field.getDocComment();
            if(docComment != null) {
                for(PhpDocTag varDocTag: docComment.getTagElementsByName("@var")) {
                    PhpPsiElement phpPsiElement = varDocTag.getFirstPsiChild();
                    if(phpPsiElement != null) {
                        String typeText = phpPsiElement.getText().toLowerCase();
                        if(!StringUtils.isBlank(typeText)) {
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

            if(psiElement == null || !PluginUtil.isEnabled(psiElement)) {
                return;
            }

            PhpDocComment parentOfType = PsiTreeUtil.getParentOfType(psiElement, PhpDocComment.class);
            if(parentOfType == null) {
                return;
            }

            AnnotationTarget annotationTarget = PhpElementsUtil.findAnnotationTarget(parentOfType);
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

    }

    private LookupElementBuilder attachLookupInformation(Field field, LookupElementBuilder lookupElement) {

        // get some more presentable completion information
        PhpDocComment docBlock = field.getDocComment();
        if(docBlock == null) {
            return lookupElement;
        }

        PhpDocCommentAnnotation phpDocCommentAnnotation = AnnotationUtil.getPhpDocCommentAnnotationContainer(docBlock);
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

        add("@inheritdoc");
        add("@Target");
    }};

    public static boolean isAnnotationClass(PhpClass phpClass) {
        PhpDocComment phpDocComment = phpClass.getDocComment();
        if(phpDocComment != null) {
            PhpDocTag[] annotationDocTags = phpDocComment.getTagElementsByName("@Annotation");
            if(annotationDocTags.length > 0) {
                return true;
            }
        }
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

    public static PhpAnnotation getClassAnnotation(PhpClass phpClass) {
        if(!AnnotationUtil.isAnnotationClass(phpClass)) {
            return null;
        }

        PhpDocComment phpDocComment = phpClass.getDocComment();
        if(phpDocComment == null) {
            return null;
        }

        PhpDocTag[] targetTag = phpDocComment.getTagElementsByName("@Target");
        if(targetTag.length == 0) {
            return new PhpAnnotation(phpClass, AnnotationTarget.UNDEFINED);
        }

        ArrayList<AnnotationTarget> targets = new ArrayList<AnnotationTarget>();
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

        return new PhpDocTagAnnotation(annotationReference, phpDocTag);
    }

    public static boolean isAnnotationPhpDocTag(PhpDocTag phpDocTag) {
        PhpDocComment phpDocComment = PsiTreeUtil.getParentOfType(phpDocTag, PhpDocComment.class);
        if(phpDocComment == null) {
            return false;
        }

        PsiElement nextPsiElement = phpDocComment.getNextPsiSibling();
        if(nextPsiElement == null || !(nextPsiElement instanceof Method || nextPsiElement instanceof PhpClass || nextPsiElement.getNode().getElementType() == PhpElementTypes.CLASS_FIELDS)) {
            return false;
        }

        return true;
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

        PhpClass phpClass = PhpElementsUtil.getClassInterface(phpDocString.getProject(), modelName);
        if(phpClass != null) {
            return phpClass;
        }

        PhpDocComment inClass = PsiTreeUtil.getParentOfType(phpDocString, PhpDocComment.class);
        if(inClass == null) {
            return null;
        }

        // doc before class
        PhpPsiElement phpClassElement = inClass.getNextPsiSibling();
        if(phpClassElement instanceof PhpClass) {
            String className = ((PhpClass) phpClassElement).getNamespaceName() + modelName;
            return PhpElementsUtil.getClassInterface(phpDocString.getProject(), className);
        }
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

            PhpReferenceImpl composite_value = (PhpReferenceImpl) psiElement;
            if (composite_value.resolve() != null) {
                MethodImpl cm = (MethodImpl) composite_value.resolve();

                if (cm != null) {
                    PhpDocComment phpDoc = cm.getDocComment();
                    if (phpDoc != null && phpDoc.getReturnTag() != null) {
                        PhpDocReturnTag returnTag = phpDoc.getReturnTag();
                        if (returnTag != null) {
                            type = returnTag.getType().toStringResolved();
                        }
                    }
                }
            }

        } else if (psiElement.toString().equals("Number")) {
            PhpExpressionImpl composite_value = (PhpExpressionImpl) psiElement;
            type = composite_value.getType().toStringResolved();
        }
        //Class::CONST
        else if (psiElement.toString().equals("Class constant reference")) {
            ClassConstantReferenceImpl value_cri = (ClassConstantReferenceImpl) psiElement;
            type = value_cri.getText();
        }
        //null,bool,etc..
        else if (psiElement.toString().equals("Constant reference")) {
            ConstantReferenceImpl value_cri = (ConstantReferenceImpl) psiElement;

            type = value_cri.getType().toStringResolved();
        }
        // new Class();
        else if (psiElement.toString().equals("New expression")) {
            PsiElement[] value_new_exr = psiElement.getChildren();
            if (value_new_exr.length > 0) {
                PsiElement classref = value_new_exr[0];
                if (classref.toString().equals("Class reference")) {
                    type = classref.getText();
                } else {   //can't detect class
                    type = "";
                    //System.err.println("Bad 'New expression' founded by phpstorm :" + value_new_exr.toString());
                }
            }
        }
        // $var
        else if (psiElement.toString().equals("Variable")) {

            VariableImpl psi = (VariableImpl) psiElement;
            type = psi.getType().toStringResolved();
            if (type.matches("(?sim)^#M#M#C\\\\[a-z_0-9]+?.model.find.+?\\?")) {
                try {
                    VariableImpl vd = (VariableImpl) psi.resolve();
                    if (type.matches(".+\\|[^\\?]+.*")) {
                        String[] types = type.replaceAll("\\|\\?$", "").split("\\|");
                        ArrayList<String> typeList = new ArrayList<String>();
                        for (String typeName : types) {
                            if (typeName.matches("(?sim)\\.model\\.find.*")) {
                                typeList.add(typeName.replaceFirst("(?sim)^.+\\\\", "").replaceAll("(?sim)\\.model.+", ""));
                            } else {
                                typeList.add(typeName);
                            }
                        }
                        if (typeList.size() > 0) {
                            return Arrays.toString(typeList.toArray());
                        }

                        PsiElement findMetodCall = vd.getNextPsiSibling();
                        if (findMetodCall != null) {
                            MethodReferenceImpl modelStaticCall = (MethodReferenceImpl) findMetodCall.getFirstChild();
                            if (modelStaticCall != null) {
                                type = modelStaticCall.getText().replaceAll("(?sim)::.+", "");
                            }
                        }
                    }
                } catch (Exception e) {
                    type = "";
                }
            } else if (type.startsWith("#F") || type.startsWith("#M")) {
                PsiElement vd = (PsiElement) psi.resolve();
                if (vd != null) {
                    PsiElement last = vd.getNextSibling();
                    type = PsiPhpTypeHelper.detectType(last);
                }
            }

        }
        // Function call
        else if (psiElement.toString().equals("Function call")) {

            FunctionReferenceImpl psi = (FunctionReferenceImpl) psiElement;
            FunctionImpl functionEl = (FunctionImpl) psi.resolve();
            if (functionEl != null) {
                PhpDocComment pdc = functionEl.getDocComment();
                if (pdc != null) {
                    PhpDocReturnTag pdrt = pdc.getReturnTag();
                    if (pdrt != null) {
                        type = pdrt.getType().toString();
                        if (type.startsWith("#F")) {
                            type = " ";
                        } else if (type.startsWith("#")) {
View Full Code Here

Examples of com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment

        if(propertyName == null) {
            return;
        }

        if(propertyName.equals("name") && PhpLangUtil.equalsClassNames(annotationPropertyParameter.getPhpClass().getPresentableFQN(), "Doctrine\\ORM\\Mapping\\Column")) {
            PhpDocComment phpDocComment = PsiTreeUtil.getParentOfType(annotationPropertyParameter.getElement(), PhpDocComment.class);
            if(phpDocComment != null) {
                PhpPsiElement classField = phpDocComment.getNextPsiSibling();
                if(classField != null && classField.getNode().getElementType() == PhpElementTypes.CLASS_FIELDS) {
                    Field field = PsiTreeUtil.getChildOfType(classField, Field.class);
                    if(field != null) {
                        String name = field.getName();
                        if(StringUtils.isNotBlank(name)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.