Package fr.adrienbrault.idea.symfony2plugin

Examples of fr.adrienbrault.idea.symfony2plugin.Symfony2InterfacesUtil


        if(expectedClass == null) {
            return;
        }

        PhpClass serviceParameterClass = ServiceUtil.getResolvedClassDefinition(method.getProject(), serviceName);
        if(serviceParameterClass != null && !new Symfony2InterfacesUtil().isInstanceOf(serviceParameterClass, expectedClass)) {
            holder.createWeakWarningAnnotation(target, "Expect instance of: " + expectedClass.getPresentableFQN());
        }

    }
View Full Code Here


                    if (parameterList == null || !(parameterList.getContext() instanceof MethodReference)) {
                        return new PsiReference[0];
                    }

                    MethodReference method = (MethodReference) parameterList.getContext();
                    Symfony2InterfacesUtil interfacesUtil = new Symfony2InterfacesUtil();
                    if (!interfacesUtil.isTranslatorCall(method)) {
                        return new PsiReference[0];
                    }

                    int domainParameter = 2;
                    if(method.getName().equals("transChoice")) {
View Full Code Here

        if (parameterList == null || !(parameterList.getContext() instanceof MethodReference)) {
            return;
        }

        MethodReference method = (MethodReference) parameterList.getContext();
        Symfony2InterfacesUtil interfacesUtil = new Symfony2InterfacesUtil();
        if (!interfacesUtil.isTranslatorCall(method)) {
            return;
        }

        int domainParameter = 2;
        if(method.getName().equals("transChoice")) {
View Full Code Here

            return phpNamedElementCollections;
        }

        for(MethodSignatureSetting matchedSignature: signatures) {
            for(PhpTypeSignatureInterface signatureTypeProvider: signatureTypeProviders) {
                if( signatureTypeProvider.getName().equals(matchedSignature.getReferenceProviderName()) && new Symfony2InterfacesUtil().isCallTo((Method) phpNamedElement, matchedSignature.getCallTo(), matchedSignature.getMethodName())) {
                    Collection<? extends PhpNamedElement> namedElements = signatureTypeProvider.getByParameter(project, parameter);
                    if(namedElements != null) {
                        phpNamedElements.addAll(namedElements);
                    }
                }
View Full Code Here

            if(typeClass != null) {
                for(Map.Entry<String, ContainerService> entry: serviceClass.entrySet()) {
                    if(entry.getValue().getClassName() != null) {
                        PhpClass serviceClass = PhpElementsUtil.getClassInterface(project, entry.getValue().getClassName());
                        if(serviceClass != null) {
                            if(new Symfony2InterfacesUtil().isInstanceOf(serviceClass, typeClass)) {
                                matchedContainer.add(entry.getValue());
                            }
                        }
                    }
View Full Code Here

            return;
        }


        MethodReference methodReference = PsiElementUtils.getMethodReferenceWithFirstStringParameter(element);
        if (methodReference == null || !new Symfony2InterfacesUtil().isTemplatingRenderCall(methodReference)) {
            return;
        }

        ParameterBag parameterBag = PsiElementUtils.getCurrentParameterIndex(element.getParent());
        if(parameterBag == null || parameterBag.getIndex() != 0) {
View Full Code Here

                                        if(classReference != null) {
                                            String fqn = classReference.getFQN();
                                            if(fqn != null) {
                                                PhpClass phpClass = PhpElementsUtil.getClass(psiElement.getProject(), fqn);
                                                if(phpClass != null) {
                                                    if(new Symfony2InterfacesUtil().isInstanceOf(phpClass, instance)) {
                                                        return phpClass;
                                                    }
                                                }
                                            }
                                        }
View Full Code Here

        if (parameterList == null || !(parameterList.getContext() instanceof MethodReference)) {
            return;
        }

        MethodReference method = (MethodReference) parameterList.getContext();
        if(!new Symfony2InterfacesUtil().isContainerGetCall(method)) {
            return;
        }

        String serviceId = ((StringLiteralExpression) psiElement).getContents();
View Full Code Here

        Method method = PsiTreeUtil.getParentOfType(psiElement, Method.class);
        if(method == null) {
            return;
        }

        if(new Symfony2InterfacesUtil().isCallTo(method, "\\Symfony\\Component\\Form\\FormTypeInterface", "getParent")) {

            // get form string; on blank string we dont need any further action
            String contents = ((StringLiteralExpression) psiElement).getContents();
            if(StringUtils.isBlank(contents)) {
                return;
View Full Code Here

    }

    private void serviceTagCallback(String className, TagCallbackInterface callback) {
        PhpClass phpClass = PhpElementsUtil.getClass(project, className);
        if(phpClass != null) {
            if( new Symfony2InterfacesUtil().isInstanceOf(phpClass, FormUtil.ABSTRACT_FORM_INTERFACE)) {
                Set<String> aliases = FormUtil.getFormAliases(phpClass);
                if(aliases.size() > 0) {
                    callback.onFormTypeAlias(aliases.iterator().next());
                }
            }

            if(new Symfony2InterfacesUtil().isInstanceOf(phpClass, TWIG_EXTENSION)) {
                callback.onTag("twig.extension");
            }

            if(new Symfony2InterfacesUtil().isInstanceOf(phpClass, FormUtil.FORM_EXTENSION_INTERFACE)) {
                callback.onTag("form.type_extension");
            }

            if(new Symfony2InterfacesUtil().isInstanceOf(phpClass, EVENT_SUBSCRIBER_INTERFACE)) {
                callback.onTag("kernel.event_subscriber");
            }

        }
    }
View Full Code Here

TOP

Related Classes of fr.adrienbrault.idea.symfony2plugin.Symfony2InterfacesUtil

Copyright © 2018 www.massapicom. 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.