Skip to content
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

rector does nothing. #8943

Open
N6REJ opened this issue Dec 18, 2024 · 12 comments
Open

rector does nothing. #8943

N6REJ opened this issue Dec 18, 2024 · 12 comments

Comments

@N6REJ
Copy link

N6REJ commented Dec 18, 2024

I'm trying to upgrade from php 5.6.40 to php 8.2.26
I followed these instructions since my code is currently built for php 5.6.40
https://getrector.com/documentation/how-to-run-on-php-53 and what I get is just a blank return.

image

From what I understand its supposed to show a progress bar and take only a few minutes. I've had it running for hours with nothing indicating its doing anything.
I also noticed it left out my bins folder.
And I'm not sure that it will process all the .php files in my classes folder, which it needs to do.
What am I doing wrong?
i'm using php 8.3.11 for my active php
image
and composer is 2.7.9
image

@samsonasik
Copy link
Member

composer require without composer init cause composer.json not created, could you try initialization:

composer init

to ensure composer.json exists in the first place on rector-standalone directory, then re-run composer require rector/rector --dev

composer init
composer require rector/rector --dev

@N6REJ
Copy link
Author

N6REJ commented Dec 19, 2024

I did that and nothing changed.
image

image

@samsonasik
Copy link
Member

I tried and it seems working ok

Screenshot 2024-12-19 at 11 48 03

could you try single file only to target file, eg:

../rector-standalone/vendor/bin/rector process actions/Foo.php  --dry-run

if that works, please narrow down to locate what file that cause it

Read this post: https://tomasvotruba.com/blog/2021/02/01/effective-debug-tricks-narrow-scoping/

@N6REJ
Copy link
Author

N6REJ commented Dec 19, 2024

still didn't work. idk wth I'm doing wrong.
image

@samsonasik
Copy link
Member

It seems you're using windows, could you try to use command prompt (cmd) or bash for Windows ? see readme for it

https://github.com/rectorphp/rector?tab=readme-ov-file#known-drawbacks

If still not works, could you try disable parallel? Add:

->withoutParallel();

in the config

@N6REJ
Copy link
Author

N6REJ commented Dec 19, 2024

I was using the jetbrains IDEA ide terminal. I just tried with command prompt with same result.
image
image

@samsonasik
Copy link
Member

Not sure, could you share simple repository with minimal files to let us try? We don't have windows env locally, but let see if we can reproduce it in other os

@N6REJ
Copy link
Author

N6REJ commented Dec 19, 2024

I appreciate all your help. The only folder we need to be concerned with is /core/classes and its children.
https://github.com/Bearsampp/sandbox/tree/rector/core/classes

@samsonasik
Copy link
Member

I tried that, it seems working ok:

➜  classes git:(main) ✗ ../rector-standalone/vendor/bin/rector process --dry-run |more
 44/44 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
44 files with changes
=====================

1) tpls/app/class.tpl.app.nodejs.php:38

    ---------- begin diff ----------
@@ @@
         return TplApp::getMenuEnable(
             $bearsamppLang->getValue(Lang::NODEJS),
             self::MENU,
-            get_called_class(),
+            static::class,
             $bearsamppBins->getNodejs()->isEnable()
         );
     }
@@ @@
         // Enable
         $tplEnable = TplApp::getActionMulti(
             self::ACTION_ENABLE,
-            array($isEnabled ? Config::DISABLED : Config::ENABLED),
-            array($bearsamppLang->getValue(Lang::MENU_ENABLE), $isEnabled ? TplAestan::GLYPH_CHECK : ''),
+            [$isEnabled ? Config::DISABLED : Config::ENABLED],
+            [$bearsamppLang->getValue(Lang::MENU_ENABLE), $isEnabled ? TplAestan::GLYPH_CHECK : ''],
             false,
-            get_called_class()
+            static::class
         );

is that any different if you run rector on github action or same directory inside classes itself?

@N6REJ
Copy link
Author

N6REJ commented Dec 20, 2024

I don't understand what you mean. How can I do that. I'll happily change ANYTHING. Also how do I make sure it does the file in classes as well as all sub directories

@samsonasik
Copy link
Member

samsonasik commented Dec 20, 2024

You may can setup github action for windows, with set windows-latest on os matrix, create steps in the config so it can run rector on github, for example:

https://github.com/rectorphp/rector-src/blob/main/.github/workflows/tests.yaml#L20

You may can read documentation for github action quick start https://docs.github.com/en/actions/writing-workflows/quickstart

@staabm
Copy link
Contributor

staabm commented Dec 21, 2024

I think your php is halting because you have something like "break on first statement" enabled in phpstorm.

Try disabling xdebug in your php CLI and run again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants