Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
36 changes: 16 additions & 20 deletions src/Grale/WebDav/StreamWrapper.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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();
}
Expand All @@ -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;

Expand Down Expand Up @@ -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 = '';

Expand All @@ -242,7 +241,7 @@ public function stream_read($bytes)
*
* @internal
*/
public function stream_write($data)
public function stream_write($data): int
{
$bytes = 0;

Expand All @@ -262,7 +261,7 @@ public function stream_write($data)
*
* @internal
*/
public function stream_flush()
public function stream_flush(): bool
{
$result = false;

Expand Down Expand Up @@ -294,7 +293,7 @@ public function stream_flush()
*
* @internal
*/
public function stream_eof()
public function stream_eof(): bool
{
return $this->stream->eof();
}
Expand All @@ -305,7 +304,7 @@ public function stream_eof()
*
* @internal
*/
public function stream_tell()
public function stream_tell(): int
{
return $this->stream->tell();
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -435,7 +434,7 @@ public function rename($old, $new)
*
* @internal
*/
public function unlink($path)
public function unlink($path): bool
{
try {
// Retrieve the context options
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -597,7 +594,7 @@ public function dir_readdir()
*
* @internal
*/
public function dir_rewinddir()
public function dir_rewinddir(): bool
{
$this->clearStatCache();
$this->iterator->rewind();
Expand Down Expand Up @@ -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)
{
Expand Down
18 changes: 9 additions & 9 deletions src/Grale/WebDav/WebDavClient.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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(
Expand Down