diff --git a/src/main/kotlin/dev/nybroe/collector/inspections/ArrayMapToCollectionInspection.kt b/src/main/kotlin/dev/nybroe/collector/inspections/ArrayMapToCollectionInspection.kt index 4a2994f..f9063e9 100644 --- a/src/main/kotlin/dev/nybroe/collector/inspections/ArrayMapToCollectionInspection.kt +++ b/src/main/kotlin/dev/nybroe/collector/inspections/ArrayMapToCollectionInspection.kt @@ -14,6 +14,8 @@ class ArrayMapToCollectionInspection : PhpInspection() { override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { return object : PhpElementVisitor() { override fun visitPhpFunctionCall(reference: FunctionReference) { + if (!isOnTheFly) return + if (!reference.isGlobalFunctionCallWithName("array_map")) { return } diff --git a/src/main/kotlin/dev/nybroe/collector/inspections/ForeachToCollectionInspection.kt b/src/main/kotlin/dev/nybroe/collector/inspections/ForeachToCollectionInspection.kt index 227a80e..0085ccb 100644 --- a/src/main/kotlin/dev/nybroe/collector/inspections/ForeachToCollectionInspection.kt +++ b/src/main/kotlin/dev/nybroe/collector/inspections/ForeachToCollectionInspection.kt @@ -13,6 +13,8 @@ class ForeachToCollectionInspection : PhpInspection() { override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { return object : PhpElementVisitor() { override fun visitPhpForeach(foreach: ForeachStatement) { + if (!isOnTheFly) return + holder.registerProblem( foreach, MyBundle.message("foreachToCollectionDescription"),