taxaos / guzzle-examples

This repo has some examples how to use Guzzle 6 in a more advanced way.
MIT License
2 stars 1 forks source link

must be an instance of Taxaos\GuzzleExamples\int, integer given #2

Open surjit opened 7 years ago

surjit commented 7 years ago

Catchable fatal error: Argument 1 passed to Taxaos\GuzzleExamples\AsynchronousConcurrentPoolRetry::setConcurrency() must be an instance of Taxaos\GuzzleExamples\int, integer given, called in E:\owned\crawler.com\guzzle-6.2\AsynchronousConcurrentPoolRetry.php on line 349 and defined in E:\owned\crawler.com\guzzle-6.2\AsynchronousConcurrentPoolRetry.php on line 78

surjit commented 7 years ago

I found answer here

Type hinting in PHP only works for objects and not scalars, so PHP is expecting you be passing an object of type "int".

You can use the following as a workaround

public function setPersonId($value) {
    if (!is_int($value)) {
        // Handle error
    }
}

http://stackoverflow.com/questions/14259327/php-converting-integer-to-int-getting-error