Skip to content

Commit

Permalink
switch configs from YML to PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Sep 12, 2020
1 parent 17b36a4 commit 9732bf1
Show file tree
Hide file tree
Showing 31 changed files with 300 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/local_package_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- run: |
# Prepare rector config files with Drupal specific settings
cd ..
cp vendor/palantirnet/drupal-rector/rector.yml .
cp vendor/palantirnet/drupal-rector/rector.php .
# This is copied from `local_package_run_rector`.
# This seems needed for the autoloading to work.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/local_package_run_rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- run: |
# Prepare rector config files with Drupal specific settings
cd ..
cp vendor/palantirnet/drupal-rector/rector.yml .
cp vendor/palantirnet/drupal-rector/rector.php .
- run: |
# Prepare rector_examples folder in the drupal modules directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/packagist_package_run_rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- run: |
# Prepare rector config files with Drupal specific settings
cd drupal
cp vendor/palantirnet/drupal-rector/rector.yml .
cp vendor/palantirnet/drupal-rector/rector.php .
- run: |
# Prepare rector_examples folder in the drupal modules directory
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ $ composer require --dev palantirnet/drupal-rector

### Create a configuration file in your project

You will need to have a `rector.yml` configuration in the root of your repository. This should sit beside your document root such as `web` or `docroot`.
You will need to have a `rector.php` configuration in the root of your repository. This should sit beside your document root such as `web` or `docroot`.

This project provides starting files that should handle most use cases.

If your document root directory is `web`, you can copy the `rector-config-web-dir.yml`

```bash
cp vendor/palantirnet/drupal-rector/rector-config-web-dir.yml rector.yml
cp vendor/palantirnet/drupal-rector/rector-config-web-dir.yml rector.php
```

If your document root directory is `docroot`, you can copy the `rector-config-docroot-dir.yml`

```bash
cp vendor/palantirnet/drupal-rector/rector-config-docroot-dir.yml rector.yml
cp vendor/palantirnet/drupal-rector/rector-config-docroot-dir.yml rector.php
```

If your document root directory is something else you will need to manually copy and edit `rector.yml`.
If your document root directory is something else you will need to manually copy and edit `rector.php`.

Replace the `web` in these paths with your document root.

Expand Down Expand Up @@ -140,7 +140,7 @@ If you are having these issues try running Rector from the environment that has

### Iconv error when running Rector in Alpine Docker

If you are getting errors like
If you are getting errors like

`iconv(): Wrong charset, conversion from UTF-8 to ASCII//TRANSLIT//IGNORE is not allowed`

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ast"
],
"require": {
"php": "^7.2",
"jawira/case-converter": "^1.1",
"rector/rector-prefixed": "^0.8.6"
},
Expand Down
13 changes: 13 additions & 0 deletions config/drupal-8/drupal-8-all-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/drupal-8.*');

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::EXCLUDE_RECTORS, []);
};
16 changes: 0 additions & 16 deletions config/drupal-8/drupal-8-all-deprecations.yml

This file was deleted.

72 changes: 72 additions & 0 deletions config/drupal-8/drupal-8.0-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\DBDeleteRector;
use DrupalRector\Rector\Deprecation\DBInsertRector;
use DrupalRector\Rector\Deprecation\DBQueryRector;
use DrupalRector\Rector\Deprecation\DBSelectRector;
use DrupalRector\Rector\Deprecation\DBUpdateRector;
use DrupalRector\Rector\Deprecation\DrupalLRector;
use DrupalRector\Rector\Deprecation\DrupalRealpathRector;
use DrupalRector\Rector\Deprecation\DrupalRenderRector;
use DrupalRector\Rector\Deprecation\DrupalRenderRootRector;
use DrupalRector\Rector\Deprecation\DrupalURLRector;
use DrupalRector\Rector\Deprecation\EntityCreateRector;
use DrupalRector\Rector\Deprecation\EntityInterfaceLinkRector;
use DrupalRector\Rector\Deprecation\EntityInterfaceUrlInfoRector;
use DrupalRector\Rector\Deprecation\EntityLoadRector;
use DrupalRector\Rector\Deprecation\EntityManagerRector;
use DrupalRector\Rector\Deprecation\FileLoadRector;
use DrupalRector\Rector\Deprecation\FormatDateRector;
use DrupalRector\Rector\Deprecation\LinkGeneratorTraitLRector;
use DrupalRector\Rector\Deprecation\NodeLoadRector;
use DrupalRector\Rector\Deprecation\SafeMarkupFormatRector;
use DrupalRector\Rector\Deprecation\UserLoadRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(DBInsertRector::class);

$services->set(DBSelectRector::class);

$services->set(DBQueryRector::class);

$services->set(DBDeleteRector::class);

$services->set(DBUpdateRector::class);

$services->set(DrupalRenderRector::class);

$services->set(DrupalRenderRootRector::class);

$services->set(DrupalURLRector::class);

$services->set(DrupalLRector::class);

$services->set(DrupalRealpathRector::class);

$services->set(EntityCreateRector::class);

$services->set(EntityInterfaceLinkRector::class);

$services->set(EntityInterfaceUrlInfoRector::class);

$services->set(EntityLoadRector::class);

$services->set(EntityManagerRector::class);

$services->set(FormatDateRector::class);

$services->set(FileLoadRector::class);

