-
-
Notifications
You must be signed in to change notification settings - Fork 947
Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, null given #5525
Copy link
Copy link
Closed
Description
Bug report
PHPstan crashes before analysis starts. No point in making a reproduction link for this.
I'm running PHP 8.0.9 and PHPstan 0.12.96
Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, null given
Click to show stacktrace!
Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, null given in phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/
OptimizedDirectorySourceLocator.php:168
#0 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php(168): preg_replace()
#1 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php(133): PHPStan\Reflection\BetterReflection\SourceLocator\Optimize
dDirectorySourceLocator->findSymbols()
#2 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php(118): PHPStan\Reflection\BetterReflection\SourceLocator\Optimize
dDirectorySourceLocator->init()
#3 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php(68): PHPStan\Reflection\BetterReflection\SourceLocator\Optimized
DirectorySourceLocator->findFilesByFunction()
#4 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php(31): PHPStan\Reflection\BetterReflection\SourceLocator\Opt
imizedDirectorySourceLocator->locateIdentifier()
#5 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/MemoizingSourceLocator.php(31): PHPStan\BetterReflection\SourceLocator\Type\Aggregate
SourceLocator->locateIdentifier()
#6 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Reflector/FunctionReflector.php(34): PHPStan\BetterReflection\SourceLocator\Type\MemoizingSourceLocator-
>locateIdentifier()
#7 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/Reflector/MemoizingFunctionReflector.php(29): PHPStan\BetterReflection\Reflector\FunctionReflector->reflect()
#8 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php(92): PHPStan\Reflection\BetterReflection\Reflector\MemoizingFunctionReflector->re
flect()
#9 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/Runtime/RuntimeReflectionProvider.php(166): PHPStan\Reflection\SignatureMap\NativeFunctionReflectionProvider->findFunctionReflectio
n()
#10 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php(123): PHPStan\Reflection\Runtime\RuntimeReflectionProvider->getFunction()
#11 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/ChainReflectionProvider.php(88): PHPStan\Reflection\ReflectionProvider\ClassBlacklistReflectionProvider->getFun
ction()
#12 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php(63): PHPStan\Reflection\ReflectionProvider\ChainReflectionProvider->getFunction
()
#13 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1552): PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider->getFunction()
#14 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(441): PHPStan\Analyser\MutatingScope->resolveType()
#15 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(697): PHPStan\Analyser\MutatingScope->getType()
#16 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(441): PHPStan\Analyser\MutatingScope->resolveType()
#17 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1344): PHPStan\Analyser\MutatingScope->getType()
#18 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(459): PHPStan\Analyser\NodeScopeResolver->findEarlyTerminatingExpr()
#19 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(258): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#20 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(423): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#21 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(258): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#22 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(507): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#23 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(258): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#24 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(473): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#25 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(226): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#26 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(149): PHPStan\Analyser\NodeScopeResolver->processNodes()
#27 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/Analyser.php(52): PHPStan\Analyser\FileAnalyser->analyseFile()
#28 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyserRunner.php(56): PHPStan\Analyser\Analyser->analyse()
#29 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(148): PHPStan\Command\AnalyserRunner->runAnalyser()
#30 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(79): PHPStan\Command\AnalyseApplication->runAnalyser()
#31 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseCommand.php(157): PHPStan\Command\AnalyseApplication->analyse()
#32 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(228): PHPStan\Command\AnalyseCommand->execute()
#33 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(856): _PHPStan_68495e8a9\Symfony\Component\Console\Command\Command->run()
#34 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(237): _PHPStan_68495e8a9\Symfony\Component\Console\Application->doRunCommand()
#35 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(138): _PHPStan_68495e8a9\Symfony\Component\Console\Application->doRun()
#36 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(82): _PHPStan_68495e8a9\Symfony\Component\Console\Application->run()
#37 phar:///home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(83): _PHPStan_68495e8a9\{closure}()
#38 /home/bram/src/Faker/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan(8): require('...')
#39 {main}
Code snippet that reproduces the problem
Not applicable since PHPstan crashes before analysing files.
Expected output
Static code analysis of the code base.
Did PHPStan help you today? Did it make you happy in any way?
Not today but it has helped me catch a lot of type errors in one of my projects!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels