diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000000..4c40423db41c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# How to Contribute + +Just follow 3 rules: + +- **1 feature per pull-request** +- **New features need tests** +- Tests, coding standards and PHPStan **checks must pass**: + + ```bash + composer complete-check + ``` + + Do you need to fix coding standards? Run: + + ```bash + composer fix-cs + ``` + +We would be happy to accept PRs that follow these guidelines. diff --git a/README.md b/README.md index acf4442a0c86..43ffa97431b5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Rector - Upgrade Your Legacy App to a Modern Codebase Rector is a **rec**onstruc**tor** tool - it does **instant upgrades** and **instant refactoring** of your code. -Why refactor manually if Rector can handle 80% for you? +Why refactor manually if Rector can handle 80% of the task for you? [![Coverage Status](https://img.shields.io/coveralls/rectorphp/rector/master.svg?style=flat-square)](https://coveralls.io/github/rectorphp/rector?branch=master) [![Downloads](https://img.shields.io/packagist/dt/rector/rector.svg?style=flat-square)](https://packagist.org/packages/rector/rector) @@ -9,7 +9,7 @@ Why refactor manually if Rector can handle 80% for you?
-- **[All 450+ Rectors Overview](/docs/AllRectorsOverview.md)** +- **[Overview of all 450+ Rectors](/docs/AllRectorsOverview.md)** - **[Do you Love&Hate Legacy? We're Hiring](https://getrector.org/join-rector-team)**
@@ -21,7 +21,7 @@ Why refactor manually if Rector can handle 80% for you? ## Sponsors Rector grows faster with your help, the more you help the more work it saves you. -Check out [Rector's Patreon](https://www.patreon.com/rectorphp). One-time donation is welcomed [through PayPal](https://www.paypal.me/rectorphp). +Check out [Rector's Patreon](https://www.patreon.com/rectorphp). One-time donations are welcome [through PayPal](https://www.paypal.me/rectorphp). Thank you: @@ -75,9 +75,9 @@ Tip: If you have EasyCodingStandard, you can start your set with [`ecs-after-rec ## Try Rector Online -Too little time to download? +No time to try Rector locally? -We have **[online demo](https://getrector.org/demo) just for you!** +We have **[an online demo](https://getrector.org/demo) just for you!** ## Install @@ -85,11 +85,11 @@ We have **[online demo](https://getrector.org/demo) just for you!** composer require rector/rector --dev ``` -**Do you have conflicts during `composer require` or on run?** +**Having conflicts during `composer require` or on run?** - Use the [Rector Prefixed](https://github.com/rectorphp/rector-prefixed) -**Do you need different PHP version than Rector supports?** +**Using a different PHP version than Rector supports?** - Use the [Docker image](#run-rector-in-docker) @@ -138,7 +138,7 @@ parameters: ### C. Custom Sets -1. Create a `rector.yaml` config file with your desired Rectors or provide another config file with `--config`: +1. Create a `rector.yaml` configuration file with your desired Rectors or provide another configuration file with `--config`: ```yaml services: @@ -159,13 +159,13 @@ parameters: ### Extra Autoloading -Rector relies on project and autoloading of its classes by using the composer autoloader as default. To specify your own autoload file, use `--autoload-file` option: +Rector relies on whatever autoload setup the project it is fixing is using by using the Composer autoloader as default. To specify your own autoload file, use `--autoload-file` option: ```bash vendor/bin/rector process ../project --autoload-file ../project/vendor/autoload.php ``` -Or use a `rector.yaml` config file: +Or use a `rector.yaml` configuration file: ```yaml # rector.yaml @@ -329,13 +329,14 @@ final class MyFirstRector extends AbstractRector */ public function getNodeTypes(): array { - // what node types we look for? + // what node types are we looking for? // pick any node from https://github.com/rectorphp/rector/blob/master/docs/NodesOverview.md return [MethodCall::class]; } /** - * @param MethodCall $node - we can add "MethodCall" type here, because only this node is in "getNodeTypes()" + * @param MethodCall $node - we can add "MethodCall" type here, because + * only this node is in "getNodeTypes()" */ public function refactor(Node $node): ?Node { @@ -373,7 +374,7 @@ final class MyFirstRector extends AbstractRector } ``` -This is how file structure should look like: +This is how the file structure should look like: ```bash /src/YourCode.php @@ -399,7 +400,7 @@ We also need to load Rector rules in `composer.json`: } ``` -After adding this to `composer.json`, be sure to reload composer class map: +After adding this to `composer.json`, be sure to reload Composer's class map: ```bash composer dump-autoload @@ -415,7 +416,7 @@ services: ### 3. Let Rector Refactor Your Code -The `rector.yaml` config is loaded by default, so we can skip it. +The `rector.yaml` configuration is loaded by default, so we can skip it. ```bash # see the diff first @@ -427,11 +428,11 @@ vendor/bin/rector process src That's it! -### Generate Rector Rule +### Generating a Rector Rule Do you want to save time with making rules and tests? -Use [`create` command](/docs/RectorRecipe.md). +Use [the `create` command](/docs/RectorRecipe.md). ## More Detailed Documentation @@ -442,23 +443,7 @@ Use [`create` command](/docs/RectorRecipe.md). ## How to Contribute -Just follow 3 rules: - -- **1 feature per pull-request** -- **New features need tests** -- Tests, coding standards and PHPStan **checks must pass**: - - ```bash - composer complete-check - ``` - - Do you need to fix coding standards? Run: - - ```bash - composer fix-cs - ``` - -We would be happy to accept PRs that follow these guidelines. +See [the contribution guide](/CONTRIBUTING.md). ## Run Rector in Docker You can run Rector on your project using Docker: @@ -472,7 +457,10 @@ docker run -v $(pwd):/project rector/rector:latest process /project/src --set sy Using `rector.yaml`: ```bash -docker run -v $(pwd):/project rector/rector:latest process /project/app --config /project/rector.yaml --autoload-file /project/vendor/autoload.php --dry-run +docker run -v $(pwd):/project rector/rector:latest process /project/app \ +--config /project/rector.yaml \ +--autoload-file /project/vendor/autoload.php \ +--dry-run ``` ### Community Packages