$services->set(LinkGeneratorTraitLRector::class);

$services->set(NodeLoadRector::class);

$services->set(SafeMarkupFormatRector::class);

$services->set(UserLoadRector::class);
};
23 changes: 0 additions & 23 deletions config/drupal-8/drupal-8.0-deprecations.yml

This file was deleted.

8 changes: 8 additions & 0 deletions config/drupal-8/drupal-8.1-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
};
2 changes: 0 additions & 2 deletions config/drupal-8/drupal-8.1-deprecations.yml

This file was deleted.

12 changes: 12 additions & 0 deletions config/drupal-8/drupal-8.2-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\FileDirectoryOsTempRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(FileDirectoryOsTempRector::class);
};
3 changes: 0 additions & 3 deletions config/drupal-8/drupal-8.2-deprecations.yml

This file was deleted.

12 changes: 12 additions & 0 deletions config/drupal-8/drupal-8.3-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\RequestTimeConstRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(RequestTimeConstRector::class);
};
3 changes: 0 additions & 3 deletions config/drupal-8/drupal-8.3-deprecations.yml

This file was deleted.

5 changes: 0 additions & 5 deletions config/drupal-8/drupal-8.4-deprecations.yml

This file was deleted.

21 changes: 21 additions & 0 deletions config/drupal-8/drupal-8.5-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\DatetimeDateStorageFormatRector;
use DrupalRector\Rector\Deprecation\DatetimeDatetimeStorageFormatRector;
use DrupalRector\Rector\Deprecation\DatetimeStorageTimezoneRector;
use DrupalRector\Rector\Deprecation\DrupalSetMessageRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(DrupalSetMessageRector::class);

$services->set(DatetimeDateStorageFormatRector::class);

$services->set(DatetimeDatetimeStorageFormatRector::class);

$services->set(DatetimeStorageTimezoneRector::class);
};
6 changes: 0 additions & 6 deletions config/drupal-8/drupal-8.5-deprecations.yml

This file was deleted.

18 changes: 18 additions & 0 deletions config/drupal-8/drupal-8.6-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\UnicodeStrlenRector;
use DrupalRector\Rector\Deprecation\UnicodeStrtolowerRector;
use DrupalRector\Rector\Deprecation\UnicodeSubstrRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(UnicodeStrlenRector::class);

$services->set(UnicodeStrtolowerRector::class);

$services->set(UnicodeSubstrRector::class);
};
5 changes: 0 additions & 5 deletions config/drupal-8/drupal-8.6-deprecations.yml

This file was deleted.

27 changes: 27 additions & 0 deletions config/drupal-8/drupal-8.7-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\FileCreateDirectoryRector;
use DrupalRector\Rector\Deprecation\FileExistsRenameRector;
use DrupalRector\Rector\Deprecation\FileExistsReplaceRector;
use DrupalRector\Rector\Deprecation\FileModifyPermissionsRector;
use DrupalRector\Rector\Deprecation\FilePrepareDirectoryRector;
use DrupalRector\Rector\Deprecation\FileUnmanagedSaveDataRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(FilePrepareDirectoryRector::class);

$services->set(FileCreateDirectoryRector::class);

$services->set(FileExistsReplaceRector::class);

$services->set(FileUnmanagedSaveDataRector::class);

$services->set(FileModifyPermissionsRector::class);

$services->set(FileExistsRenameRector::class);
};
8 changes: 0 additions & 8 deletions config/drupal-8/drupal-8.7-deprecations.yml

This file was deleted.

45 changes: 45 additions & 0 deletions config/drupal-8/drupal-8.8-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

declare(strict_types=1);

use DrupalRector\Rector\Deprecation\EntityGetDisplayRector;
use DrupalRector\Rector\Deprecation\EntityGetFormDisplayRector;
use DrupalRector\Rector\Deprecation\EntityTypeGetLowercaseLabelRector;
use DrupalRector\Rector\Deprecation\FileDefaultSchemeRector;
use DrupalRector\Rector\Deprecation\FileDirectoryTempRector;
use DrupalRector\Rector\Deprecation\FileScanDirectoryRector;
use DrupalRector\Rector\Deprecation\FileUriTargetRector;
use DrupalRector\Rector\Deprecation\PathAliasManagerServiceNameRector;
use DrupalRector\Rector\Deprecation\PathAliasRepositoryRector;
use DrupalRector\Rector\Deprecation\PathAliasWhitelistServiceNameRector;
use DrupalRector\Rector\Deprecation\PathProcessorAliasServiceNameRector;
use DrupalRector\Rector\Deprecation\PathSubscriberServiceNameRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(PathAliasManagerServiceNameRector::class);

$services->set(PathAliasWhitelistServiceNameRector::class);

$services->set(PathSubscriberServiceNameRector::class);

$services->set(PathProcessorAliasServiceNameRector::class);

$services->set(PathAliasRepositoryRector::class);

$services->set(FileDefaultSchemeRector::class);

$services->set(EntityGetDisplayRector::class);

$services->set(EntityGetFormDisplayRector::class);

$services->set(EntityTypeGetLowercaseLabelRector::class);

$services->set(FileScanDirectoryRector::class);

$services->set(FileDirectoryTempRector::class);

$services->set(FileUriTargetRector::class);
};
Loading

0 comments on commit 9732bf1

Please sign in to comment.