From 74d81ac47b0e069552e866f7ebce44009ac16980 Mon Sep 17 00:00:00 2001 From: Aleksey Obukhov Date: Mon, 20 May 2024 21:36:14 +0300 Subject: [PATCH 1/2] * update guzzlehttp --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cbede2b..8ca8907 100644 --- a/composer.json +++ b/composer.json @@ -14,9 +14,9 @@ ], "require": { "php": ">=7.0", - "guzzlehttp/guzzle": "^6.3", + "guzzlehttp/guzzle": "^7.4", "psr/log": "~1.0", - "php-http/message-factory": "~1.0", + "psr/http-factory": "~1.0", "ext-dom": "*" }, "require-dev": { From c28e250da3bba3ef4dafcc41cea9d557b97e8070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9C=D0=B0=D0=B9?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=B2?= Date: Mon, 12 Jan 2026 11:43:19 +0300 Subject: [PATCH 2/2] Resolve some deprecations --- src/Grale/WebDav/StreamWrapper.php | 36 +++++++++++++----------------- src/Grale/WebDav/WebDavClient.php | 18 +++++++-------- 2 files changed, 25 insertions(+), 29 deletions(-) mode change 100644 => 100755 src/Grale/WebDav/StreamWrapper.php mode change 100644 => 100755 src/Grale/WebDav/WebDavClient.php diff --git a/src/Grale/WebDav/StreamWrapper.php b/src/Grale/WebDav/StreamWrapper.php old mode 100644 new mode 100755 index bec24ba..a1b13a0 --- a/src/Grale/WebDav/StreamWrapper.php +++ b/src/Grale/WebDav/StreamWrapper.php @@ -99,7 +99,7 @@ class StreamWrapper * @return bool Returns true on success or false on failure * @throws \RuntimeException If a stream wrapper has already been registered */ - public static function register(array $options = null, WebDavClient $client = null) + public static function register(?array $options = null, ?WebDavClient $client = null): bool { $result = true; @@ -130,7 +130,7 @@ public static function register(array $options = null, WebDavClient $client = nu /** * @return bool Returns true on success or false on failure */ - public static function unregister() + public static function unregister(): bool { $result = true; @@ -146,7 +146,7 @@ public static function unregister() /** * @return WebDavClient Returns the default WebDAV Client to use with the stream wrapper */ - public static function getDefaultClient() + public static function getDefaultClient(): WebDavClient { return new WebDavClient(); } @@ -162,9 +162,8 @@ public static function getDefaultClient() * @return bool Returns true on success or false on failure * @link http://www.php.net/manual/en/streamwrapper.stream-open.php * - * @internal */ - public function stream_open($path, $mode, $options, &$openedPath) + public function stream_open($path, $mode, $options, &$openedPath): bool { $url = null; @@ -222,7 +221,7 @@ public function stream_open($path, $mode, $options, &$openedPath) * * @internal */ - public function stream_read($bytes) + public function stream_read($bytes): string { $data = ''; @@ -242,7 +241,7 @@ public function stream_read($bytes) * * @internal */ - public function stream_write($data) + public function stream_write($data): int { $bytes = 0; @@ -262,7 +261,7 @@ public function stream_write($data) * * @internal */ - public function stream_flush() + public function stream_flush(): bool { $result = false; @@ -294,7 +293,7 @@ public function stream_flush() * * @internal */ - public function stream_eof() + public function stream_eof(): bool { return $this->stream->eof(); } @@ -305,7 +304,7 @@ public function stream_eof() * * @internal */ - public function stream_tell() + public function stream_tell(): int { return $this->stream->tell(); } @@ -332,7 +331,7 @@ public function stream_seek($offset, $whence = SEEK_SET) * * @internal */ - public function stream_lock($operation) + public function stream_lock($operation): bool { try { // We don't care about LOCK_NB @@ -406,7 +405,7 @@ public function stream_close() * * @internal */ - public function rename($old, $new) + public function rename($old, $new): bool { try { // Retrieve the context options @@ -435,7 +434,7 @@ public function rename($old, $new) * * @internal */ - public function unlink($path) + public function unlink($path): bool { try { // Retrieve the context options @@ -467,9 +466,8 @@ public function unlink($path) * @return bool Returns true on success or false on failure * @link http://www.php.net/manual/en/streamwrapper.mkdir.php * - * @internal */ - public function mkdir($path, $mode, $options) + public function mkdir($path, $mode, $options): bool { try { if ($options & STREAM_MKDIR_RECURSIVE) { @@ -504,9 +502,8 @@ public function mkdir($path, $mode, $options) * @return bool Returns true on success or false on failure * @link http://www.php.net/manual/en/streamwrapper.rmdir.php * - * @internal */ - public function rmdir($path, $options) + public function rmdir($path, $options): bool { try { // Retrieve the context options @@ -539,7 +536,7 @@ public function rmdir($path, $options) * * @internal */ - public function dir_opendir($path, $options) + public function dir_opendir($path, $options): bool { $result = true; @@ -597,7 +594,7 @@ public function dir_readdir() * * @internal */ - public function dir_rewinddir() + public function dir_rewinddir(): bool { $this->clearStatCache(); $this->iterator->rewind(); @@ -628,7 +625,6 @@ public function dir_closedir() * @return array Returns an array of file stat data * @link http://www.php.net/manual/en/streamwrapper.url-stat.php * - * @internal */ public function url_stat($path, $flags) { diff --git a/src/Grale/WebDav/WebDavClient.php b/src/Grale/WebDav/WebDavClient.php old mode 100644 new mode 100755 index d40bf20..b53eb48 --- a/src/Grale/WebDav/WebDavClient.php +++ b/src/Grale/WebDav/WebDavClient.php @@ -113,7 +113,7 @@ class WebDavClient * Configuration settings * @see setConfig */ - public function __construct($baseUrl = '', array $config = null) + public function __construct($baseUrl = '', ?array $config = null) { $this->setBaseUrl($baseUrl); $this->userAgent = $this->getDefaultUserAgent(); @@ -208,7 +208,7 @@ public function exists($uri) * * @return bool Returns true on success or false on failure */ - public function put($uri, $body = null, array $options = null) + public function put($uri, $body = null, ?array $options = null) { $headers = $options['headers'] ?? array(); if (isset($options['locktoken'])) { @@ -237,7 +237,7 @@ public function put($uri, $body = null, array $options = null) * * @return bool Returns true on success or false on failure */ - public function delete($uri, array $options = null) + public function delete($uri, ?array $options = null) { $headers = $options['headers'] ?? array(); if (isset($options['locktoken'])) { @@ -266,7 +266,7 @@ public function delete($uri, array $options = null) * * @return bool Returns true on success or false on failure */ - public function mkcol($uri, array $options = null) + public function mkcol($uri, ?array $options = null) { $headers = $options['headers'] ?? array(); if (isset($options['locktoken'])) { @@ -299,7 +299,7 @@ public function mkcol($uri, array $options = null) * * @return bool Returns true on success or false on failure */ - public function move($uri, $destination, array $options = null) + public function move($uri, $destination, ?array $options = null) { $recursive = isset($options['recursive']) ? (bool) $options['recursive'] : false; $overwrite = isset($options['overwrite']) ? (bool) $options['overwrite'] : true; @@ -347,7 +347,7 @@ public function move($uri, $destination, array $options = null) * * @todo Detect an attempt to copy a resource to itself, and throw an exception */ - public function copy($uri, $destination, array $options = null) + public function copy($uri, $destination, ?array $options = null) { $recursive = isset($options['recursive']) ? (bool) $options['recursive'] : false; $overwrite = isset($options['overwrite']) ? (bool) $options['overwrite'] : true; @@ -380,7 +380,7 @@ public function copy($uri, $destination, array $options = null) * * @return MultiStatus */ - public function propfind($uri, array $options = null) + public function propfind($uri, ?array $options = null) { $depth = isset($options['depth']) ? (int) $options['depth'] : 0; $properties = isset($options['properties']) ? $options['properties'] : array(); @@ -444,7 +444,7 @@ public function propfind($uri, array $options = null) * @throws \RuntimeException When the server returns an unexpected response. Actually, 207 (Multi-Status) responses are not supposed * to be received from server, as far as multi-resource lock requests are not supported. */ - public function createLock($uri, array $options = null) + public function createLock($uri, ?array $options = null) { $scope = isset($options['scope']) ? $options['scope'] : Lock::EXCLUSIVE; @@ -629,7 +629,7 @@ protected function resolveUrl($uri) * * @return \Psr\Http\Message\ResponseInterface Returns the created request */ - protected function createRequest($method, $uri, array $headers = null, $body = null) + protected function createRequest($method, $uri, ?array $headers = null, $body = null) { $url = $this->resolveUrl($uri); $request = new HttpRequest(