Skip to content

Commit

Permalink
Remove DoctrineAnnotationClassToAttributeRector as made for custom pr…
Browse files Browse the repository at this point in the history
…oject, not useful for general use (#4127)
  • Loading branch information
TomasVotruba committed Jun 8, 2023
1 parent ae874ef commit f2509fa
Show file tree
Hide file tree
Showing 24 changed files with 3 additions and 861 deletions.
83 changes: 3 additions & 80 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 376 Rules Overview
# 374 Rules Overview

<br>

Expand Down Expand Up @@ -40,7 +40,7 @@

- [Php74](#php74) (13)

- [Php80](#php80) (18)
- [Php80](#php80) (17)

- [Php81](#php81) (11)

Expand All @@ -56,7 +56,7 @@

- [Strict](#strict) (5)

- [Transform](#transform) (26)
- [Transform](#transform) (25)

- [TypeDeclaration](#typedeclaration) (40)

Expand Down Expand Up @@ -5335,47 +5335,6 @@ return static function (RectorConfig $rectorConfig): void {

<br>

### DoctrineAnnotationClassToAttributeRector

Refactor Doctrine `@annotation` annotated class to a PHP 8.0 attribute class

:wrench: **configure it!**

- class: [`Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector`](../rules/Php80/Rector/Class_/DoctrineAnnotationClassToAttributeRector.php)

```php
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(DoctrineAnnotationClassToAttributeRector::class, [
DoctrineAnnotationClassToAttributeRector::REMOVE_ANNOTATIONS => true,
]);
};
```


```diff
-use Doctrine\Common\Annotations\Annotation\Target;
+use Attribute;

-/**
- * @Annotation
- * @Target({"METHOD"})
- */
+#[Attribute(Attribute::TARGET_METHOD)]
class SomeAnnotation
{
}
```

<br>

### FinalPrivateToPrivateVisibilityRector

Changes method visibility from final private to only private
Expand Down Expand Up @@ -7480,42 +7439,6 @@ return static function (RectorConfig $rectorConfig): void {

<br>

### RemoveAllowDynamicPropertiesAttributeRector

Remove the `AllowDynamicProperties` attribute from all classes

:wrench: **configure it!**

- class: [`Rector\Transform\Rector\Class_\RemoveAllowDynamicPropertiesAttributeRector`](../rules/Transform/Rector/Class_/RemoveAllowDynamicPropertiesAttributeRector.php)

```php
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Transform\Rector\Class_\RemoveAllowDynamicPropertiesAttributeRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(RemoveAllowDynamicPropertiesAttributeRector::class, [
'Example\*',
]);
};
```


```diff
namespace Example\Domain;

-#[AllowDynamicProperties]
class SomeObject {
public string $someProperty = 'hello world';
}
```

<br>

### ReplaceParentCallByPropertyCallRector

Changes method calls in child of specific types to defined property method call
Expand Down
17 changes: 0 additions & 17 deletions packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,6 @@ public function hasByAnnotationClasses(array $annotationsClasses): bool
return $this->getByAnnotationClasses($annotationsClasses) instanceof DoctrineAnnotationTagValueNode;
}

/**
* @param string[] $desiredClasses
*/
public function findOneByAnnotationClasses(array $desiredClasses): ?DoctrineAnnotationTagValueNode
{
foreach ($desiredClasses as $desiredClass) {
$doctrineAnnotationTagValueNode = $this->findOneByAnnotationClass($desiredClass);
if (! $doctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
continue;
}

return $doctrineAnnotationTagValueNode;
}

return null;
}

public function findOneByAnnotationClass(string $desiredClass): ?DoctrineAnnotationTagValueNode
{
$foundTagValueNodes = $this->findByAnnotationClass($desiredClass);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f2509fa

Please sign in to comment.