Giter VIP home page Giter VIP logo

Comments (3)

samsonasik avatar samsonasik commented on June 20, 2024 1

I think you can have 2 kind of configs for that, eg:

  • rector.php without import
  • rector-with-import.php with import

then, in your rector-with-import.php, you can do:

return static function (RectorConfig $rectorConfig): void {
     $rectorConfig->import(__DIR__ . '/rector.php');
     $rectorConfig->importNames();
};

so you can run rector-with-import.php on separate command when you want to change it:

vendor/bin/rector process --config rector-with-import.php

or vice versa so you can review as another individual change.

from rector.

ozahorulia avatar ozahorulia commented on June 20, 2024

@samsonasik Sorry, but I don't understand how exactly it helps in my case.

If I want to go throughout the code applying a rule that changes interface usage to an attribute (in my case - MessageHandlerInterfaceToAttributeRector), it will either

A) [without importNames()] Update only the files I need but use annotation with the full namespace like this:

#[\Symfony\Component\Messenger\Attribute\AsMessageHandler]
class Foo
{
}

B) [with importNames()] It will add correct annotation with the short class name:

use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
class Foo
{
}

But it will also change full class name usages throughout all my code, which is huge.

So, there is no option C) at the moment, where I'd get short class for the attribute, and it won't change all other files which I didn't want to affect. I don't understand how having 2 separate config files may help me.

from rector.

samsonasik avatar samsonasik commented on June 20, 2024

It was removed due to avoid too detailed setup and making ambiguous code, see PR:

You can have as many config as needed for your use case, then run separately with --config argument in CLI.

Thank you for understanding.

from rector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.