private function resolveOutputField()
    {
        if (is_null($this->outputField)) {
            $sourceFields = $this->getSourceFields();
            if (0 == count($sourceFields)) {
                $this->outputField = null;
            } else {
                foreach ($sourceFields as $sourceField) {
                    if (is_null($this->outputField)) {
                        $this->outputField = $sourceField;
                    }
                    if (!is_null($this->outputField) && !($this->outputField instanceof $sourceField)) {
                        throw new FieldError('Expression contains mixed types. You must set output_field');
                    }
                }
            }
        }
    }
private function resolveOutputField()
    {
        if (is_null($this->outputField)) {
            $sourceFields = $this->getSourceFields();
            if (0 == count($sourceFields)) {
                $this->outputField = null;
            } else {
                foreach ($sourceFields as $sourceField) {
                    if (is_null($this->outputField)) {
                        $this->outputField = $sourceField;
                    }
                    if (!is_null($this->outputField) && !($this->outputField instanceof $sourceField)) {
                        throw new FieldError('Expression contains mixed types. You must set output_field');
                    }
                }
            }
        }
    }
private function resolveOutputField ( ) { if ( is_null ( $ this -> outputField ) ) { $ sourceFields = $ this -> getSourceFields ( ) ; if ( 0 == count ( $ sourceFields ) ) { $ this -> outputField = null ; } else { foreach ( $ sourceFields as $ sourceField ) { if ( is_null ( $ this -> outputField ) ) { $ this -> outputField = $ sourceField ; } if ( ! is_null ( $ this -> outputField ) && ! ( $ this -> outputField instanceof $ sourceField ) ) { throw new FieldError ( 'Expression contains mixed types. You must set output_field' ) ; } } } } }
Attempts to infer the output type of the expression. If the output fields
of all source fields match then we
can simply infer the same type here. This isn't always correct, but it makes sense most of the time.

Consider the difference between `2 + 2` and `2 / 3`. Inferring the type
here is a convenience for the common
case.  The user should supply their own outputField with more complex computations.

If a source does not have an `_outputField` then we exclude it from this check. If all sources are `null`,
then an error will be thrown higher up the stack in the `outputField` property.

@throws FieldError
@author: Eddilbert Macharia (http://eddmash.com)<edd.cowan@gmail.com>
Attempts to infer the output type of the expression . If the output fields of all source fields match then we can simply infer the same type here . This isn t always correct but it makes sense most of the time .