protected function getPossibleObjectTypes($value): array
    {
        return array_filter($this->types, function($type) use ($value) {
            return ((class_exists($type) || interface_exists($type)) && is_a($value, $type))
                || ($type === 'string' && method_exists($value, '__toString'))
                || (in_array($type, ['object', 'array']) && $type instanceof stdClass);
        });
    }
protected function getPossibleObjectTypes($value): array
    {
        return array_filter($this->types, function($type) use ($value) {
            return ((class_exists($type) || interface_exists($type)) && is_a($value, $type))
                || ($type === 'string' && method_exists($value, '__toString'))
                || (in_array($type, ['object', 'array']) && $type instanceof stdClass);
        });
    }
protected function getPossibleObjectTypes ( $ value ) : array { return array_filter ( $ this -> types , function ( $ type ) use ( $ value ) { return ( ( class_exists ( $ type ) || interface_exists ( $ type ) ) && is_a ( $ value , $ type ) ) || ( $ type === 'string' && method_exists ( $ value , '__toString' ) ) || ( in_array ( $ type , [ 'object' , 'array' ] ) && $ type instanceof stdClass ) ; } ) ; }
Get possible types based on an object.

@return array
Get possible types based on an object .