geocoder-php/GeocoderLaravel

Return value of Geocoder\Laravel\ProviderAndDumperAggregator::get() must be an instance of Illuminate\Support\Collection, instance of Geocoder\Model\AddressCollection returned

iredmedia opened this issue · 3 comments

General Information

GeocoderLaravel Version: "toin0u/geocoder-laravel": "4.0",
Laravel Version: "laravel/framework": "5.5.*",
PHP Version: "php": "~7.1.0",
Operating System and Version: OSX 10.14

Issue Description

I'm getting what seems to be intermittent errors on geocoding, and I cannot figure out why.

Return value of Geocoder\Laravel\ProviderAndDumperAggregator::get() must be an instance of Illuminate\Support\Collection, instance of Geocoder\Model\AddressCollection returned

    'providers' => [
        Chain::class => [
            GoogleMaps::class => [
                env('GOOGLE_MAPS_LOCALE', 'en-US'),
                env('GOOGLE_MAPS_API_KEY'),
            ],
            BingMaps::class => [
                env('BING_MAPS_API_KEY'),
                'us',
            ],
            Ipstack::class  => [
                env('IPSTACK_API_KEY'),
            ],
        ],
        GoogleMaps::class => [
            env('GOOGLE_MAPS_LOCALE', 'en-US'),
            env('GOOGLE_MAPS_API_KEY'),
        ],
        BingMaps::class => [
            env('BING_MAPS_API_KEY'),
            'us',
        ],
        Ipstack::class  => [
            env('IPSTACK_API_KEY'),
        ],
    ],

Steps to Replicate

I cannot replicate it locally, it's only happening on my server it seems.

Stack Trace

Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Return value of Geocoder\Laravel\ProviderAndDumperAggregator::get() must be an instance of Illuminate\Support\Collection, instance of Geocoder\Model\AddressCollection returned
#69 /vendor/toin0u/geocoder-laravel/src/ProviderAndDumperAggregator.php(50): Geocoder\Laravel\ProviderAndDumperAggregator::get
#68 /app/Helpers/GeoHelper.php(62): App\Helpers\GeoHelper::getLocationData

Thanks for reporting this, I will see if I can find out why this would be happening.

Is it possible it's because i'm defining Providers alongside the chain? I cannot see why it would ever return "Geocoder\Model\AddressCollection" :\

@iredmedia I am unable to replicate this. Can you try again with the latest release and let me know if it still is an issue.