Skip to content

Commit

Permalink
[DX] Make generator only part of core (#2849)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 29, 2022
1 parent bd6c02a commit a6dfb04
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build/target-repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ By [buying a book](https://leanpub.com/rector-the-power-of-automated-refactoring
- [How Does Rector Work?](/docs/how_it_works.md)
- [PHP Parser Nodes](https://github.com/rectorphp/php-parser-nodes-docs/)
- [How to Work with Doc Block and Comments](/docs/how_to_work_with_doc_block_and_comments.md)
- [How to Generate New Rector Rule](/docs/create_own_rule.md)
- [How to Create Own Rector Rule](/docs/create_own_rule.md)

See [the full documentation](/docs).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ You can have custom `SetList` class that has constants that pointed to your own


```php
<?php

namespace App\Set\ValueObject;

use Rector\Set\Contract\SetListInterface;

class SetList implements SetListInterface
final class SetList implements SetListInterface
{
public const MY_FRAMEWORK_20 = __DIR__ . '/../../../config/set/my-framework-20.php';
}
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"rector/rector-cakephp": "dev-main",
"rector/rector-doctrine": "dev-main",
"rector/rector-downgrade-php": "dev-main",
"rector/rector-generator": "dev-main",
"rector/rector-laravel": "dev-main",
"rector/rector-phpoffice": "dev-main",
"rector/rector-phpunit": "dev-main",
Expand All @@ -52,11 +51,11 @@
},
"require-dev": {
"brianium/paratest": "^6.6",
"rector/rector-generator": "dev-main",
"cweagans/composer-patches": "^1.7.2",
"myclabs/php-enum": "^1.8.4",
"nategood/httpful": "^0.3.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-nette": "^1.0",
"phpstan/phpstan-php-parser": "^1.1",
"phpstan/phpstan-strict-rules": "^1.3",
"phpstan/phpstan-webmozart-assert": "^1.2",
Expand Down
10 changes: 3 additions & 7 deletions packages/ChangesReporting/ValueObjectFactory/FileDiffFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,23 @@
namespace Rector\ChangesReporting\ValueObjectFactory;

use Rector\Core\Differ\DefaultDiffer;
use Rector\Core\FileSystem\FilePathHelper;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Reporting\FileDiff;
use Symplify\PackageBuilder\Console\Output\ConsoleDiffer;
use Symplify\SmartFileSystem\SmartFileSystem;

final class FileDiffFactory
{
public function __construct(
private readonly DefaultDiffer $defaultDiffer,
private readonly ConsoleDiffer $consoleDiffer,
private readonly SmartFileSystem $smartFileSystem,
private readonly FilePathHelper $filePathHelper,
) {
}

public function createFileDiff(File $file, string $oldContent, string $newContent): FileDiff
{
$relativeFilePath = $this->smartFileSystem->makePathRelative(
$file->getFilePath(),
(string) realpath(getcwd())
);
$relativeFilePath = \rtrim($relativeFilePath, '/');
$relativeFilePath = $this->filePathHelper->relativePath($file->getFilePath());

// always keep the most recent diff
return new FileDiff(
Expand Down
1 change: 0 additions & 1 deletion phpstan-for-rector.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ parameters:
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-nette/extension.neon

0 comments on commit a6dfb04

Please sign in to comment.