File tree Expand file tree Collapse file tree
src/main/kotlin/com/github/xepozz/testo/tests/run Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import com.intellij.psi.PsiFile
3030import com.intellij.psi.impl.source.tree.LeafPsiElement
3131import com.intellij.psi.util.parentOfType
3232import com.intellij.util.Consumer
33+ import com.intellij.util.asSafely
3334import com.jetbrains.php.PhpBundle
3435import com.jetbrains.php.PhpIndex
3536import com.jetbrains.php.PhpIndexImpl
@@ -554,12 +555,11 @@ class TestoRunConfigurationProducer : PhpTestConfigurationProducer<TestoRunConfi
554555 }
555556
556557 private fun extractSuiteName (newExpression : NewExpression ): String? {
557- val firstParam = newExpression.parameters.firstOrNull() ? : return null
558- if (firstParam is StringLiteralExpression ) {
559- return firstParam.contents
560- }
561- val literal = com.intellij.psi.util.PsiTreeUtil .findChildOfType(firstParam, StringLiteralExpression ::class .java)
562- return literal?.contents
558+ return newExpression
559+ .parameters
560+ .firstOrNull()
561+ ?.asSafely<StringLiteralExpression >()
562+ ?.contents
563563 }
564564
565565 private fun getContainingClass (location : Location <* >, method : Method ) = when (location) {
You can’t perform that action at this time.
0 commit comments