String propertyName = field.getName();
// private $isNillable = false;
PhpType type = field.getType();
if(type.toString().equals("bool")) {
completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.BOOLEAN)));
return;
}
// private $isNillable = array();
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)) {
// @var array<string>
if(typeText.startsWith("array")) {
completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.ARRAY)));
return;
}
if(typeText.equals("integer") || typeText.equals("int")) {
completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.INTEGER)));
return;
}
if(typeText.equals("boolean") || typeText.equals("bool")) {
completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.BOOLEAN)));
return;
}
}
}
}
}
// public $var = array();
if(field.getDefaultValue() instanceof ArrayCreationExpression) {
completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.ARRAY)));
return;
}
// fallback
completionResultSet.addElement(new PhpAnnotationPropertyLookupElement(new AnnotationProperty(propertyName, AnnotationPropertyEnum.STRING)));
}