use of com.jetbrains.php.lang.psi.elements.ConstantReference in project phpinspectionsea by kalessil.
the class McryptRsaOraclePaddingStrategy method apply.
public static boolean apply(@NotNull ProblemsHolder holder, @NotNull FunctionReference reference) {
boolean result = false;
if (isTargetCall(reference)) {
final Set<PsiElement> modeVariants = PossibleValuesDiscoveryUtil.discover(reference.getParameters()[3]);
if (!modeVariants.isEmpty()) {
for (final PsiElement variant : modeVariants) {
if (variant instanceof ConstantReference) {
final String constantName = ((ConstantReference) variant).getName();
if (constantName != null && constantName.equals("MCRYPT_MODE_CBC")) {
holder.registerProblem(reference, message);
result = true;
break;
}
}
}
modeVariants.clear();
}
}
return result;
}
use of com.jetbrains.php.lang.psi.elements.ConstantReference in project idea-php-typo3-plugin by cedricziel.
the class ConstantMatcherInspection method getRemovedConstantsFQNs.
private Set<String> getRemovedConstantsFQNs(ConstantReference element) {
Set<PsiElement> elements = new HashSet<>();
PsiFile[] constantMatcherFiles = FilenameIndex.getFilesByName(element.getProject(), "ConstantMatcher.php", GlobalSearchScope.allScope(element.getProject()));
for (PsiFile file : constantMatcherFiles) {
Collections.addAll(elements, PsiTreeUtil.collectElements(file, el -> PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(PlatformPatterns.psiElement(PhpElementTypes.ARRAY_KEY).withAncestor(4, PlatformPatterns.psiElement(PhpElementTypes.RETURN))).accepts(el)));
}
return elements.stream().map(stringLiteral -> "\\" + ((StringLiteralExpression) stringLiteral).getContents()).collect(Collectors.toSet());
}
Aggregations