GoogleAPI deprecated Return types

167 views Asked by At

I recently updated PHP to version 8.1 on one of my systems. I have also updated Composer version 2.6.5 2023-10-06 10:11:52, using 'composer update' command (see output:)

> composer update 
Loading composer repositories with package information
Updating dependencies
Lock file operations: 18 installs, 0 updates, 0 removals
  - Locking firebase/php-jwt (v6.9.0)
  - Locking google/apiclient (v2.15.1)
  - Locking google/apiclient-services (v0.323.0)
  - Locking google/auth (v1.32.1)
  - Locking guzzlehttp/guzzle (7.8.0)
  - Locking guzzlehttp/promises (2.0.1)
  - Locking guzzlehttp/psr7 (2.6.1)
  - Locking monolog/monolog (3.5.0)
  - Locking paragonie/constant_time_encoding (v2.6.3)
  - Locking paragonie/random_compat (v9.99.100)
  - Locking phpseclib/phpseclib (3.0.33)
  - Locking psr/cache (3.0.0)
  - Locking psr/http-client (1.0.3)
  - Locking psr/http-factory (1.0.2)
  - Locking psr/http-message (2.0)
  - Locking psr/log (3.0.0)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking symfony/deprecation-contracts (v3.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 18 installs, 0 updates, 0 removals
  - Downloading paragonie/random_compat (v9.99.100)
  - Downloading paragonie/constant_time_encoding (v2.6.3)
  - Downloading phpseclib/phpseclib (3.0.33)
  - Downloading psr/log (3.0.0)
  - Downloading monolog/monolog (3.5.0)
  - Downloading ralouphie/getallheaders (3.0.3)
  - Downloading psr/http-message (2.0)
  - Downloading psr/http-factory (1.0.2)
  - Downloading guzzlehttp/psr7 (2.6.1)
  - Downloading symfony/deprecation-contracts (v3.3.0)
  - Downloading psr/http-client (1.0.3)
  - Downloading guzzlehttp/promises (2.0.1)
  - Downloading guzzlehttp/guzzle (7.8.0)
  - Downloading psr/cache (3.0.0)
  - Downloading firebase/php-jwt (v6.9.0)
  - Downloading google/auth (v1.32.1)
  - Downloading google/apiclient-services (v0.323.0)
  - Downloading google/apiclient (v2.15.1)
  - Installing paragonie/random_compat (v9.99.100): Extracting archive
  - Installing paragonie/constant_time_encoding (v2.6.3): Extracting archive
  - Installing phpseclib/phpseclib (3.0.33): Extracting archive
  - Installing psr/log (3.0.0): Extracting archive
  - Installing monolog/monolog (3.5.0): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-message (2.0): Extracting archive
  - Installing psr/http-factory (1.0.2): Extracting archive
  - Installing guzzlehttp/psr7 (2.6.1): Extracting archive
  - Installing symfony/deprecation-contracts (v3.3.0): Extracting archive
  - Installing psr/http-client (1.0.3): Extracting archive
  - Installing guzzlehttp/promises (2.0.1): Extracting archive
  - Installing guzzlehttp/guzzle (7.8.0): Extracting archive
  - Installing psr/cache (3.0.0): Extracting archive
  - Installing firebase/php-jwt (v6.9.0): Extracting archive
  - Installing google/auth (v1.32.1): Extracting archive
  - Installing google/apiclient-services (v0.323.0): Extracting archive
  - Installing google/apiclient (v2.15.1): Extracting archive
16 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload file

Now I'm getting a lot of errors like:

Deprecated: Optional parameter $parentId declared before required parameter $filesAfterDate is implicitly treated as a required parameter in /Volumes/Satechi.SSD.M2/www/htdocs/gdrive/catchupSongBook on line 277
Deprecated: Return type of Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Model.php on line 256
Deprecated: Return type of Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Model.php on line 261
Deprecated: Return type of Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Model.php on line 268
Deprecated: Return type of Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Model.php on line 278
Deprecated: Return type of Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Collection.php on line 22
Deprecated: Return type of Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Collection.php on line 38
Deprecated: Return type of Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Collection.php on line 30
Deprecated: Return type of Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Collection.php on line 43
Deprecated: Return type of Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Collection.php on line 14
Deprecated: Return type of Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Volumes/Satechi.SSD.M2/www/cgi-bin/GoogleRelated/vendor/google/apiclient/src/Collection.php on line 49

This is running version 8.1.25 on a MacOS 14 system.

I have another system running Ubuntu 22.04 LTS and PHP PHP 8.1.2-1ubuntu2.14 where this is not happening.

What steps must I take in order to avoid these warnings?

1

There are 1 answers

1
Linda Lawton - DaImTo On BEST ANSWER

Some third party libraries aren't compatible with the new version of PHP your going to have to wait for them to fix it or downgrade PHP.

Its not the first time 2121