minor type improvements

This commit is contained in:
Robin Appelman 2021-03-10 15:00:37 +01:00
commit b5c6921f2e
6 changed files with 17 additions and 17 deletions

View file

@ -33,7 +33,7 @@ jobs:
run: composer install run: composer install
- env: - env:
BACKEND: smbclient BACKEND: smbclient
run: php ./vendor/bin/phpstan analyse --level 5 src run: php ./vendor/bin/phpstan analyse --level 6 src
phpunit: phpunit:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04

View file

@ -33,8 +33,11 @@ class ACL {
const FLAG_OBJECT_INHERIT = 0x1; const FLAG_OBJECT_INHERIT = 0x1;
const FLAG_CONTAINER_INHERIT = 0x2; const FLAG_CONTAINER_INHERIT = 0x2;
/** @var int */
private $type; private $type;
/** @var int */
private $flags; private $flags;
/** @var int */
private $mask; private $mask;
public function __construct(int $type, int $flags, int $mask) { public function __construct(int $type, int $flags, int $mask) {

View file

@ -24,24 +24,16 @@ namespace Icewind\SMB;
abstract class AbstractServer implements IServer { abstract class AbstractServer implements IServer {
const LOCALE = 'en_US.UTF-8'; const LOCALE = 'en_US.UTF-8';
/** /** @var string */
* @var string $host
*/
protected $host; protected $host;
/** /** @var IAuth */
* @var IAuth $user
*/
protected $auth; protected $auth;
/** /** @var ISystem */
* @var ISystem
*/
protected $system; protected $system;
/** /** @var ITimeZoneProvider */
* @var ITimeZoneProvider
*/
protected $timezoneProvider; protected $timezoneProvider;
/** @var IOptions */ /** @var IOptions */

View file

@ -9,7 +9,9 @@
namespace Icewind\SMB; namespace Icewind\SMB;
class Change { class Change {
/** @var int */
private $code; private $code;
/** @var string */
private $path; private $path;
public function __construct(int $code, string $path) { public function __construct(int $code, string $path) {

View file

@ -206,10 +206,10 @@ class NativeState {
/** /**
* @param string $uri * @param string $uri
* @return array * @return array{"mtime": int, "size": int, "mode": int}
*/ */
public function stat(string $uri): array { public function stat(string $uri): array {
/** @var array $result */ /** @var array{"mtime": int, "size": int, "mode": int} $result */
$result = @smbclient_stat($this->state, $uri); $result = @smbclient_stat($this->state, $uri);
$this->testResult($result, $uri); $this->testResult($result, $uri);
@ -219,10 +219,10 @@ class NativeState {
/** /**
* @param resource $file * @param resource $file
* @param string $path * @param string $path
* @return array * @return array{"mtime": int, "size": int, "mode": int}
*/ */
public function fstat($file, string $path): array { public function fstat($file, string $path): array {
/** @var array $result */ /** @var array{"mtime": int, "size": int, "mode": int} $result */
$result = @smbclient_fstat($this->state, $file); $result = @smbclient_fstat($this->state, $file);
$this->testResult($result, $path); $this->testResult($result, $path);

View file

@ -122,6 +122,9 @@ abstract class NativeStream implements File {
} }
} }
/**
* @return array{"mtime": int, "size": int, "mode": int}|false
*/
public function stream_stat() { public function stream_stat() {
try { try {
return $this->state->stat($this->url); return $this->state->stat($this->url);