diff --git a/docs/rules_overview.md b/docs/rules_overview.md index 1a80073f..ccf94f13 100644 --- a/docs/rules_overview.md +++ b/docs/rules_overview.md @@ -1,21 +1,56 @@ -# 52 Rules Overview +# 54 Rules Overview
## Categories -- [Drupal10](#drupal10) (2) +- [Drupal10](#drupal10) (3) - [Drupal8](#drupal8) (18) - [Drupal9](#drupal9) (26) -- [DrupalRector](#drupalrector) (6) +- [DrupalRector](#drupalrector) (7)
## Drupal10 +### AnnotationToAttributeRector + +Change annotations with value to attribute + +:wrench: **configure it!** + +- class: [`DrupalRector\Drupal10\Rector\Deprecation\AnnotationToAttributeRector`](../src/Drupal10/Rector/Deprecation/AnnotationToAttributeRector.php) + +```diff + namespace Drupal\Core\Action\Plugin\Action; + ++use Drupal\Core\Action\Plugin\Action\Derivative\EntityPublishedActionDeriver; ++use Drupal\Core\Action\Attribute\Action; + use Drupal\Core\Session\AccountInterface; ++use Drupal\Core\StringTranslation\TranslatableMarkup; + + /** + * Publishes an entity. +- * +- * @Action( +- * id = "entity:publish_action", +- * action_label = @Translation("Publish"), +- * deriver = "Drupal\Core\Action\Plugin\Action\Derivative\EntityPublishedActionDeriver", +- * ) + */ ++#[Action( ++ id: 'entity:publish_action', ++ action_label: new TranslatableMarkup('Publish'), ++ deriver: EntityPublishedActionDeriver::class ++)] + class PublishAction extends EntityActionBase { +``` + +
+ ### SystemTimeZonesRector Fixes deprecated `system_time_zones()` calls @@ -843,6 +878,25 @@ Fixes deprecated `user_password()` calls ## DrupalRector +### ClassConstantToClassConstantRector + +Fixes deprecated class contant use, used in Drupal 9.1 deprecations + +:wrench: **configure it!** + +- class: [`DrupalRector\Rector\Deprecation\ClassConstantToClassConstantRector`](../src/Rector/Deprecation/ClassConstantToClassConstantRector.php) + +```diff +-$value = Symfony\Cmf\Component\Routing\RouteObjectInterface::ROUTE_NAME; +-$value2 = Symfony\Cmf\Component\Routing\RouteObjectInterface::ROUTE_OBJECT; +-$value3 = Symfony\Cmf\Component\Routing\RouteObjectInterface::CONTROLLER_NAME; ++$value = \Drupal\Core\Routing\RouteObjectInterface::ROUTE_NAME; ++$value2 = \Drupal\Core\Routing\RouteObjectInterface::ROUTE_OBJECT; ++$value3 = \Drupal\Core\Routing\RouteObjectInterface::CONTROLLER_NAME; +``` + +
+ ### ConstantToClassConstantRector Fixes deprecated contant use, used in Drupal 8 and 9 deprecations diff --git a/src/Drupal10/Rector/Deprecation/AnnotationToAttributeRector.php b/src/Drupal10/Rector/Deprecation/AnnotationToAttributeRector.php index 5f0c0e94..ba2b311b 100644 --- a/src/Drupal10/Rector/Deprecation/AnnotationToAttributeRector.php +++ b/src/Drupal10/Rector/Deprecation/AnnotationToAttributeRector.php @@ -27,7 +27,7 @@ use Rector\PhpAttribute\AnnotationToAttributeMapper; use Rector\ValueObject\PhpVersion; use Rector\VersionBonding\Contract\MinPhpVersionInterface; -use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; +use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** @@ -80,7 +80,7 @@ public function configure(array $configuration): void public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Change annotations with value to attribute', [new CodeSample(<<<'CODE_SAMPLE' + return new RuleDefinition('Change annotations with value to attribute', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' namespace Drupal\Core\Action\Plugin\Action; @@ -116,7 +116,10 @@ class PublishAction extends EntityActionBase { )] class PublishAction extends EntityActionBase { CODE_SAMPLE - )]); + , + [ + new AnnotationToAttributeConfiguration('10.2.0', '12.0.0', 'Action', 'Drupal\Core\Action\Attribute\Action'), + ])]); } /**