diff --git a/resources/docs/swiss-knife.md b/resources/docs/swiss-knife.md new file mode 100644 index 000000000..927c276f5 --- /dev/null +++ b/resources/docs/swiss-knife.md @@ -0,0 +1,21 @@ +In 2024 we shipped an in-house tool that we originally used only internally to help with upgrades. + +It can help you with various everyday tasks that are outside Rector's scope, but are connected with upgrades and code quality. + +### Install + +```bash +composer require rector/swiss-knife --dev +``` + +It helps with: + +* fixing PSR-4 namespace to match `composer.json` autoload +* finalizing all classes excepts parents, entities marked with docblock, attributes or YAML-defined +* detecting commented code or git conflicts + +
+ +See [Swiss knife Github repository](https://github.com/rectorphp/swiss-knife) for full documentation. + + diff --git a/resources/docs/team-tools.md b/resources/docs/team-tools.md index 7a06078f3..6be5cec69 100644 --- a/resources/docs/team-tools.md +++ b/resources/docs/team-tools.md @@ -23,18 +23,6 @@ There 2 more tools that help out with specific sets: * [tomasvotruba/type-coverage](https://github.com/TomasVotruba/type-coverage) - works best with `withTypeCoverageLevel()` * [tomasvotruba/class-leak](https://github.com/TomasVotruba/class-leak) - works best with `withDeadCodeLevel()` -## 3. Multi Tools - -Last but not least, in 2024 we shipped a home made tool that can help you with various tasks. We use it every project and it's a great help: - -* [rector/swiss-knife](https://github.com/rectorphp/swiss-knife) - -It helps with: - -* fixing PSR-4 namespace to match `composer.json` autoload -* finalizing all classes excepts parents, entities marked with docblock, attributes or YAML-defined -* detecting commented code or git conflicts -
There is also [symplify/config-transformer](https://github.com/symplify/config-transformer) that helps with transforming YAML Symfony configs to PHP. There you can follow up with [Symfony rules for Rector](/rule-detail/string-extension-to-config-builder-rector) to reach config builders. diff --git a/resources/views/docs/section.blade.php b/resources/views/docs/section.blade.php index 0493de59c..c6689a8cb 100644 --- a/resources/views/docs/section.blade.php +++ b/resources/views/docs/section.blade.php @@ -11,9 +11,7 @@ @@ -44,14 +42,6 @@ class="{{ $documentation_menu_item->isNew() ? 'text-bold' : '' }}" @endforeach @endforeach - -
diff --git a/src/Documentation/DocumentationMenuFactory.php b/src/Documentation/DocumentationMenuFactory.php index 5ddc6e8d5..1b5fcb560 100644 --- a/src/Documentation/DocumentationMenuFactory.php +++ b/src/Documentation/DocumentationMenuFactory.php @@ -71,6 +71,13 @@ public function create(): array $this->documentationMenuItemFactory->createSection('rules-overview', 'Rules Overview'), $this->documentationMenuItemFactory->createSection('creating-a-node-visitor', 'Creating Node Visitor'), $this->documentationMenuItemFactory->createSection('how-to-run-on-php-53', 'Run on PHP 5.3'), + $this->documentationMenuItemFactory->createSection( + 'https://leanpub.com/rector-the-power-of-automated-refactoring', + 'Learn Rector in Depth from Book' + ), + ], + 'Rector Family Tools' => [ + $this->documentationMenuItemFactory->createSection('swiss-knife', 'Swiss Knife', true), ], ]; } diff --git a/src/Documentation/DocumentationMenuItemFactory.php b/src/Documentation/DocumentationMenuItemFactory.php index c6016e301..6d1602b10 100644 --- a/src/Documentation/DocumentationMenuItemFactory.php +++ b/src/Documentation/DocumentationMenuItemFactory.php @@ -15,16 +15,17 @@ public function __construct( ) { } - public function createSection(string $slug, string $name, bool $isNew = false): DocumentationMenuItem + public function createSection(string $slugOrUrl, string $name, bool $isNew = false): DocumentationMenuItem { - return new DocumentationMenuItem( - $this->urlGenerator->action(DocumentationController::class, [ - 'section' => $slug, - ]), - $name, - $isNew - ); - + if (str_starts_with($slugOrUrl, 'https://')) { + $url = $slugOrUrl; + } else { + $url = $this->urlGenerator->action(DocumentationController::class, [ + 'section' => $slugOrUrl, + ]); + } + + return new DocumentationMenuItem($url, $name, $isNew); } /**