mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 16:44:07 +02:00
type fixes
This commit is contained in:
parent
fdc0e3f113
commit
32b65b0bad
7 changed files with 18 additions and 16 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
||||||
run: composer install
|
run: composer install
|
||||||
- env:
|
- env:
|
||||||
BACKEND: smbclient
|
BACKEND: smbclient
|
||||||
run: php ./vendor/bin/phpstan analyse --level 2 src
|
run: php ./vendor/bin/phpstan analyse --level 5 src
|
||||||
|
|
||||||
phpunit:
|
phpunit:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
|
||||||
|
|
@ -25,27 +25,27 @@ namespace Icewind\Streams;
|
||||||
*/
|
*/
|
||||||
class CallbackWrapper extends Wrapper {
|
class CallbackWrapper extends Wrapper {
|
||||||
/**
|
/**
|
||||||
* @var callable
|
* @var callable|null
|
||||||
*/
|
*/
|
||||||
protected $readCallback;
|
protected $readCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var callable
|
* @var callable|null
|
||||||
*/
|
*/
|
||||||
protected $writeCallback;
|
protected $writeCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var callable
|
* @var callable|null
|
||||||
*/
|
*/
|
||||||
protected $closeCallback;
|
protected $closeCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var callable
|
* @var callable|null
|
||||||
*/
|
*/
|
||||||
protected $readDirCallBack;
|
protected $readDirCallBack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var callable
|
* @var callable|null
|
||||||
*/
|
*/
|
||||||
protected $preCloseCallback;
|
protected $preCloseCallback;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ interface File {
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param int $options
|
* @param int $options
|
||||||
* @param string &$opened_path
|
* @param string $opened_path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function stream_open($path, $mode, $options, &$opened_path);
|
public function stream_open($path, $mode, $options, &$opened_path);
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,12 @@ namespace Icewind\Streams;
|
||||||
abstract class HashWrapper extends Wrapper {
|
abstract class HashWrapper extends Wrapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var callable
|
* @var callable|null
|
||||||
*/
|
*/
|
||||||
private $callback;
|
private $callback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var resource
|
* @var resource|\HashContext
|
||||||
*/
|
*/
|
||||||
private $hashContext;
|
private $hashContext;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ interface Url {
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param int $options
|
* @param int $options
|
||||||
* @param string &$opened_path
|
* @param string $opened_path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function stream_open($path, $mode, $options, &$opened_path);
|
public function stream_open($path, $mode, $options, &$opened_path);
|
||||||
|
|
@ -50,7 +50,7 @@ interface Url {
|
||||||
public function rmdir($path, $options);
|
public function rmdir($path, $options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function unlink($path);
|
public function unlink($path);
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,13 @@ abstract class Wrapper extends WrapperHandler implements File, Directory {
|
||||||
public function stream_set_option($option, $arg1, $arg2) {
|
public function stream_set_option($option, $arg1, $arg2) {
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case STREAM_OPTION_BLOCKING:
|
case STREAM_OPTION_BLOCKING:
|
||||||
stream_set_blocking($this->source, $arg1);
|
return stream_set_blocking($this->source, (bool)$arg1);
|
||||||
break;
|
|
||||||
case STREAM_OPTION_READ_TIMEOUT:
|
case STREAM_OPTION_READ_TIMEOUT:
|
||||||
stream_set_timeout($this->source, $arg1, $arg2);
|
return stream_set_timeout($this->source, $arg1, $arg2);
|
||||||
break;
|
|
||||||
case STREAM_OPTION_WRITE_BUFFER:
|
case STREAM_OPTION_WRITE_BUFFER:
|
||||||
stream_set_write_buffer($this->source, $arg1);
|
return stream_set_write_buffer($this->source, $arg1) === 0;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_truncate($size) {
|
public function stream_truncate($size) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
namespace Icewind\Streams;
|
namespace Icewind\Streams;
|
||||||
|
|
||||||
class WrapperHandler {
|
class WrapperHandler {
|
||||||
|
/** @var resource $context */
|
||||||
|
protected $context;
|
||||||
|
|
||||||
const NO_SOURCE_DIR = 1;
|
const NO_SOURCE_DIR = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue