File tree 4 files changed +33
-9
lines changed
src/DependencyInjection/Loader/Configurator 4 files changed +33
-9
lines changed Original file line number Diff line number Diff line change 49
49
"symplify/skipper" : " ^10.0" ,
50
50
"symplify/smart-file-system" : " ^10.0" ,
51
51
"symplify/symfony-php-config" : " ^10.0" ,
52
+ "symplify/vendor-patches" : " ^10.0" ,
52
53
"tracy/tracy" : " ^2.8" ,
53
54
"webmozart/assert" : " ^1.10"
54
55
},
70
71
"symplify/phpstan-extensions" : " ^10.0" ,
71
72
"symplify/phpstan-rules" : " ^10.0" ,
72
73
"symplify/rule-doc-generator" : " ^10.0" ,
73
- "symplify/vendor-patches" : " ^10.0" ,
74
74
"timeweb/phpstan-enum" : " dev-22-upgrade-phpstan-to-1.0"
75
75
},
76
76
"replace" : {
Original file line number Diff line number Diff line change @@ -514,3 +514,11 @@ parameters:
514
514
paths :
515
515
- packages/StaticTypeMapper/PhpDocParser/IntersectionTypeMapper.php
516
516
- packages/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php
517
+
518
+ -
519
+ message : ' #Use separate function calls with readable variable names#'
520
+ path : src/DependencyInjection/Loader/Configurator/RectorServiceConfigurator.php
521
+
522
+ -
523
+ message : ' #\$service\-\>call\("configure", \[\[ \.\.\. \]\]\) must be followed by exact array#'
524
+ path : src/DependencyInjection/Loader/Configurator/RectorServiceConfigurator.php
Original file line number Diff line number Diff line change 15
15
use Rector \Set \ValueObject \LevelSetList ;
16
16
use Rector \Set \ValueObject \SetList ;
17
17
use Symfony \Component \DependencyInjection \Loader \Configurator \ContainerConfigurator ;
18
- use Symplify \SymfonyPhpConfig \ValueObjectInliner ;
19
18
20
19
return static function (ContainerConfigurator $ containerConfigurator ): void {
21
20
// include the latest PHP version + all bellow in one config!
38
37
39
38
// phpunit
40
39
$ services ->set (PreferThisOrSelfMethodCallRector::class)
41
- ->call ( ' configure ' , [ [
40
+ ->configure ( [
42
41
PreferThisOrSelfMethodCallRector::TYPE_TO_PREFERENCE => [
43
- TestCase::class => ValueObjectInliner:: inline ( PreferenceSelfThis::PREFER_THIS () ),
42
+ TestCase::class => PreferenceSelfThis::PREFER_THIS (),
44
43
],
45
- ]] );
44
+ ]);
46
45
47
46
$ services ->set (ReturnArrayClassMethodToYieldRector::class)
48
- ->call ( ' configure ' , [ [
49
- ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => ValueObjectInliner:: inline ( [
47
+ ->configure ( [
48
+ ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => [
50
49
new ReturnArrayClassMethodToYield ('PHPUnit\Framework\TestCase ' , '*provide* ' ),
51
- ]) ,
52
- ]] );
50
+ ],
51
+ ]);
53
52
54
53
$ parameters = $ containerConfigurator ->parameters ();
55
54
Original file line number Diff line number Diff line change 5
5
namespace Rector \Core \DependencyInjection \Loader \Configurator ;
6
6
7
7
use Symfony \Component \DependencyInjection \Loader \Configurator \ServiceConfigurator ;
8
+ use Symplify \SymfonyPhpConfig \ValueObjectInliner ;
8
9
9
10
/**
11
+ * @api
10
12
* Same as Symfony service configurator, with extra "configure()" method for easier DX
11
13
*/
12
14
final class RectorServiceConfigurator extends ServiceConfigurator
13
15
{
16
+ /**
17
+ * @param array<string, mixed> $configuration
18
+ */
19
+ public function configure (array $ configuration ): void
20
+ {
21
+ // decorate with value object inliner so Symfony understands, see https://getrector.org/blog/2020/09/07/how-to-inline-value-object-in-symfony-php-config
22
+ array_walk_recursive ($ configuration , function (&$ value ) {
23
+ if (is_object ($ value )) {
24
+ $ value = ValueObjectInliner::inline ($ value );
25
+ }
14
26
27
+ return $ value ;
28
+ });
29
+
30
+ $ this ->call ('configure ' , [$ configuration ]);
31
+ }
15
32
}
You can’t perform that action at this time.
0 commit comments