-
-
Notifications
You must be signed in to change notification settings - Fork 708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefixed Rector PHAR not working #2749
Comments
I got a report from PHPStan that its PHAR had an issue with the jetbrains stubs: they were being removed by |
Looks like this issue is from dev-master of PHPStan. Not sure why Rector uses that. I fixed it yesterday evening. |
I probably realize why - building Rector PHAR consists of cloning and using phpstan-src. But it should check out a stable tag, not use master... |
I understand now - the root issue is that I released ondrejmirtes/better-reflection 3.5.6 that breaks this by using newer jetbrains/phpstorm-stubs. These two commits fix that: |
I'll probably start requiring |
Again, this is why I think no one should use phpstan-src directly :) |
And there's another one: phpstan/phpstan-src@23d5ca0 |
huh Hoa is such a pain... (for PHP-Scoper) |
Yes, it is, but I realized, it doesn't have to be prefixed in the PHAR since PHPStan already knows how to do static reflection partially... |
Any idea how to fix this? |
You need to update your scoper.php.inc when prefixing PHPStan the same way I did. |
Allright, I'll give a try to the unboxing :) |
A way around until it's fixed is to downgrade. |
@ondrejmirtes Just trying the update to PHPStan 0.12.8 and running only It's not related to rector, nor rector scoping. Even when I run: vendor/bin/phpstan analyse src/Php I get: Note: Using configuration file /var/www/rector/phpstan.neon.
PHP Fatal error: Uncaught Error: Class '_HumbugBox4c23c5592d6a\JetBrains\PHPStormStub\PhpStormStubsMap' not found in phar:///var/www/rector/vendor/phpstan/phpstan/phpstan/vendor/ondrejmirtes/better-reflection/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php:67
Stack trace:
#0 phar:///var/www/rector/vendor/phpstan/phpstan/phpstan/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/PhpInternalSourceLocator.php(38): _HumbugBox4c23c5592d6a\Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber->generateClassStub('T') Any idea why? |
That's currently fixed in PHPStan's dev-master. I should release a bugfix version. |
Uff :) good to hear that |
PHPStan 0.12.9 just released. |
I bumped PHPStan version to 0.12.9 in #2800,
Paths: phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php:67
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/PhpInternalSourceLocator.php:38
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/PhpInternalSourceLocator.php:31
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AbstractSourceLocator.php:38
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/MemoizingSourceLocator.php:31
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Reflector/ClassReflector.php:37
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/Reflector/MemoizingClassReflector.php:28
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php:92
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/ChainReflectionProvider.php:25
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php:30
phar:///var/www/rector/vendor/phpstan/phpstan/phpstan.phar/src/Broker/Broker.php:53 |
Can you point me to which build step failed like this in #2800? I see that PHPStan itself works: https://github.com/rectorphp/rector/pull/2800/checks?check_run_id=427074168 |
It happens in unit tests. https://github.com/rectorphp/rector/pull/2800/checks?check_run_id=427074203#step:6:60 |
Yes, you're right, I understand why. Try to manually include the file like this (https://github.com/phpstan/phpstan-src/blob/63707915d487f032574bf76d5cb25d42b73909b0/bin/phpstan#L58) in your tests bootstrap before I fix this in PHPStan itself. Thanks. |
Thanks! I tried adding this: require_once 'phar://vendor/phpstan/phpstan/phpstan.phar/vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php'; |
It works sometimes, but run after Docker build fails And external run too: Seems like it can be only solved in PHPStan correctly. This is blocker for Rector releases last 2 weeks. Any ETA for fixed release? |
The normal run should have been fixed in 0.12.9. If it isn’t, show me a build log where it fails. But I don’t know about any issue now. The unit test problem is a new one for me, I’ll look at it next week. You can use 0.12.7 until then. |
This one: https://github.com/rectorphp/rector/runs/430045396?check_suite_focus=true It would be better to autolaod the file in PHPStan's Not sure why it's prefixed when scoper should skip it. |
You'll have to apply the same fix as I do in PHPStan itself. Here's the explanation what happens: phpstan/phpstan#2948 (comment) Here are the fixes for the normal run: https://github.com/phpstan/phpstan-src/blob/d1452fb3a6eead984070df6fa5fdec3a26b5ba4b/bin/phpstan#L58-L60 I think you have to do them in your I have to come up with a fix to fix unit tests run, it will probably mean moving these lines to |
I think the problem is that file itself is not scoped, but the class usage it. But public function (\_HumbugBoxebb6c51d1e3e\JetBrains\PHPStormStub\PhpStormStubsMap $phpStormStubsMap) It needs to be de-scoped in |
That is not what is happening, see my comment above. |
I didn't see it before, just read it.
What exactly you mean? I've added include to |
I've added exactly this line: https://github.com/phpstan/phpstan-src/blob/d1452fb3a6eead984070df6fa5fdec3a26b5ba4b/bin/phpstan#L58 and it didn't work See Line 30 in cc75b8b
What should I do to make it work? |
I'll look into fixing this properly after the weekend. |
Thank you |
Verifying the fixes in: #2816 |
Do you know about any other issues I could test in that PR? |
Basically this must be moved from And this as well: |
I just enabled those workflows, so you can just rebase on |
@ondrejmirtes I rebased and merged it and it looks good. Both failing workflows now pass. Thank you 👍 |
Cool, but beware, 0.12.10 isn’t released yet. |
Sure. No rush, but any ETA on this so I can plan Rector release accordingly? |
Some time during the next week, Wednesday or Thursday :) |
Purfect :) 👍 |
Prefixed Rector is now build correctly as well 👍 |
Just released :) https://github.com/phpstan/phpstan/releases/tag/0.12.10 |
rectorphp/rector-src@93b63b0 [Php54][Php80] Handle no scope on LongArrayToShortArrayRector+AnnotationToAttributeRector (#2749)
rector.yaml
Current behaviour
The text was updated successfully, but these errors were encountered: