mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
more type hints
This commit is contained in:
parent
767f6b3f6f
commit
e9f6d00a93
28 changed files with 343 additions and 530 deletions
|
|
@ -7,13 +7,18 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
use Icewind\SMB\Exception\AlreadyExistsException;
|
||||
use Icewind\SMB\Exception\InvalidRequestException;
|
||||
use Icewind\SMB\Exception\InvalidTypeException;
|
||||
use Icewind\SMB\Exception\NotFoundException;
|
||||
|
||||
interface IShare {
|
||||
/**
|
||||
* Get the name of the share
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* Download a remote file
|
||||
|
|
@ -22,10 +27,10 @@ interface IShare {
|
|||
* @param string $target local file
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function get($source, $target);
|
||||
public function get(string $source, string $target): bool;
|
||||
|
||||
/**
|
||||
* Upload a local file
|
||||
|
|
@ -34,10 +39,10 @@ interface IShare {
|
|||
* @param string $target remove file
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function put($source, $target);
|
||||
public function put(string $source, string $target): bool;
|
||||
|
||||
/**
|
||||
* Open a readable stream top a remote file
|
||||
|
|
@ -45,10 +50,10 @@ interface IShare {
|
|||
* @param string $source
|
||||
* @return resource a read only stream with the contents of the remote file
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function read($source);
|
||||
public function read(string $source);
|
||||
|
||||
/**
|
||||
* Open a writable stream to a remote file
|
||||
|
|
@ -57,10 +62,10 @@ interface IShare {
|
|||
* @param string $target
|
||||
* @return resource a write only stream to upload a remote file
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function write($target);
|
||||
public function write(string $target);
|
||||
|
||||
/**
|
||||
* Open a writable stream to a remote file and set the cursor to the end of the file
|
||||
|
|
@ -68,11 +73,11 @@ interface IShare {
|
|||
* @param string $target
|
||||
* @return resource a write only stream to upload a remote file
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws \Icewind\SMB\Exception\InvalidRequestException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
* @throws InvalidRequestException
|
||||
*/
|
||||
public function append($target);
|
||||
public function append(string $target);
|
||||
|
||||
/**
|
||||
* Rename a remote file
|
||||
|
|
@ -81,10 +86,10 @@ interface IShare {
|
|||
* @param string $to
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\AlreadyExistsException
|
||||
* @throws NotFoundException
|
||||
* @throws AlreadyExistsException
|
||||
*/
|
||||
public function rename($from, $to);
|
||||
public function rename(string $from, string $to): bool;
|
||||
|
||||
/**
|
||||
* Delete a file on the share
|
||||
|
|
@ -92,29 +97,29 @@ interface IShare {
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function del($path);
|
||||
public function del(string $path): bool;
|
||||
|
||||
/**
|
||||
* List the content of a remote folder
|
||||
*
|
||||
* @param string $path
|
||||
* @return \Icewind\SMB\IFileInfo[]
|
||||
* @return IFileInfo[]
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function dir($path);
|
||||
public function dir(string $path): array;
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @return \Icewind\SMB\IFileInfo
|
||||
* @return IFileInfo
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function stat($path);
|
||||
public function stat(string $path): IFileInfo;
|
||||
|
||||
/**
|
||||
* Create a folder on the share
|
||||
|
|
@ -122,10 +127,10 @@ interface IShare {
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\AlreadyExistsException
|
||||
* @throws NotFoundException
|
||||
* @throws AlreadyExistsException
|
||||
*/
|
||||
public function mkdir($path);
|
||||
public function mkdir(string $path): bool;
|
||||
|
||||
/**
|
||||
* Remove a folder on the share
|
||||
|
|
@ -133,23 +138,23 @@ interface IShare {
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
* @throws NotFoundException
|
||||
* @throws InvalidTypeException
|
||||
*/
|
||||
public function rmdir($path);
|
||||
public function rmdir(string $path): bool;
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL
|
||||
* @return mixed
|
||||
*/
|
||||
public function setMode($path, $mode);
|
||||
public function setMode(string $path, int $mode);
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @return INotifyHandler
|
||||
*/
|
||||
public function notify($path);
|
||||
public function notify(string $path);
|
||||
|
||||
/**
|
||||
* Get the IServer instance for this share
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue