Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ServicesSetNameToSetTypeRector as it creates invalid code #649

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/sets/symfony/configs.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
use Rector\Symfony\Configs\Rector\Closure\ServiceArgsToServiceNamedArgRector;
use Rector\Symfony\Configs\Rector\Closure\ServiceSetStringNameToClassNameRector;
use Rector\Symfony\Configs\Rector\Closure\ServiceSettersToSettersAutodiscoveryRector;
use Rector\Symfony\Configs\Rector\Closure\ServicesSetNameToSetTypeRector;
use Rector\Symfony\Configs\Rector\Closure\ServiceTagsToDefaultsAutoconfigureRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rules([
ServiceArgsToServiceNamedArgRector::class,
ServiceSetStringNameToClassNameRector::class,
ServiceSettersToSettersAutodiscoveryRector::class,
ServicesSetNameToSetTypeRector::class,
ServiceTagsToDefaultsAutoconfigureRector::class,
]);
};
31 changes: 9 additions & 22 deletions docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 84 Rules Overview
# 83 Rules Overview

## ActionSuffixRemoverRector

Expand Down Expand Up @@ -285,7 +285,7 @@ Add `Symfony\Component\Console\Attribute\AsCommand` to Symfony Commands and remo
{
- public static $defaultName = 'sunshine';
-
- public static $defaultDescription = 'Ssome description';
- public static $defaultDescription = 'some description';
}
```

Expand Down Expand Up @@ -1474,9 +1474,15 @@ Replaces #[Security] framework-bundle attribute with Symfony native #[IsGranted]

class PostController extends Controller
{
- #[Security("is_granted('ROLE_ADMIN')")]
+ #[IsGranted('ROLE_ADMIN')]
public function index()
{
}

- #[Security("is_granted('ROLE_ADMIN') and is_granted('ROLE_FRIENDLY_USER')")]
+ #[IsGranted(new Expression("is_granted('ROLE_ADMIN') and is_granted('ROLE_FRIENDLY_USER')"))]
public function index()
public function list()
{
}
}
Expand Down Expand Up @@ -1571,25 +1577,6 @@ Change `$services->set(...,` ...)->tag(...) to `$services->defaults()->autodisco

<br>

## ServicesSetNameToSetTypeRector

Change `$services->set("name_type",` SomeType::class) to bare type, useful since Symfony 3.4

- class: [`Rector\Symfony\Configs\Rector\Closure\ServicesSetNameToSetTypeRector`](../rules/Configs/Rector/Closure/ServicesSetNameToSetTypeRector.php)

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

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

- $services->set('some_name', App\SomeClass::class);
+ $services->set(App\SomeClass::class);
};
```

<br>

## SignalableCommandInterfaceReturnTypeRector

Return int or false from `SignalableCommandInterface::handleSignal()` instead of void
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.

Loading
Loading