property = $property; $this->allowed_values = $allowed_values; $this->type_key = $type_key ?? String_Prop_Type::get_key(); } protected function get_supported_properties(): array { return [ $this->property ]; } protected function do_convert( Conversion_Context $context, array $rule ): bool { $value = trim( $rule['value'] ); if ( '' === $value ) { return false; } if ( null !== $this->allowed_values && ! in_array( $value, $this->allowed_values, true ) ) { return false; } $context->set_prop( $this->property, [ '$$type' => $this->type_key, 'value' => $value, ] ); return true; } }