Skip to content

Commit

Permalink
ConstantToClassConstantRector serves d8 and d9, it should be in the g…
Browse files Browse the repository at this point in the history
…eneric space
  • Loading branch information
bbrala committed Jan 15, 2024
1 parent 0617aa1 commit e10e9b8
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions config/drupal-8/drupal-8.5-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\Deprecation\DrupalSetMessageRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Services\AddCommentService;
use Rector\Config\RectorConfig;

Expand Down
4 changes: 2 additions & 2 deletions config/drupal-8/drupal-8.7-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\Deprecation\FunctionToServiceRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToServiceConfiguration;
use DrupalRector\Services\AddCommentService;
use Rector\Config\RectorConfig;
Expand Down
4 changes: 2 additions & 2 deletions config/drupal-9/drupal-9.3-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Drupal9\Rector\Deprecation\ExtensionPathRector;
use DrupalRector\Drupal9\Rector\Deprecation\FileBuildUriRector;
use DrupalRector\Drupal9\Rector\Deprecation\FunctionToEntityTypeStorageMethod;
Expand All @@ -15,8 +13,10 @@
use DrupalRector\Drupal9\Rector\ValueObject\ExtensionPathConfiguration;
use DrupalRector\Drupal9\Rector\ValueObject\FunctionToEntityTypeStorageConfiguration;
use DrupalRector\Drupal9\Rector\ValueObject\FunctionToFirstArgMethodConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\Deprecation\FunctionToServiceRector;
use DrupalRector\Rector\Deprecation\FunctionToStaticRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToServiceConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToStaticConfiguration;
use DrupalRector\Services\AddCommentService;
Expand Down
34 changes: 17 additions & 17 deletions docs/rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

- [Drupal10](#drupal10) (2)

- [Drupal8](#drupal8) (19)
- [Drupal8](#drupal8) (18)

- [Drupal9](#drupal9) (26)

- [DrupalRector](#drupalrector) (5)
- [DrupalRector](#drupalrector) (6)

<br>

Expand Down Expand Up @@ -56,21 +56,6 @@ Fixes deprecated watchdog_exception('update', `$exception)` calls

## Drupal8

### ConstantToClassConstantRector

Fixes deprecated contant use

:wrench: **configure it!**

- class: [`DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector`](../src/Drupal8/Rector/Deprecation/ConstantToClassConstantRector.php)

```diff
-$result = file_unmanaged_copy($source, $destination, DEPRECATED_CONSTANT);
+$result = file_unmanaged_copy($source, $destination, \Drupal\MyClass::CONSTANT);
```

<br>

### DBRector

Fixes deprecated `db_delete()` calls
Expand Down Expand Up @@ -858,6 +843,21 @@ Fixes deprecated `user_password()` calls

## DrupalRector

### ConstantToClassConstantRector

Fixes deprecated contant use, used in Drupal 8 and 9 deprecations

:wrench: **configure it!**

- class: [`DrupalRector\Rector\Deprecation\ConstantToClassConstantRector`](../src/Rector/Deprecation/ConstantToClassConstantRector.php)

```diff
-$result = file_unmanaged_copy($source, $destination, DEPRECATED_CONSTANT);
+$result = file_unmanaged_copy($source, $destination, \Drupal\MyClass::CONSTANT);
```

<br>

### DeprecationHelperRemoveRector

Remove DeprecationHelper calls for versions before configured minimum requirement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace DrupalRector\Drupal8\Rector\Deprecation;
namespace DrupalRector\Rector\Deprecation;

use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use PhpParser\Node;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Rector\AbstractRector;
Expand All @@ -20,7 +20,7 @@
class ConstantToClassConstantRector extends AbstractRector implements ConfigurableRectorInterface
{
/**
* @var \DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration[]
* @var ConstantToClassConfiguration[]
*/
private array $constantToClassRenames;

Expand All @@ -40,7 +40,7 @@ public function configure(array $configuration): void
*/
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Fixes deprecated contant use', [
return new RuleDefinition('Fixes deprecated contant use, used in Drupal 8 and 9 deprecations', [
new ConfiguredCodeSample(
<<<'CODE_BEFORE'
$result = file_unmanaged_copy($source, $destination, DEPRECATED_CONSTANT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace DrupalRector\Drupal8\Rector\ValueObject;
namespace DrupalRector\Rector\ValueObject;

use Rector\Validation\RectorAssert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
namespace DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;

use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Tests\Rector\Deprecation\DeprecationBase;
use Rector\Config\RectorConfig;

Expand Down

0 comments on commit e10e9b8

Please sign in to comment.