mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +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
|
||||
- env:
|
||||
BACKEND: smbclient
|
||||
run: php ./vendor/bin/phpstan analyse --level 1 src
|
||||
run: php ./vendor/bin/phpstan analyse --level 2 src
|
||||
|
||||
phpunit:
|
||||
runs-on: ubuntu-20.04
|
||||
|
|
|
|||
|
|
@ -10,31 +10,18 @@ namespace Icewind\SMB;
|
|||
|
||||
class Change {
|
||||
private $code;
|
||||
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* Change constructor.
|
||||
*
|
||||
* @param $code
|
||||
* @param $path
|
||||
*/
|
||||
public function __construct($code, $path) {
|
||||
public function __construct(string $code, int $path) {
|
||||
$this->code = $code;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getCode() {
|
||||
public function getCode(): int {
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() {
|
||||
public function getPath(): string {
|
||||
return $this->path;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ interface IShare {
|
|||
/**
|
||||
* List the content of a remote folder
|
||||
*
|
||||
* @param $path
|
||||
* @param string $path
|
||||
* @return \Icewind\SMB\IFileInfo[]
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class NativeReadStream extends NativeStream {
|
|||
/**
|
||||
* Wrap a stream from libsmbclient-php into a regular php stream
|
||||
*
|
||||
* @param \Icewind\SMB\NativeState $state
|
||||
* @param NativeState $state
|
||||
* @param resource $smbStream
|
||||
* @param string $mode
|
||||
* @param string $url
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class NativeState {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $dir
|
||||
* @param resource $dir
|
||||
* @return bool
|
||||
*/
|
||||
public function closedir($dir) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class NativeStream implements File {
|
|||
/**
|
||||
* Wrap a stream from libsmbclient-php into a regular php stream
|
||||
*
|
||||
* @param \Icewind\SMB\NativeState $state
|
||||
* @param NativeState $state
|
||||
* @param resource $smbStream
|
||||
* @param string $mode
|
||||
* @param string $url
|
||||
|
|
@ -73,6 +73,7 @@ class NativeStream implements File {
|
|||
}
|
||||
|
||||
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
|
||||
*
|
||||
* @param \Icewind\SMB\NativeState $state
|
||||
* @param NativeState $state
|
||||
* @param resource $smbStream
|
||||
* @param string $mode
|
||||
* @param string $url
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ class ServerFactory {
|
|||
|
||||
|
||||
/**
|
||||
* @param $host
|
||||
* @param string $host
|
||||
* @param IAuth $credentials
|
||||
* @return IServer
|
||||
* @throws DependencyException
|
||||
*/
|
||||
public function createServer($host, IAuth $credentials) {
|
||||
public function createServer(string $host, IAuth $credentials) {
|
||||
foreach (self::BACKENDS as $backend) {
|
||||
if (call_user_func("$backend::available", $this->system)) {
|
||||
return new $backend($host, $credentials, $this->system, $this->timeZoneProvider, $this->options);
|
||||
|
|
|
|||
|
|
@ -95,10 +95,10 @@ class Connection extends RawConnection {
|
|||
/**
|
||||
* Check
|
||||
*
|
||||
* @param $line
|
||||
* @param string $line
|
||||
* @return bool
|
||||
*/
|
||||
private function isPrompt($line) {
|
||||
private function isPrompt(string $line) {
|
||||
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
|
||||
*
|
||||
* @param $line
|
||||
* @param string $line
|
||||
* @throws AuthenticationException
|
||||
* @throws InvalidHostException
|
||||
* @throws NoLoginServerException
|
||||
* @throws AccessDeniedException
|
||||
*/
|
||||
public function checkConnectionError($line) {
|
||||
public function checkConnectionError(string $line) {
|
||||
$line = rtrim($line, ')');
|
||||
if (substr($line, -23) === ErrorCodes::LogonFailure) {
|
||||
throw new AuthenticationException('Invalid login');
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class Share extends AbstractShare {
|
|||
/**
|
||||
* List the content of a remote folder
|
||||
*
|
||||
* @param $path
|
||||
* @param string $path
|
||||
* @return \Icewind\SMB\IFileInfo[]
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue