src/FieldHandlers/FieldHandlerFactory.php
protected static function getStubFromArray(string $fieldName, array $field) : array
    {
        // Try our best to find the field name
        if (empty($field['name']) && !empty($fieldName)) {
            $field['name'] = $fieldName;
        }

        if (empty($field['name'])) {
            throw new InvalidArgumentException("Field array is missing 'name' key");
        }
        if (empty($field['type'])) {
            throw new InvalidArgumentException("Field array is missing 'type' key");
        }

        return [
            $field['name'] => $field,
        ];
    }
protected static function getStubFromArray(string $fieldName, array $field) : array
    {
        // Try our best to find the field name
        if (empty($field['name']) && !empty($fieldName)) {
            $field['name'] = $fieldName;
        }

        if (empty($field['name'])) {
            throw new InvalidArgumentException("Field array is missing 'name' key");
        }
        if (empty($field['type'])) {
            throw new InvalidArgumentException("Field array is missing 'type' key");
        }

        return [
            $field['name'] => $field,
        ];
    }
protected static function getStubFromArray ( string $ fieldName , array $ field ) : array { // Try our best to find the field name if ( empty ( $ field [ 'name' ] ) && ! empty ( $ fieldName ) ) { $ field [ 'name' ] = $ fieldName ; } if ( empty ( $ field [ 'name' ] ) ) { throw new InvalidArgumentException ( "Field array is missing 'name' key" ) ; } if ( empty ( $ field [ 'type' ] ) ) { throw new InvalidArgumentException ( "Field array is missing 'type' key" ) ; } return [ $ field [ 'name' ] => $ field , ] ; }
Get stub fields from a field array

@throws \InvalidArgumentException when field name or type are missing
@param string $fieldName Field name
@param mixed[] $field Field array
@return mixed[] Stub fields
Get stub fields from a field array