File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 3131final class RectorConfig extends Container
3232{
3333 /**
34- * @var array<class-string<RectorInterface >, mixed[]>>
34+ * @var array<class-string<ConfigurableRectorInterface >, mixed[]>>
3535 */
3636 private array $ ruleConfigurations = [];
3737
@@ -418,4 +418,22 @@ public function reportingRealPath(bool $absolute = true): void
418418 {
419419 SimpleParameterProvider::setParameter (Option::ABSOLUTE_FILE_PATH , $ absolute );
420420 }
421+
422+ /**
423+ * @internal Used only for bridge
424+ * @return array<class-string<ConfigurableRectorInterface>, mixed>
425+ */
426+ public function getRuleConfigurations (): array
427+ {
428+ return $ this ->ruleConfigurations ;
429+ }
430+
431+ /**
432+ * @internal Used only for bridge
433+ * @return array<class-string<RectorInterface>>
434+ */
435+ public function getRectorClasses (): array
436+ {
437+ return $ this ->tags [RectorInterface::class] ?? [];
438+ }
421439}
Original file line number Diff line number Diff line change @@ -16,18 +16,20 @@ final class LevelRulesResolver
1616 */
1717 public static function resolve (int $ level , array $ availableRules , string $ methodName ): array
1818 {
19+ // level < 0 is not allowed
20+ Assert::natural ($ level , sprintf ('Level must be >= 0 on %s ' , $ methodName ));
21+
22+ Assert::allIsAOf ($ availableRules , RectorInterface::class);
23+
1924 $ rulesCount = count ($ availableRules );
2025
2126 if ($ availableRules === []) {
2227 throw new ShouldNotHappenException (sprintf (
23- 'There is no available rules in %s , define the available rules first ' ,
28+ 'There are no available rules in "%s()" , define the available rules first ' ,
2429 $ methodName
2530 ));
2631 }
2732
28- // level < 0 is not allowed
29- Assert::natural ($ level , sprintf ('Level must be >= 0 on %s ' , $ methodName ));
30-
3133 // start with 0
3234 $ maxLevel = $ rulesCount - 1 ;
3335 if ($ level > $ maxLevel ) {
You can’t perform that action at this time.
0 commit comments