mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
type hint fixes
This commit is contained in:
parent
4d09f2a55c
commit
0e69997579
11 changed files with 17 additions and 29 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
run: composer install
|
run: composer install
|
||||||
- env:
|
- env:
|
||||||
BACKEND: smbclient
|
BACKEND: smbclient
|
||||||
run: php ./vendor/bin/phpstan analyse --level 1 src
|
run: php ./vendor/bin/phpstan analyse --level 2 src
|
||||||
|
|
||||||
phpunit:
|
phpunit:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
|
||||||
|
|
@ -10,31 +10,18 @@ namespace Icewind\SMB;
|
||||||
|
|
||||||
class Change {
|
class Change {
|
||||||
private $code;
|
private $code;
|
||||||
|
|
||||||
private $path;
|
private $path;
|
||||||
|
|
||||||
/**
|
public function __construct(string $code, int $path) {
|
||||||
* Change constructor.
|
|
||||||
*
|
|
||||||
* @param $code
|
|
||||||
* @param $path
|
|
||||||
*/
|
|
||||||
public function __construct($code, $path) {
|
|
||||||
$this->code = $code;
|
$this->code = $code;
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getCode(): int {
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getCode() {
|
|
||||||
return $this->code;
|
return $this->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getPath(): string {
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPath() {
|
|
||||||
return $this->path;
|
return $this->path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ interface IShare {
|
||||||
/**
|
/**
|
||||||
* List the content of a remote folder
|
* List the content of a remote folder
|
||||||
*
|
*
|
||||||
* @param $path
|
* @param string $path
|
||||||
* @return \Icewind\SMB\IFileInfo[]
|
* @return \Icewind\SMB\IFileInfo[]
|
||||||
*
|
*
|
||||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class NativeReadStream extends NativeStream {
|
||||||
/**
|
/**
|
||||||
* Wrap a stream from libsmbclient-php into a regular php stream
|
* Wrap a stream from libsmbclient-php into a regular php stream
|
||||||
*
|
*
|
||||||
* @param \Icewind\SMB\NativeState $state
|
* @param NativeState $state
|
||||||
* @param resource $smbStream
|
* @param resource $smbStream
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param string $url
|
* @param string $url
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class NativeState {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $dir
|
* @param resource $dir
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function closedir($dir) {
|
public function closedir($dir) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class NativeStream implements File {
|
||||||
/**
|
/**
|
||||||
* Wrap a stream from libsmbclient-php into a regular php stream
|
* Wrap a stream from libsmbclient-php into a regular php stream
|
||||||
*
|
*
|
||||||
* @param \Icewind\SMB\NativeState $state
|
* @param NativeState $state
|
||||||
* @param resource $smbStream
|
* @param resource $smbStream
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param string $url
|
* @param string $url
|
||||||
|
|
@ -73,6 +73,7 @@ class NativeStream implements File {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_flush() {
|
public function stream_flush() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class NativeWriteStream extends NativeStream {
|
||||||
/**
|
/**
|
||||||
* Wrap a stream from libsmbclient-php into a regular php stream
|
* Wrap a stream from libsmbclient-php into a regular php stream
|
||||||
*
|
*
|
||||||
* @param \Icewind\SMB\NativeState $state
|
* @param NativeState $state
|
||||||
* @param resource $smbStream
|
* @param resource $smbStream
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param string $url
|
* @param string $url
|
||||||
|
|
|
||||||
|
|
@ -68,12 +68,12 @@ class ServerFactory {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $host
|
* @param string $host
|
||||||
* @param IAuth $credentials
|
* @param IAuth $credentials
|
||||||
* @return IServer
|
* @return IServer
|
||||||
* @throws DependencyException
|
* @throws DependencyException
|
||||||
*/
|
*/
|
||||||
public function createServer($host, IAuth $credentials) {
|
public function createServer(string $host, IAuth $credentials) {
|
||||||
foreach (self::BACKENDS as $backend) {
|
foreach (self::BACKENDS as $backend) {
|
||||||
if (call_user_func("$backend::available", $this->system)) {
|
if (call_user_func("$backend::available", $this->system)) {
|
||||||
return new $backend($host, $credentials, $this->system, $this->timeZoneProvider, $this->options);
|
return new $backend($host, $credentials, $this->system, $this->timeZoneProvider, $this->options);
|
||||||
|
|
|
||||||
|
|
@ -95,10 +95,10 @@ class Connection extends RawConnection {
|
||||||
/**
|
/**
|
||||||
* Check
|
* Check
|
||||||
*
|
*
|
||||||
* @param $line
|
* @param string $line
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function isPrompt($line) {
|
private function isPrompt(string $line) {
|
||||||
return mb_substr($line, 0, self::DELIMITER_LENGTH) === self::DELIMITER || $line === false;
|
return mb_substr($line, 0, self::DELIMITER_LENGTH) === self::DELIMITER || $line === false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,13 +91,13 @@ class Parser {
|
||||||
/**
|
/**
|
||||||
* check if the first line holds a connection failure
|
* check if the first line holds a connection failure
|
||||||
*
|
*
|
||||||
* @param $line
|
* @param string $line
|
||||||
* @throws AuthenticationException
|
* @throws AuthenticationException
|
||||||
* @throws InvalidHostException
|
* @throws InvalidHostException
|
||||||
* @throws NoLoginServerException
|
* @throws NoLoginServerException
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
*/
|
*/
|
||||||
public function checkConnectionError($line) {
|
public function checkConnectionError(string $line) {
|
||||||
$line = rtrim($line, ')');
|
$line = rtrim($line, ')');
|
||||||
if (substr($line, -23) === ErrorCodes::LogonFailure) {
|
if (substr($line, -23) === ErrorCodes::LogonFailure) {
|
||||||
throw new AuthenticationException('Invalid login');
|
throw new AuthenticationException('Invalid login');
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ class Share extends AbstractShare {
|
||||||
/**
|
/**
|
||||||
* List the content of a remote folder
|
* List the content of a remote folder
|
||||||
*
|
*
|
||||||
* @param $path
|
* @param string $path
|
||||||
* @return \Icewind\SMB\IFileInfo[]
|
* @return \Icewind\SMB\IFileInfo[]
|
||||||
*
|
*
|
||||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue