MCPcopy Index your code
hub / github.com/php/frankenphp / validateClass

Method validateClass

internal/extgen/validator.go:72–88  ·  view source on GitHub ↗
(class phpClass)

Source from the content-addressed store, hash-verified

70}
71
72func (v *Validator) validateClass(class phpClass) error {
73 if class.Name == "" {
74 return fmt.Errorf("class name cannot be empty")
75 }
76
77 if !classNameRegex.MatchString(class.Name) {
78 return fmt.Errorf("invalid class name: %s", class.Name)
79 }
80
81 for i, prop := range class.Properties {
82 if err := v.validateClassProperty(prop); err != nil {
83 return fmt.Errorf("property %d (%s): %w", i, prop.Name, err)
84 }
85 }
86
87 return nil
88}
89
90func (v *Validator) validateClassProperty(prop phpClassProperty) error {
91 if prop.Name == "" {

Callers 2

parseMethod · 0.95
TestValidateClassFunction · 0.95

Calls 1

validateClassPropertyMethod · 0.95

Tested by 1

TestValidateClassFunction · 0.76