diff --git a/src/Test/TestParser.php b/src/Test/TestParser.php index fdd85d36..bc4af4fa 100644 --- a/src/Test/TestParser.php +++ b/src/Test/TestParser.php @@ -50,7 +50,7 @@ private function parse(): array $object = $reflected->newInstanceWithoutConstructor(); foreach ($methods as $method) { $ruleBuilder = $object->{$method}(); - $rules[] = $ruleBuilder; + $rules[$method] = $ruleBuilder; } } @@ -58,14 +58,20 @@ private function parse(): array } /** - * @param array $ruleBuilders + * @param array $ruleBuilders * @return array */ private function buildRules(array $ruleBuilders): array { $rules = array_map( - static fn (RuleBuilder $rule): Rule => $rule(), - $ruleBuilders + static function (string $ruleName, RuleBuilder $builder): Rule { + $rule = $builder(); + $rule->ruleName = $ruleName; + + return $rule; + }, + array_keys($ruleBuilders), + array_values($ruleBuilders) ); array_walk(