olivernybroe / phpinsights-intellij

The IntelliJ integration of phpinsights
MIT License
18 stars 2 forks source link

bug: PHP Insights - Failed parsing result #9

Closed nunomaduro closed 4 years ago

nunomaduro commented 5 years ago
8:47    PHP Insights - Failed parsing result
            java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
            s."},{"title":"Type hint declaration","insightClass":"SlevomatCodingStandard\\Sniffs\\TypeHints\\TypeHintDeclarationSniff","file":"\/private\/var\/folders\/sp\/_8tsx1v57t7cts3pqy50q9cm0000gp\/T\/phpinsights_temp.tmp\/src\/Concerns\/Protocol.php","line":67,"message":"Method \\NunoMaduro\\Plus\\Concerns\\Protocol::stream_cast() does not have return type hint nor @return annotation for its return value."},{"title":"Type hint declaration","insightClass":"SlevomatCodingStandard\\Sniffs\\TypeHints\\TypeHintDeclarationSniff","file":"\/private\/var\/folders\/sp\/_8tsx1v57t7cts3pqy50q9cm0000gp\/T\/phpinsights_temp.tmp\/src\/Concerns\/Protocol.php","line":73,"message":"Method \\NunoMaduro\\Plus\\Concerns\\Protocol::stream_close() does not have void return type hint."},{"title":"Type hint declaration","insightClass":"SlevomatCodingStandard\\Sniffs\\TypeHints\\TypeHintDeclarationSniff","fil... (show balloon)
olivernybroe commented 5 years ago

Hmm, so this is kinda interesting and weird. So looking at the error you are sharing here it looks like the JSON returned from PHP insights is not complete.

Another possible solution could be that the json is on multiple lines or that the json is so large here that it Java's string reader reads a really long line as multiple lines.

I think the best solution in this case is to change so it first tries to parse the json when the command is done, instead of on each line.

olivernybroe commented 5 years ago

Alright, so in the latest edition the parsing has now been changed. Hopefully it should fix the problem you were having.