protected function getValidationRules(array $fields)
    {
        $validations = '';

        foreach ($fields as $field) {

            $rules = $field->getValidationRule();
            $customRules = $this->extractCustomValidationRules($rules);

            if (!empty($rules)) {

                if ($field->isFile()) {
                    $rules = array_filter($rules, function ($rule) {
                        return $rule != 'required';
                    });
                }

                if (!empty($customRules) || $field->isFile()) {

                    $standardRules = array_diff($rules, $customRules);
                    $shortCustomRules = $this->extractCustomValidationShortName($customRules);

                    $wrappedRules = array_merge(Helpers::wrapItems($standardRules), $shortCustomRules);
                    $validations .= sprintf("        '%s' => [%s],\n    ", $field->name, implode(',', $wrappedRules));
                } else {
                    $validations .= sprintf("        '%s' => '%s',\n    ", $field->name, implode('|', $rules));
                }
            }
        }

        return $validations;
    }