src/Schema.php
private function parseFieldSelector(string $field): string {
        if (strlen($field) === 0) {
            return $field;
        }

        if (strpos($field, '.') !== false) {
            if (strpos($field, '/') === false) {
                trigger_error('Field selectors must be separated by "/" instead of "."', E_USER_DEPRECATED);

                $parts = explode('.', $field);
                $parts = @array_map([$this, 'parseFieldSelector'], $parts); // silence because error triggered already.

                $field = implode('/', $parts);
            }
        } elseif ($field === '[]') {
            trigger_error('Field selectors with item selector "[]" must be converted to "items".', E_USER_DEPRECATED);
            $field = 'items';
        } elseif (strpos($field, '/') === false && !in_array($field, ['items', 'additionalProperties'], true)) {
            trigger_error("Field selectors must specify full schema paths. ($field)", E_USER_DEPRECATED);
            $field = "/properties/$field";
        }

        if (strpos($field, '[]') !== false) {
            trigger_error('Field selectors with item selector "[]" must be converted to "/items".', E_USER_DEPRECATED);
            $field = str_replace('[]', '/items', $field);
        }

        return ltrim($field, '/');
    }
private function parseFieldSelector(string $field): string {
        if (strlen($field) === 0) {
            return $field;
        }

        if (strpos($field, '.') !== false) {
            if (strpos($field, '/') === false) {
                trigger_error('Field selectors must be separated by "/" instead of "."', E_USER_DEPRECATED);

                $parts = explode('.', $field);
                $parts = @array_map([$this, 'parseFieldSelector'], $parts); // silence because error triggered already.

                $field = implode('/', $parts);
            }
        } elseif ($field === '[]') {
            trigger_error('Field selectors with item selector "[]" must be converted to "items".', E_USER_DEPRECATED);
            $field = 'items';
        } elseif (strpos($field, '/') === false && !in_array($field, ['items', 'additionalProperties'], true)) {
            trigger_error("Field selectors must specify full schema paths. ($field)", E_USER_DEPRECATED);
            $field = "/properties/$field";
        }

        if (strpos($field, '[]') !== false) {
            trigger_error('Field selectors with item selector "[]" must be converted to "/items".', E_USER_DEPRECATED);
            $field = str_replace('[]', '/items', $field);
        }

        return ltrim($field, '/');
    }
private function parseFieldSelector ( string $ field ) : string { if ( strlen ( $ field ) === 0 ) { return $ field ; } if ( strpos ( $ field , '.' ) !== false ) { if ( strpos ( $ field , '/' ) === false ) { trigger_error ( 'Field selectors must be separated by "/" instead of "."' , E_USER_DEPRECATED ) ; $ parts = explode ( '.' , $ field ) ; $ parts = @ array_map ( [ $ this , 'parseFieldSelector' ] , $ parts ) ; // silence because error triggered already. $ field = implode ( '/' , $ parts ) ; } } elseif ( $ field === '[]' ) { trigger_error ( 'Field selectors with item selector "[]" must be converted to "items".' , E_USER_DEPRECATED ) ; $ field = 'items' ; } elseif ( strpos ( $ field , '/' ) === false && ! in_array ( $ field , [ 'items' , 'additionalProperties' ] , true ) ) { trigger_error ( "Field selectors must specify full schema paths. ($field)" , E_USER_DEPRECATED ) ; $ field = "/properties/$field" ; } if ( strpos ( $ field , '[]' ) !== false ) { trigger_error ( 'Field selectors with item selector "[]" must be converted to "/items".' , E_USER_DEPRECATED ) ; $ field = str_replace ( '[]' , '/items' , $ field ) ; } return ltrim ( $ field , '/' ) ; }
Parse a nested field name selector.

Field selectors should be separated by "/" characters, but may currently be separated by "." characters which
triggers a deprecated error.

@param string $field The field selector.
@return string Returns the field selector in the correct format.
Parse a nested field name selector .