validateTypes checks if PHP signature contains only supported types
(fn phpFunction)
| 105 | |
| 106 | // validateTypes checks if PHP signature contains only supported types |
| 107 | func (v *Validator) validateTypes(fn phpFunction) error { |
| 108 | for i, param := range fn.Params { |
| 109 | if !slices.Contains(supportedTypes, param.PhpType) { |
| 110 | return fmt.Errorf("parameter %d %q has unsupported type %q, supported typed: string, int, float, bool, array and mixed, can be nullable", i+1, param.Name, param.PhpType) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | if fn.ReturnType != phpVoid && !slices.Contains(supportedTypes, fn.ReturnType) { |
| 115 | return fmt.Errorf("return type %q is not supported, supported typed: string, int, float, bool, array and mixed, can be nullable", fn.ReturnType) |
| 116 | } |
| 117 | |
| 118 | return nil |
| 119 | } |
| 120 | |
| 121 | // validateGoFunctionSignatureWithOptions validates with option for method vs function |
| 122 | func (v *Validator) validateGoFunctionSignatureWithOptions(phpFunc phpFunction, isMethod bool) error { |
no outgoing calls