Repository navigation
Closed
Description
Bug report
dylan-work@DYLANS-XPS-17 MINGW64 ~/documents/projects/pocketmine-mp/next-major (next-major|u=)
$ vendor/bin/phpstan
Note: Using configuration file C:\Users\dylan-work\documents\projects\pocketmine-mp\next-major\phpstan.neon.
Warning: Undefined array key "collectedData" in phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Parallel/ParallelAnalyser.php on line 125
Warning: foreach() argument must be of type array|object, null given in phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Parallel/ParallelAnalyser.php on line 125
Warning: Undefined array key "attributes" in phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedParameterNode.php on line 92
Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedParameterNode.php:92
Stack trace:
#0 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedParameterNode.php(92): array_map(Object(Closure), NULL)
#1 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedMethodNode.php(137): PHPStan\Dependency\ExportedNode\ExportedParameterNode::decode(Array)
#2 [internal function]: PHPStan\Dependency\ExportedNode\ExportedMethodNode::PHPStan\Dependency\ExportedNode\{closure}(Array)
#3 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedMethodNode.php(138): array_map(Object(Closure), Array)
#4 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedClassNode.php(147): PHPStan\Dependency\ExportedNode\ExportedMethodNode::decode(Array)
#5 [internal function]: PHPStan\Dependency\ExportedNode\ExportedClassNode::PHPStan\Dependency\ExportedNode\{closure}(Array)
#6 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedClassNode.php(148): array_map(Object(Closure), Array)
#7 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Parallel/ParallelAnalyser.php(145): PHPStan\Dependency\ExportedNode\ExportedClassNode::decode(Array)
#8 [internal function]: PHPStan\Parallel\ParallelAnalyser::PHPStan\Parallel\{closure}(Array)
#9 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Parallel/ParallelAnalyser.php(146): array_map(Object(Closure), Array)
#10 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Parallel/Process.php(137): PHPStan\Parallel\ParallelAnalyser->PHPStan\Parallel\{closure}(Array)
#11 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): PHPStan\Parallel\Process->PHPStan\Parallel\{closure}(Array)
#12 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110): _PHPStan_59fb0a3b2\Evenement\EventEmitter->emit('data', Array)
#13 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_59fb0a3b2\Clue\React\NDJson\Decoder->handleData(Array)
#14 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_59fb0a3b2\Evenement\EventEmitter->emit('data', Array)
#15 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_59fb0a3b2\React\Stream\Util::_PHPStan_59fb0a3b2\React\Stream\{closure}('{"action":"resu...')
#16 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154): _PHPStan_59fb0a3b2\Evenement\EventEmitter->emit('data', Array)
#17 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201): _PHPStan_59fb0a3b2\React\Stream\DuplexResourceStream->handleData(Resource id #4380)
#18 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173): _PHPStan_59fb0a3b2\React\EventLoop\StreamSelectLoop->waitForStreamActivity(53431)
#19 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Parallel/ParallelAnalyser.php(175): _PHPStan_59fb0a3b2\React\EventLoop\StreamSelectLoop->run()
#20 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyserRunner.php(61): PHPStan\Parallel\ParallelAnalyser->analyse(Object(PHPStan\Parallel\Schedule), 'vendor/bin/phps...', Object(Closure), 'C:\\Users\\dylan-...', NULL, NULL, Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput))
#21 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(207): PHPStan\Command\AnalyserRunner->runAnalyser(Array, Array, NULL, Object(Closure), false, true, 'C:\\Users\\dylan-...', NULL, NULL, Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput))
#22 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(100): PHPStan\Command\AnalyseApplication->runAnalyser(Array, Array, false, 'C:\\Users\\dylan-...', Object(PHPStan\Command\Symfony\SymfonyOutput), Object(PHPStan\Command\Symfony\SymfonyOutput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput))
#23 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseCommand.php(168): PHPStan\Command\AnalyseApplication->analyse(Array, false, Object(PHPStan\Command\Symfony\SymfonyOutput), Object(PHPStan\Command\Symfony\SymfonyOutput), false, false, 'C:\\Users\\dylan-...', Array, Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput))
#24 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\AnalyseCommand->execute(Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
#25 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(856): _PHPStan_59fb0a3b2\Symfony\Component\Console\Command\Command->run(Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
#26 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(259): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->doRunCommand(Object(PHPStan\Command\AnalyseCommand), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
#27 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->doRun(Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
#28 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(127): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->run()
#29 phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(128): _PHPStan_59fb0a3b2\{closure}()
#30 C:\Users\dylan-work\Documents\projects\pocketmine-mp\next-major\vendor\phpstan\phpstan\phpstan(8): require('phar://C:/Users...')
#31 C:\Users\dylan-work\Documents\projects\pocketmine-mp\next-major\vendor\bin\phpstan(120): include('C:\\Users\\dylan-...')
#32 {main}
thrown in phar://C:/Users/dylan-work/Documents/projects/pocketmine-mp/next-major/vendor/phpstan/phpstan/phpstan.phar/src/Dependency/ExportedNode/ExportedParameterNode.php on line 92
Unfortunately I have no idea what triggered this, but I've seen it often popping up in PhpStorm while working. This is the first time I've seen it on the command line.
My suspicion is that this has soething to do with the PhpStorm integration. After wiping out PHPStan cache, it started working correctly again.
Metadata
Metadata
Assignees
Labels
No labels
Activity
mergeable commentedon Jul 8, 2022
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
dktapps commentedon Jul 8, 2022
It's also started throwing out these errors for no obvious reason:
If I disable phpstan-strict-rules, the problem goes away. But this problem came out of nowhere and I haven't updated any dependencies that would cause this.
Bizarrely, this only occurs on my local server, and works correctly on GH Actions.
dktapps commentedon Jul 8, 2022
I feel like there is some kind of crosstalk between different versions of PHPStan here ... I do have multiple PhpStorm projects open with different versions of PHPStan and strict-rules (being constantly invoked automatically by PhpStorm), but this shouldn't cause projects to break each other ...
ondrejmirtes commentedon Jul 18, 2022
Yeah, no idea why, it looks like something gets mixed up with older PHPStan versions, but I need a reproduction to be able to do anything about it.
dktapps commentedon Jul 18, 2022
My observation is that having two PhpStorm projects open running different versions of PHPStan is usually enough to trigger it.
Maybe it would be a good idea to use a different cache directory per PHPStan version, or per project...
ondrejmirtes commentedon Jul 18, 2022
/cc @staabm PHPStan version should be part of the result cache file path hash 😊
staabm commentedon Jul 18, 2022
done in phpstan/phpstan-src@cb519c6
dktapps commentedon Jul 18, 2022
I don't feel like the result cache is the problem. The issue generally occurs when PhpStorm is analysing projects with different filesystem locations. Unless the result cache hash is derived using relative source paths, I don't see how there can be a collision.
staabm commentedon Jul 19, 2022
Before the linked PR phpstan is using a single resultCache file for all projects, no matter which phpstan version, which analyzed path etc. (It uses only separate ones, in case you defined a different
tempDirin the phpstan.neon per project)I think this means in you case that the resultCache might contain exported nodes which do not necessarily exist or have a differen format, depending on the phpstan version is running
ondrejmirtes commentedon Jul 19, 2022
This suggests it's actually not about the result cache.
This part suggests it might be actually about the result cache.
The first warning is weird, it looks like child processes are talking to an incompatible PHPStan version. Not sure how it can happen.
github-actions commentedon Oct 23, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.