original_string: public static function rule($ruleName, $arguments): RuleInterface
      {
          $ruleName = ucfirst($ruleName) . 'Rule';
  
          foreach (static::$rulesNamespaces as $ruleNamespace) {
              $ruleClass = $ruleNamespace . $ruleName;
              if (class_exists($ruleClass)) {
                  return new $ruleClass(...$arguments);
              }
          }
  
          throw new ComponentException("Class for validator `$ruleName` not found");
      }
code: public static function rule($ruleName, $arguments): RuleInterface
      {
          $ruleName = ucfirst($ruleName) . 'Rule';
  
          foreach (static::$rulesNamespaces as $ruleNamespace) {
              $ruleClass = $ruleNamespace . $ruleName;
              if (class_exists($ruleClass)) {
                  return new $ruleClass(...$arguments);
              }
          }
  
          throw new ComponentException("Class for validator `$ruleName` not found");
      }
code_tokens: public static function rule ( $ ruleName , $ arguments ) : RuleInterface { $ ruleName = ucfirst ( $ ruleName ) . 'Rule' ; foreach ( static :: $ rulesNamespaces as $ ruleNamespace ) { $ ruleClass = $ ruleNamespace . $ ruleName ; if ( class_exists ( $ ruleClass ) ) { return new $ ruleClass ( ... $ arguments ) ; } } throw new ComponentException ( "Class for validator `$ruleName` not found" ) ; }
docstring: Create new rule by name
  
  @param  string $ruleName
  @param  array  $arguments
  
  @return RuleInterface
  @throws Exception\ComponentException
docstring_tokens: Create new rule by name