Examples of PhpPsiElement


Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

                // @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+)\"");

                            Matcher matcher = targetPattern.matcher(enumArrayString);
                            while (matcher.find()) {
                                values.add(matcher.group(1));
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

     * @param propertyName property name template=""
     * @return Property value
     */
    @Nullable
    public StringLiteralExpression getPropertyValuePsi(String propertyName) {
        PhpPsiElement docAttrList = phpDocTag.getFirstPsiChild();
        if(docAttrList != null) {
            return PhpElementsUtil.getChildrenOnPatternMatch(docAttrList, AnnotationPattern.getPropertyIdentifierValue(propertyName));
        }

        return null;
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

     *
     * @return Content of property value literal
     */
    @Nullable
    public String getDefaultPropertyValue() {
        PhpPsiElement phpDocAttrList = phpDocTag.getFirstPsiChild();

        if(phpDocAttrList != null) {
            if(phpDocAttrList.getNode().getElementType() == PhpDocElementTypes.phpDocAttributeList) {
                PhpPsiElement phpPsiElement = phpDocAttrList.getFirstPsiChild();
                if(phpPsiElement instanceof StringLiteralExpression) {
                    return ((StringLiteralExpression) phpPsiElement).getContents();
                }
            }
        }
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

            CommandProcessor.getInstance().executeCommand(project, new Runnable() {
                public void run() {
                    ApplicationManager.getApplication().runWriteAction(new Runnable() {
                        public void run() {

                            PhpPsiElement scopeForUseOperator = PhpCodeInsightUtil.findScopeForUseOperator(phpDocTag);
                            if(scopeForUseOperator != null) {
                                PhpCodeEditUtil.insertUseStatement(className, scopeForUseOperator);
                            }

                        }
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

                            String keyText = "";
                            String valueType;
                            for (PsiElement keyValueEl : keyValueList) {

                                valueType = "";
                                PhpPsiElement kv = (PhpPsiElement) keyValueEl;

                                if (kv.toString().equals("Array key")) {
                                    keyText = keyValueEl.getText().replace("'", "");
                                }

                                if (kv.toString().equals("Array value")) {
                                    for (PsiElement psiElement : kv.getChildren()) {
                                        valueType = PsiPhpTypeHelper.detectType(psiElement);
                                    }
                                    //Standartize some types
                                    if (keyText != null && !valueType.equals("")) {
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

        }

        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)) {
                            completionParameter.getResult().addElement(LookupElementBuilder.create(underscore(name)));
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

                        "\\Doctrine\\ORM\\Mapping\\OneToMany"
                    );

                    if(phpDocTagAnnotation != null) {

                        PhpPsiElement phpDocAttrList = phpDocTagAnnotation.getPhpDocTag().getFirstPsiChild();

                        // @TODO: remove nested on Annotation plugin update
                        if(phpDocAttrList != null) {
                            if(phpDocAttrList.getNode().getElementType() == PhpDocElementTypes.phpDocAttributeList) {
                                PhpPsiElement phpPsiElement = phpDocAttrList.getFirstPsiChild();
                                if(phpPsiElement instanceof StringLiteralExpression) {
                                    PhpClass phpClass = de.espend.idea.php.annotation.util.PhpElementsUtil.getClassInsideAnnotation(((StringLiteralExpression) phpPsiElement));
                                    if(phpClass != null) {
                                        List<DoctrineModelField> lists = EntityHelper.getModelFields(phpClass);
                                        if(lists.size() > 0) {
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

           !PhpElementsUtil.isEqualClassName(parameter.getAnnotationClass(), TwigHelper.TEMPLATE_ANNOTATION_CLASS))
        {
            return;
        }

        PhpPsiElement phpDocAttrList = parameter.getPhpDocTag().getFirstPsiChild();
        if(phpDocAttrList == null) {
            return;
        }

        String tagValue = phpDocAttrList.getText();
        String templateName;

        // @Template("FooBundle:Folder:foo.html.twig")
        // @Template("FooBundle:Folder:foo.html.twig", "asdas")
        // @Template(tag="name")
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

        if (b == null) b = new StringBuilder();
        b.append('(');
        for (int i = 0; i < parameters.length; i++) {

            if(i == 0) {
                PhpPsiElement classReference =  parameters[i].getFirstPsiChild();
                if(classReference instanceof ClassReference) {
                    String className = ((ClassReference) classReference).getFQN();
                    if(new Symfony2InterfacesUtil().isInstanceOf(parameters[i].getProject(), className, "Twig_Environment")) {
                        continue;
                    }
View Full Code Here

Examples of com.jetbrains.php.lang.psi.elements.PhpPsiElement

public class AnnotationUseImporter {

    public static void insertUse(InsertionContext context, String fqnAnnotation) {
        PsiElement element = PsiUtilCore.getElementAtOffset(context.getFile(), context.getStartOffset());
        PhpPsiElement scopeForUseOperator = PhpCodeInsightUtil.findScopeForUseOperator(element);

        if(null == scopeForUseOperator) {
            return;
        }
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.