DamImpr commented on code in PR #9431:
URL: https://github.com/apache/netbeans/pull/9431#discussion_r3379336342


##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java:
##########
@@ -2331,7 +2332,9 @@ private void autoCompleteExpression(final 
PHPCompletionResult completionResult,
         Model model = request.result.getModel();
         Set<AliasedName> aliasedNames = ModelUtils.getAliasedNames(model, 
request.anchor);
 
-        for (final PhpElement element : 
request.index.getTopLevelElements(prefix, aliasedNames, Trait.ALIAS)) {
+        List<PhpElement> topLevelElements = new 
ArrayList<>(request.index.getTopLevelElements(prefix, aliasedNames, 
Trait.ALIAS));
+        topLevelElements.sort(Comparator.comparing(PhpElement::getName, 
String.CASE_INSENSITIVE_ORDER));
+        for (final PhpElement element : topLevelElements) {

Review Comment:
   Hi @matthiasblaesing 
   You’re right, it isn’t mentioned in the PR description. 
   It’s a change I made after development because two tests were failing when I 
ran tests on the `php.editor.completion` package, specifically 
`testFunctionGuessingArrayReturnType_01` and 
`testFunctionGuessingArrayReturnType_02`.
   
   In short, the return types did not have a deterministic order. For example, 
the method might return an `array|string`, which is valid in the language but 
differs from what the test method expected, namely `string|array`.
   This change ensures a deterministic order, and the test suite no longer 
fails.
   
   I’m not sure whether, given the project’s policies, this can be merged 
alongside the fix I’ve made. Please let me know if this is fine or if a 
separate PR is needed.
   Thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to