code: public function getActiveValidators($attribute = null)
      {
          $activeAttributes = $this->activeAttributes();
          if ($attribute !== null && !in_array($attribute, $activeAttributes, true)) {
              return [];
          }
          $scenario = $this->getScenario();
          $validators = [];
          foreach ($this->getValidators() as $validator) {
              if ($attribute === null) {
                  $validatorAttributes = $validator->getValidationAttributes($activeAttributes);
                  $attributeValid = !empty($validatorAttributes);
              } else {
                  $attributeValid = in_array($attribute, $validator->getValidationAttributes($attribute), true);
              }
              if ($attributeValid && $validator->isActive($scenario)) {
                  $validators[] = $validator;
              }
          }
  
          return $validators;
      }
docs: Returns the validators applicable to the current [[scenario]].
  @param string $attribute the name of the attribute whose applicable validators should be returned.
  If this is null, the validators for ALL attributes in the model will be returned.
  @return \yii\validators\Validator[] the validators applicable to the current [[scenario]].