From 76328ab02b7be1beab570cc2aa8ab16b4a625c71 Mon Sep 17 00:00:00 2001 From: jinglundong <1683035+jinglundong@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:42:05 -0800 Subject: [PATCH] Revert "Fix PHP 8 deprecation notice, remove unused dependencies, remove unrequired aliases (#94)" This reverts commit e1b8b479b2284e77550216465b03268b9e3edff7. --- composer.json | 4 +++- src/Ext/Session/MemcacheSessionHandler.php | 6 ------ src/aliases.php | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index adb13826..87438a71 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,9 @@ }, "require": { "php": ">=7.2.0", - "guzzlehttp/guzzle": "^7.2" + "guzzlehttp/streams": "^3.0", + "guzzlehttp/guzzle": "^7.2", + "composer/semver": "^3.2" }, "require-dev": { "phpunit/phpunit": "^8", diff --git a/src/Ext/Session/MemcacheSessionHandler.php b/src/Ext/Session/MemcacheSessionHandler.php index 0c0c5b72..239baaaa 100644 --- a/src/Ext/Session/MemcacheSessionHandler.php +++ b/src/Ext/Session/MemcacheSessionHandler.php @@ -63,7 +63,6 @@ public function __construct($memcacheContainer = null) { * @param string $sessionName Not ued * @return bool true if successful, false otherwise */ - #[\ReturnTypeWillChange] public function open($savePath, $sessionName) { return true; } @@ -72,7 +71,6 @@ public function open($savePath, $sessionName) { * Closes the session handler. * @return bool true if successful, false otherwise */ - #[\ReturnTypeWillChange] public function close() { return $this->memcacheContainer->close(); } @@ -82,7 +80,6 @@ public function close() { * @param string $id Session ID associated with the data to be retrieved * @return string data associated with that ID or empty string on failure */ - #[\ReturnTypeWillChange] public function read($id) { $data = $this->memcacheContainer->get(self::SESSION_PREFIX . $id); return empty($data) ? '' : $data; @@ -94,7 +91,6 @@ public function read($id) { * @param string $data Data to be stored * @return bool true if successful, false otherwise */ - #[\ReturnTypeWillChange] public function write($id, $data) { return $this->memcacheContainer->set( self::SESSION_PREFIX . $id, $data, $this->expire); @@ -105,7 +101,6 @@ public function write($id, $data) { * @param string $id Session ID associated with the data to be destroyed * @return bool true if successful, false otherwise */ - #[\ReturnTypeWillChange] public function destroy($id) { return $this->memcacheContainer->delete( self::SESSION_PREFIX . $id); @@ -117,7 +112,6 @@ public function destroy($id) { * @param int $maxlifetime Not used * @return bool true if successful, false otherwise */ - #[\ReturnTypeWillChange] public function gc($maxlifetime) { // Handled by "expire" in Memcache. return true; diff --git a/src/aliases.php b/src/aliases.php index caaa2041..b37f28d5 100644 --- a/src/aliases.php +++ b/src/aliases.php @@ -21,4 +21,20 @@ * included in the autoloader inside the composer.json. */ -@class_alias('Google\AppEngine\Api\AppIdentity\AppIdentityService', 'google\appengine\api\app_identity\AppIdentityService'); +$classMap = [ + 'Google\AppEngine\Api\AppIdentity\AppIdentityService' => 'google\appengine\api\app_identity\AppIdentityService', + 'Google\AppEngine\Api\Modules\InvalidModuleStateException' => 'google\appengine\api\modules\InvalidModuleStateException', + 'Google\AppEngine\Api\Modules\ModulesException' => 'google\appengine\api\modules\ModulesException', + 'Google\AppEngine\Api\Modules\ModulesService' => 'google\appengine\api\modules\ModulesService', + 'Google\AppEngine\Api\Modules\TransientModulesException' => 'google\appengine\api\modules\TransientModulesException', + 'Google\AppEngine\Api\TaskQueue\PushTask' => 'google\appengine\api\taskqueue\PushTask', + 'Google\AppEngine\Api\TaskQueue\PushQueue' => 'google\appengine\api\taskqueue\PushQueue', + 'Google\AppEngine\Api\Users\User' => 'google\appengine\api\users\User', + 'Google\AppEngine\Api\Users\UserService' => 'google\appengine\api\users\UserService', + 'Google\AppEngine\Api\Users\UserServiceUtil' => 'google\appengine\api\users\UserServiceUtil', + 'Google\AppEngine\Api\Users\UsersException' =>'google\appengine\api\users\UsersException' +]; + +foreach ($classMap as $class => $alias) { + @class_alias($class, $alias); +}