diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f314d2..ecb9441b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ - Changed goto and completion contributor to reference provider - Changed icons to use build-in dark mode switching +### Fixed +- Fixed dataset reference error when no dataset provided yet. + ## [1.6.2] ### Fixed - Fixed duplicate type provider key with nette plugin diff --git a/gradle.properties b/gradle.properties index 666f1eed..52900044 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = com.pestphp pluginName = PEST PHP -pluginVersion = 1.7.0-EAP.3 +pluginVersion = 1.7.0-EAP.4 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. diff --git a/src/main/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspection.kt b/src/main/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspection.kt index bbe7bcea..0c71c2df 100644 --- a/src/main/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspection.kt +++ b/src/main/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspection.kt @@ -42,11 +42,13 @@ class InvalidDatasetReferenceInspection : PhpInspection() { file.getPestTests() // Has to be a method reference, as else there is no dataset + .asSequence() .filterIsInstance() .filter { it.name == "with" } - .mapNotNull { it.parameters[0] } + .mapNotNull { it.parameters.getOrNull(0) } .filterIsInstance() .filter { it.contents !in localDatasets && it.contents !in sharedDatasets } + .toList() .forEach { declareProblemType( holder, diff --git a/src/test/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspectionTest.kt b/src/test/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspectionTest.kt index bf649d6e..4268286c 100644 --- a/src/test/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspectionTest.kt +++ b/src/test/kotlin/com/pestphp/pest/features/datasets/InvalidDatasetReferenceInspectionTest.kt @@ -26,4 +26,10 @@ class InvalidDatasetReferenceInspectionTest : PestLightCodeFixture() { myFixture.checkHighlighting() } + + fun testHasWithStatementWithNoArgs() { + myFixture.configureByFile("DatasetNoArgsTest.php") + + myFixture.checkHighlighting() + } } diff --git a/src/test/resources/com/pestphp/pest/features/datasets/DatasetNoArgsTest.php b/src/test/resources/com/pestphp/pest/features/datasets/DatasetNoArgsTest.php new file mode 100644 index 00000000..243094a9 --- /dev/null +++ b/src/test/resources/com/pestphp/pest/features/datasets/DatasetNoArgsTest.php @@ -0,0 +1,12 @@ +with();