1010use Rector \Console \ProcessConfigureDecorator ;
1111use Rector \FileSystem \FilesFinder ;
1212use Rector \Testing \PHPUnit \AbstractLazyTestCase ;
13+ use stdClass ;
1314use Symfony \Component \Console \Command \Command ;
1415use Symfony \Component \Console \Input \ArrayInput ;
1516
@@ -20,6 +21,7 @@ protected function tearDown(): void
2021 SimpleParameterProvider ::setParameter (Option::IS_RUN_NARROWED , false );
2122 SimpleParameterProvider ::setParameter (Option::SOURCE , []);
2223 SimpleParameterProvider ::setParameter (Option::PATHS , []);
24+ SimpleParameterProvider ::setParameter (Option::RULE_CONFIGURATIONS , []);
2325 }
2426
2527 public function test (): void
@@ -93,6 +95,33 @@ public function testSourceParameterIsOutsideTheCacheInvalidationHash(): void
9395 $ this ->assertSame ($ hashForOnePath , SimpleParameterProvider ::hashForCacheInvalidation ());
9496 }
9597
98+ public function testObjectPropertyOrderIsOutsideTheCacheInvalidationHash (): void
99+ {
100+ // PHPStan Turbo workers declare e.g. MixedType properties in another order than the main process,
101+ // the same configured value must hash alike in both
102+ $ firstOrder = new stdClass ();
103+ $ firstOrder ->isExplicitMixed = false ;
104+ $ firstOrder ->subtractedType = null ;
105+
106+ SimpleParameterProvider ::setParameter (Option::RULE_CONFIGURATIONS , [
107+ 'SomeRector ' => [$ firstOrder ],
108+ ]);
109+ $ firstOrderHash = SimpleParameterProvider ::hashForCacheInvalidation ();
110+
111+ $ secondOrder = new stdClass ();
112+ $ secondOrder ->subtractedType = null ;
113+ $ secondOrder ->isExplicitMixed = false ;
114+
115+ SimpleParameterProvider ::setParameter (Option::RULE_CONFIGURATIONS , [
116+ 'SomeRector ' => [$ secondOrder ],
117+ ]);
118+
119+ $ this ->assertSame ($ firstOrderHash , SimpleParameterProvider ::hashForCacheInvalidation ());
120+
121+ $ secondOrder ->isExplicitMixed = true ;
122+ $ this ->assertNotSame ($ firstOrderHash , SimpleParameterProvider ::hashForCacheInvalidation ());
123+ }
124+
96125 /**
97126 * @param string[] $paths
98127 */
0 commit comments