Skip to content

Commit b543ad5

Browse files
committed
skip tags if has detail in ServiceTagsToDefaultsAutoconfigureRector
1 parent 3595b75 commit b543ad5

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Rector\Symfony\Tests\Configs\Rector\Closure\ServiceTagsToDefaultsAutoconfigureRector\Fixture;
4+
5+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
6+
7+
return static function (ContainerConfigurator $containerConfigurator): void {
8+
$services = $containerConfigurator->services();
9+
10+
$services->defaults()
11+
->autowire()
12+
->autoconfigure();
13+
14+
$services->set('someclass')
15+
->tag('monolog.logger', [
16+
'channel' => 'some_channel',
17+
]);
18+
};

rules/Configs/Rector/Closure/ServiceTagsToDefaultsAutoconfigureRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ public function refactor(Node $node): ?Node
107107
return null;
108108
}
109109

110+
if (count($node->getArgs()) > 1) {
111+
return null;
112+
}
113+
110114
// is autoconfigureable tag?
111115
$firstArg = $node->getArgs()[0];
112116

0 commit comments

Comments
 (0)