gpt4 book ai didi

fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper.isValidParameterName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 15:05:31 26 4
gpt4 key购买 nike

本文整理了Java中fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper.isValidParameterName()方法的一些代码示例,展示了YamlHelper.isValidParameterName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlHelper.isValidParameterName()方法的具体详情如下:
包路径:fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper
类名称:YamlHelper
方法名:isValidParameterName

YamlHelper.isValidParameterName介绍

暂无

代码示例

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

@NotNull
private Collection<PsiElement> parameterGoToDeclaration(@NotNull PsiElement psiElement, @NotNull String psiParameterName) {
  Collection<PsiElement> targets = new ArrayList<>();
  targets.addAll(
    DotEnvUtil.getEnvironmentVariableTargetsForParameter(psiElement.getProject(), psiParameterName)
  );
  if(!YamlHelper.isValidParameterName(psiParameterName)) {
    return targets;
  }
  targets.addAll(ServiceUtil.getServiceClassTargets(psiElement.getProject(), psiParameterName));
  return targets;
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

private void invoke(@NotNull final PsiElement psiElement, @NotNull ProblemsHolder holder) {
    // at least %a%
    // and not this one: %kernel.root_dir%/../web/
    // %kernel.root_dir%/../web/%webpath_modelmasks%
    String parameterName = PsiElementUtils.getText(psiElement);
    if(!YamlHelper.isValidParameterName(parameterName)) {
      return;
    }

    // strip "%"
    parameterName = parameterName.substring(1, parameterName.length() - 1);

    // parameter a always lowercase see #179
    parameterName = parameterName.toLowerCase();
    if (!ContainerCollectionResolver.getParameterNames(psiElement.getProject()).contains(parameterName)) {
      holder.registerProblem(psiElement, "Missing Parameter", ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
    }
  }
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

@Test
public void testIsValidParameterName() {
  assertTrue(YamlHelper.isValidParameterName("%a%"));
  assertTrue(YamlHelper.isValidParameterName("%a.a%"));
  assertTrue(YamlHelper.isValidParameterName("%a.-_a%"));
  assertFalse(YamlHelper.isValidParameterName("%%"));
  assertFalse(YamlHelper.isValidParameterName(""));
  assertFalse(YamlHelper.isValidParameterName("%"));
  assertFalse(YamlHelper.isValidParameterName("%kernel.root_dir%/../web/"));
  assertFalse(YamlHelper.isValidParameterName("%kernel.root_dir%/../web/%"));
  assertFalse(YamlHelper.isValidParameterName("%kernel.root_dir%/../web/%webpath_modelmasks%"));
  assertFalse(YamlHelper.isValidParameterName("%env(FO<caret>O)"));
  assertFalse(YamlHelper.isValidParameterName("%ENV(FO<caret>O)"));
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

private void invoke(@NotNull final PsiElement psiElement, @NotNull ProblemsHolder holder) {
    String className = PsiElementUtils.getText(psiElement);

    if (YamlHelper.isValidParameterName(className)) {
      String resolvedParameter = ContainerCollectionResolver.resolveParameter(psiElement.getProject(), className);
      if (resolvedParameter != null && PhpIndex.getInstance(psiElement.getProject()).getAnyByFQN(resolvedParameter).size() > 0) {
        return;
      }
    }

    PhpClass foundClass = PhpElementsUtil.getClassInterface(psiElement.getProject(), className);
    if (foundClass == null) {
      holder.registerProblem(psiElement, MESSAGE_MISSING_CLASS, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
    } else if (!foundClass.getPresentableFQN().equals(className)) {
      holder.registerProblem(psiElement, MESSAGE_WRONG_CASING, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new CorrectClassNameCasingYamlLocalQuickFix(foundClass.getPresentableFQN()));
    }
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com