GoogleAPI 已弃用返回类型

问题描述 投票:0回答:1

我最近在我的一个系统上将 PHP 更新到了 8.1 版本。我还使用“composer update”命令更新了 Composer 版本 2.6.5 2023-10-06 10:11:52(参见输出:)

> 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

现在我遇到了很多错误,例如:

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

它在 MacOS 14 系统上运行版本 8.1.25。

我有另一个运行 Ubuntu 22.04 LTS 和 PHP PHP 8.1.2-1ubuntu2.14 的系统,但没有发生这种情况。

我必须采取哪些步骤才能避免这些警告?

php google-api google-api-php-client deprecation-warning php-8.1
1个回答
0
投票

一些第三方库与新版本的 PHP 不兼容,您必须等待他们修复它或降级 PHP。

这不是第一次了2121

© www.soinside.com 2019 - 2024. All rights reserved.