$ rector process module/ config/ --dry-run
Fatal error: Uncaught Error: Call to undefined function _HumbugBox075db77467cb\xcallable() in phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/autoload.php:98
Stack trace:
#0 phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/stream/Stream.php(529): xcallable('Hoa\\Stream\\Stre...')
#1 /var/www/vendor/composer/ClassLoader.php(444): include('phar:///var/www...')
#2 /var/www/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('phar:///var/www...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('Hoa\\Stream\\Stre...')
#4 phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/hoa/consistency/Autoloader.php(162): spl_autoload_call('Hoa\\Stream\\Stre...')
#5 phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/hoa/consistency/Autoloader.php(104): Hoa\Consistency\Autoloader->runAutoloaderStack('Hoa\\Stream\\Stre...')
#6 [internal function]: Hoa\Consistency\Autoloader->load('Hoa\\Stream')
#7 phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Gene in phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/autoload.php on line 98
More details:
> rector process module/ config/ --dry-run
Fatal error: Uncaught Error: Call to undefined function _HumbugBox075db77467cb\xcallable() in phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/autoload.php on line 98
Error: Call to undefined function _HumbugBox075db77467cb\xcallable() in phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/autoload.php on line 98
Call Stack:
0.0104 430328 1. {main}() /var/www/vendor/rector/rector-prefixed/rector:0
0.1025 4758000 2. require('phar:///var/www/vendor/rector/rector-prefixed/rector/bin/rector') /var/www/vendor/rector/rector-prefixed/rector:6
3.9259 40805528 3. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->get() phar:///var/www/vendor/rector/rector-prefixed/rector/bin/rector:39
3.9259 40805528 4. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->make() phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/symfony/dependency-injection/Container.php:198
3.9259 40805528 5. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/symfony/dependency-injection/Container.php:213
3.9260 40810912 6. require('/tmp/_rector/ContainerM0uyQjR/getApplicationService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9260 40811232 7. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getApplicationService.php:9
3.9260 40816744 8. require('/tmp/_rector/ContainerM0uyQjR/getCreateRectorCommandService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9307 40997176 9. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getCreateRectorCommandService.php:9
3.9307 40998552 10. require('/tmp/_rector/ContainerM0uyQjR/getTemplateVariablesFactoryService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9307 40998608 11. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getTemplateVariablesFactoryService.php:9
3.9308 41000304 12. require('/tmp/_rector/ContainerM0uyQjR/getBetterStandardPrinterService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9308 41002392 13. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getBetterStandardPrinterService.php:11
3.9308 41004384 14. require('/tmp/_rector/ContainerM0uyQjR/getDocBlockManipulatorService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9309 41004928 15. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getDocBlockManipulatorService.php:9
3.9309 41006928 16. require('/tmp/_rector/ContainerM0uyQjR/getDocBlockClassRenamerService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9309 41007024 17. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getDocBlockClassRenamerService.php:9
3.9310 41010624 18. require('/tmp/_rector/ContainerM0uyQjR/getStaticTypeMapper2Service.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9323 41022912 19. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getStaticTypeMapper2Service.php:9
3.9323 41028296 20. require('/tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9323 41028296 21. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php:9
3.9324 41029928 22. require('/tmp/_rector/ContainerM0uyQjR/getArrayTypeMapper2Service.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9324 41029984 23. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getArrayTypeMapper2Service.php:11
3.9324 41034880 24. require('/tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9324 41034880 25. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php:14
3.9324 41037072 26. require('/tmp/_rector/ContainerM0uyQjR/getIntersectionTypeMapper2Service.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9324 41037152 27. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getIntersectionTypeMapper2Service.php:11
3.9325 41042048 28. require('/tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9325 41042048 29. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php:19
3.9325 41044240 30. require('/tmp/_rector/ContainerM0uyQjR/getUnionTypeMapper2Service.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9325 41044320 31. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getUnionTypeMapper2Service.php:11
3.9326 41049216 32. require('/tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9326 41049648 33. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getPhpDocTypeMapperService.php:25
3.9326 41051016 34. require('/tmp/_rector/ContainerM0uyQjR/getGenericTypeMapperService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9326 41051072 35. ContainerM0uyQjR\HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container->load() /tmp/_rector/ContainerM0uyQjR/getGenericTypeMapperService.php:9
3.9326 41052616 36. require('/tmp/_rector/ContainerM0uyQjR/getTypeNodeResolverService.php') /tmp/_rector/ContainerM0uyQjR/HttpKernelRector_Core_HttpKernel_RectorKernelProd8764425Container.php:534
3.9326 41052672 37. Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory->__construct() /tmp/_rector/ContainerM0uyQjR/getTypeNodeResolverService.php:9
3.9344 41299992 38. PHPStan\DependencyInjection\ContainerFactory->create() phar:///var/www/vendor/rector/rector-prefixed/rector/packages/node-type-resolver/src/DependencyInjection/PHPStanServicesFactory.php:56
3.9353 41408744 39. PHPStan\DependencyInjection\Configurator->createContainer() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php:54
3.9353 41408744 40. PHPStan\DependencyInjection\Configurator->loadContainer() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/bootstrap/src/Bootstrap/Configurator.php:160
3.9366 41556392 41. _HumbugBox075db77467cb\Nette\DI\ContainerLoader->load() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/Configurator.php:31
3.9366 41556440 42. _HumbugBox075db77467cb\Nette\DI\ContainerLoader->loadFile() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php:34
3.9370 41557040 43. _HumbugBox075db77467cb\Nette\DI\ContainerLoader->generate() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php:65
4.0024 42941280 44. _HumbugBox075db77467cb\Nette\DI\Compiler->compile() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php:99
4.0566 44468768 45. _HumbugBox075db77467cb\Nette\DI\Compiler->generateCode() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php:159
4.0566 44468768 46. _HumbugBox075db77467cb\Nette\DI\ContainerBuilder->resolve() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php:213
4.0878 48139312 47. _HumbugBox075db77467cb\Nette\DI\Resolver->resolveDefinition() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerBuilder.php:231
4.0878 48139344 48. _HumbugBox075db77467cb\Nette\DI\Definitions\ServiceDefinition->resolveType() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Resolver.php:55
4.0878 48139344 49. _HumbugBox075db77467cb\Nette\DI\Resolver->resolveEntityType() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Definitions/ServiceDefinition.php:141
4.0878 48139344 50. class_exists() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Resolver.php:109
4.0878 48139384 51. spl_autoload_call() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Resolver.php:109
4.0878 48139424 52. Composer\Autoload\ClassLoader->loadClass() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Resolver.php:109
4.0878 48139424 53. Composer\Autoload\includeFile() /var/www/vendor/composer/ClassLoader.php:322
4.0879 48155296 54. include('phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Read.php') /var/www/vendor/composer/ClassLoader.php:444
4.0879 48155296 55. spl_autoload_call() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Read.php:47
4.0879 48155336 56. Composer\Autoload\ClassLoader->loadClass() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Read.php:47
4.0879 48155336 57. Composer\Autoload\includeFile() /var/www/vendor/composer/ClassLoader.php:322
4.0881 48177624 58. include('phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/File.php') /var/www/vendor/composer/ClassLoader.php:444
4.0881 48177624 59. spl_autoload_call() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/File.php:48
4.0881 48177672 60. Composer\Autoload\ClassLoader->loadClass() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/File.php:48
4.0881 48177672 61. Composer\Autoload\includeFile() /var/www/vendor/composer/ClassLoader.php:322
4.0883 48223784 62. include('phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Generic.php') /var/www/vendor/composer/ClassLoader.php:444
4.0883 48223784 63. spl_autoload_call() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Generic.php:47
4.0884 48223824 64. Hoa\Consistency\Autoloader->load() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/file/Generic.php:47
4.0884 48224080 65. Hoa\Consistency\Autoloader->runAutoloaderStack() phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/hoa/consistency/Autoloader.php:104
4.0884 48224080 66. spl_autoload_call() phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/hoa/consistency/Autoloader.php:162
4.0884 48224128 67. Composer\Autoload\ClassLoader->loadClass() phar:///var/www/vendor/rector/rector-prefixed/rector/vendor/hoa/consistency/Autoloader.php:162
4.0884 48224128 68. Composer\Autoload\includeFile() /var/www/vendor/composer/ClassLoader.php:322
4.0887 48272168 69. include('phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/stream/Stream.php') /var/www/vendor/composer/ClassLoader.php:444
4.0891 48309728 70. xcallable() phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/hoa/stream/Stream.php:529
@ondrejmirtes Hi Ondra, looks like autoload bug is still on.
Any idea what can be wrong?
Are you on PHPStan 0.12.10?
Yes
Rector 0.7 requires it https://github.com/rectorphp/rector/blob/master/composer.json#L24
My theory is that Rector prefixes Hoa but PHPStan doesn’t (and shouldn’t).
The problem is that Hoa uses some class_alias magic that doesn’t play well with php-scoper. Because PHPStan partially already supports static reflection for Hoa and PhpParser, this isn’t a problem even with different versions than in PHPStan itself.
@snapshotpl What version do you use - normal or prefixed? Could you send PR with Github Action failing build so we can cover this bug?
@ondrejmirtes I copied scoper.php.inc code from PHPStan to Rector
https://github.com/phpstan/phpstan-src/commit/23d5ca04ab6213f53a0e6c2e77857b23a73aa41d
→ https://github.com/rectorphp/rector/commit/f24215e62eca508709e40c9c8799841d1cbb61b4
@snapshotpl Also try deleting vendor and composer.lock. composer is buggy sometimes
@TomasVotruba prefixed. Remove lock or vendor doesn't help.
How this PR should looks like?
So this is really weird. Looks like @snapshotpl has both phpstan/phpstan and rector/rector-prefixed installed at the same time, because the stack trace shows:
Fatal error: Uncaught Error: Call to undefined function _HumbugBox075db77467cb\xcallable() in phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/autoload.php on line 98
With rector-prefixed, there's no vendor/phpstan/phpstan/phpstan.phar file.
Also, in PHPStan 0.12.10, vendor/autoload.php inside the PHAR has only 53 lines, there's no line 98.
What I think is going on is that @snapshotpl has rector-prefixed 0.7, but some older version of PHPStan installed, leading to this bug.
Hi, I have the same problem. I have phpstan 0.12.10 installed and I am trying to run rector-prefixed 0.7 with the same error.
@dada-amater Please post your stack trace. You cannot have error in phpstan.phar/vendor/autoload.php on line 98.
@ondrejmirtes Yes I have phpstan 0.12.10 and rector-prefixed installed same time. I try to remove all deps in composer (dev and no-dev), clean rector and phpstan config, clear composer cache. Still get error. So I think it's ease to reproduce:
{
"require-dev": {
"phpstan/phpstan": "^0.12.10",
"rector/rector-prefixed": "^0.7"
}
}
And vendor/bin/rector process src/ --dry-run
You cannot have error in phpstan.phar/vendor/autoload.php on line 98.
@ondrejmirtes There is one shared for Rector and PHPStan vendor/autoload.php, as phpstan/phpstan-src is used, so the autoload.php file is bigger.
I'll look at box unpack command if that helps in any way to resolve these issues.
Looks like the file hoa/consistency/Prelude.php is prefixed in both rector.phar and my own phpstan.phar, but probably shouldn't be.
Also I was looking at wrong version probably so phpstan.phar currently has line 98 in autoload.php :)
Yeah, so I think this will fix that: https://github.com/phpstan/phpstan-src/commit/0464d0fc23f8bd87a119f92df539ea40035f548c - @TomasVotruba you should probably apply this fix to your source code as well.
@snapshotpl Can you please verify that phpstan/phpstan dev-master works for you? If yes, I'll release PHPStan 0.12.11 shortly.
@TomasVotruba Using extracted phpstan.phar instead of phpstan-src will help you that you will not have to sync scoper.inc.php changes, but there might be other challenges...
@ondrejmirtes Yea, I was just thinking on duplicated composer autoloader :/
I wonder whould could I make scoper.php.inc sync automated... Probalby some Rector rule mergning 2 arrays files could be a way to go
I applied the Prelude.php whitelisting. Now I wait for rector.phar to rebuild
@snapshotpl Could you try https://github.com/rectorphp/rector-prefixed that was build 4 mins ago?
@TomasVotruba working!
Thank you all for help!
Thanks for your amazing work! Anyway I hope to will be able to fully migrate to php 7.4 this weekend by rector
If anything crashes, let me know :+1:
Most helpful comment
@TomasVotruba working!