Skip to content

Commit 5e492e7

Browse files
committed
PhpStorm indexer dont like streams; so use plain for statements
1 parent 967789f commit 5e492e7

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/main/java/de/espend/idea/php/phpunit/utils/PhpUnitPluginUtil.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,16 @@
2525
import org.jetbrains.annotations.NotNull;
2626
import org.jetbrains.annotations.Nullable;
2727

28-
import java.util.Arrays;
29-
import java.util.stream.Stream;
30-
3128
/**
3229
* @author Daniel Espendiller <daniel@espendiller.net>
3330
*/
3431
public class PhpUnitPluginUtil {
35-
private static final Stream<String> EXTENDS_TEST_CLASSES = Arrays.stream(new String[]{
32+
private static final String[] EXTENDS_TEST_CLASSES = new String[]{
3633
"\\PHPUnit\\Framework\\TestCase",
3734
"\\PHPUnit_Framework_TestCase",
3835
"\\Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase",
3936
"\\Behat\\Behat\\Context\\BehatContext"
40-
});
37+
};
4138

4239
/**
4340
* Run tests for given element
@@ -71,18 +68,18 @@ public static boolean isTestClassWithoutIndexAccess(@NotNull PhpClass phpClass)
7168

7269
// find "extends" classes
7370
String superFQN = "\\" + StringUtils.stripStart(phpClass.getSuperFQN(), "\\");
74-
boolean isExtendsMatch = EXTENDS_TEST_CLASSES.anyMatch(s -> s.equalsIgnoreCase(superFQN));
75-
if (isExtendsMatch) {
76-
return true;
77-
}
7871

79-
// find via implementations
80-
boolean isInterfaceMatch = Arrays.stream(phpClass.getInterfaceNames())
81-
.map(s -> "\\" + StringUtils.stripStart(s, "\\")) // normalize it
82-
.anyMatch(s -> s.equalsIgnoreCase("\\Behat\\Behat\\Context\\Context"));
72+
for (String extendsTestClass : EXTENDS_TEST_CLASSES) {
73+
if (extendsTestClass.equalsIgnoreCase(superFQN)) {
74+
return true;
75+
}
76+
}
8377

84-
if (isInterfaceMatch) {
85-
return true;
78+
for (String interfaceName : phpClass.getInterfaceNames()) {
79+
String interfaceName2 = "\\" + StringUtils.stripStart(interfaceName, "\\");
80+
if (interfaceName2.equalsIgnoreCase("\\Behat\\Behat\\Context\\Context")) {
81+
return true;
82+
}
8683
}
8784

8885
// find somehow inside a project test folder

0 commit comments

Comments
 (0)