add final to classes

This commit is contained in:
Robin Appelman 2025-10-25 17:51:52 +02:00
commit edc9703e6b
50 changed files with 50 additions and 49 deletions

View file

@ -6,6 +6,7 @@
xmlns="https://getpsalm.org/schema/config" xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedCode="false" findUnusedCode="false"
ensureOverrideAttribute="false"
> >
<stubs> <stubs>
<file name="tests/krb.phpstub" preloadClasses="true"/> <file name="tests/krb.phpstub" preloadClasses="true"/>

View file

@ -6,7 +6,7 @@
namespace Icewind\SMB; namespace Icewind\SMB;
class ACL { final class ACL {
const TYPE_ALLOW = 0; const TYPE_ALLOW = 0;
const TYPE_DENY = 1; const TYPE_DENY = 1;

View file

@ -8,7 +8,7 @@ namespace Icewind\SMB;
use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\Exception;
class AnonymousAuth implements IAuth { final class AnonymousAuth implements IAuth {
public function getUsername(): ?string { public function getUsername(): ?string {
return null; return null;
} }

View file

@ -6,7 +6,7 @@
namespace Icewind\SMB; namespace Icewind\SMB;
class BasicAuth implements IAuth { final class BasicAuth implements IAuth {
/** @var string */ /** @var string */
private $username; private $username;
/** @var string|null */ /** @var string|null */

View file

@ -6,7 +6,7 @@
namespace Icewind\SMB; namespace Icewind\SMB;
class Change { final class Change {
/** @var int */ /** @var int */
private $code; private $code;
/** @var string */ /** @var string */

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class AccessDeniedException extends ConnectException { final class AccessDeniedException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class AlreadyExistsException extends InvalidRequestException { final class AlreadyExistsException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class AuthenticationException extends ConnectException { final class AuthenticationException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class ConnectionAbortedException extends ConnectException { final class ConnectionAbortedException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class ConnectionException extends ConnectException { final class ConnectionException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class ConnectionRefusedException extends ConnectException { final class ConnectionRefusedException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class ConnectionResetException extends ConnectException { final class ConnectionResetException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class DependencyException extends Exception { final class DependencyException extends Exception {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class FileInUseException extends InvalidRequestException { final class FileInUseException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class ForbiddenException extends InvalidRequestException { final class ForbiddenException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class HostDownException extends ConnectException { final class HostDownException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidArgumentException extends InvalidRequestException { final class InvalidArgumentException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidHostException extends ConnectException { final class InvalidHostException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidParameterException extends InvalidRequestException { final class InvalidParameterException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidPathException extends InvalidRequestException { final class InvalidPathException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidResourceException extends Exception { final class InvalidResourceException extends Exception {
} }

View file

@ -8,5 +8,5 @@ declare(strict_types=1);
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidTicket extends Exception { final class InvalidTicket extends Exception {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class InvalidTypeException extends InvalidRequestException { final class InvalidTypeException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class NoLoginServerException extends ConnectException { final class NoLoginServerException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class NoRouteToHostException extends ConnectException { final class NoRouteToHostException extends ConnectException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class NotEmptyException extends InvalidRequestException { final class NotEmptyException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class NotFoundException extends InvalidRequestException { final class NotFoundException extends InvalidRequestException {
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class OutOfSpaceException extends InvalidRequestException { final class OutOfSpaceException extends InvalidRequestException {
} }

View file

@ -8,7 +8,7 @@ namespace Icewind\SMB\Exception;
use Throwable; use Throwable;
class RevisionMismatchException extends Exception { final class RevisionMismatchException extends Exception {
public function __construct(string $message = 'Protocol version mismatch', int $code = 0, ?Throwable $previous = null) { public function __construct(string $message = 'Protocol version mismatch', int $code = 0, ?Throwable $previous = null) {
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);
} }

View file

@ -6,5 +6,5 @@
namespace Icewind\SMB\Exception; namespace Icewind\SMB\Exception;
class TimedOutException extends ConnectException { final class TimedOutException extends ConnectException {
} }

View file

@ -15,7 +15,7 @@ use Icewind\SMB\Exception\InvalidTicket;
* *
* @deprecated Use `KerberosAuth` with `$auth->setTicket(KerberosTicket::fromEnv())` instead * @deprecated Use `KerberosAuth` with `$auth->setTicket(KerberosTicket::fromEnv())` instead
*/ */
class KerberosApacheAuth extends KerberosAuth implements IAuth { final class KerberosApacheAuth extends KerberosAuth implements IAuth {
public function getTicket(): KerberosTicket { public function getTicket(): KerberosTicket {
if ($this->ticket === null) { if ($this->ticket === null) {
$ticket = KerberosTicket::fromEnv(); $ticket = KerberosTicket::fromEnv();

View file

@ -11,7 +11,7 @@ namespace Icewind\SMB;
use Icewind\SMB\Exception\InvalidTicket; use Icewind\SMB\Exception\InvalidTicket;
use KRB5CCache; use KRB5CCache;
class KerberosTicket { final class KerberosTicket {
/** @var KRB5CCache */ /** @var KRB5CCache */
private $krb5; private $krb5;
/** @var string */ /** @var string */

View file

@ -11,7 +11,7 @@ use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\NotFoundException; use Icewind\SMB\Exception\NotFoundException;
use Icewind\SMB\IFileInfo; use Icewind\SMB\IFileInfo;
class NativeFileInfo implements IFileInfo { final class NativeFileInfo implements IFileInfo {
/** @var string */ /** @var string */
protected $path; protected $path;
/** @var string */ /** @var string */

View file

@ -11,7 +11,7 @@ use Icewind\SMB\StringBuffer;
/** /**
* Stream optimized for read only usage * Stream optimized for read only usage
*/ */
class NativeReadStream extends NativeStream { final class NativeReadStream extends NativeStream {
const CHUNK_SIZE = 1048576; // 1MB chunks const CHUNK_SIZE = 1048576; // 1MB chunks
/** @var StringBuffer */ /** @var StringBuffer */

View file

@ -15,7 +15,7 @@ use Icewind\SMB\IShare;
use Icewind\SMB\ISystem; use Icewind\SMB\ISystem;
use Icewind\SMB\ITimeZoneProvider; use Icewind\SMB\ITimeZoneProvider;
class NativeServer extends AbstractServer { final class NativeServer extends AbstractServer {
/** /**
* @var NativeState * @var NativeState
*/ */

View file

@ -22,7 +22,7 @@ use Icewind\SMB\IServer;
use Icewind\SMB\Wrapped\Server; use Icewind\SMB\Wrapped\Server;
use Icewind\SMB\Wrapped\Share; use Icewind\SMB\Wrapped\Share;
class NativeShare extends AbstractShare { final class NativeShare extends AbstractShare {
/** /**
* @var IServer $server * @var IServer $server
*/ */

View file

@ -28,7 +28,7 @@ use Icewind\SMB\IOptions;
/** /**
* Low level wrapper for libsmbclient-php with error handling * Low level wrapper for libsmbclient-php with error handling
*/ */
class NativeState { final class NativeState {
/** @var resource|null */ /** @var resource|null */
protected $state = null; protected $state = null;

View file

@ -11,7 +11,7 @@ use Icewind\SMB\StringBuffer;
/** /**
* Stream optimized for write only usage * Stream optimized for write only usage
*/ */
class NativeWriteStream extends NativeStream { final class NativeWriteStream extends NativeStream {
const CHUNK_SIZE = 1048576; // 1MB chunks const CHUNK_SIZE = 1048576; // 1MB chunks
/** @var StringBuffer */ /** @var StringBuffer */

View file

@ -6,7 +6,7 @@
namespace Icewind\SMB; namespace Icewind\SMB;
class Options implements IOptions { final class Options implements IOptions {
/** @var int */ /** @var int */
private $timeout = 20; private $timeout = 20;

View file

@ -10,7 +10,7 @@ use Icewind\SMB\Exception\DependencyException;
use Icewind\SMB\Native\NativeServer; use Icewind\SMB\Native\NativeServer;
use Icewind\SMB\Wrapped\Server; use Icewind\SMB\Wrapped\Server;
class ServerFactory { final class ServerFactory {
const BACKENDS = [ const BACKENDS = [
NativeServer::class, NativeServer::class,
Server::class Server::class

View file

@ -8,7 +8,7 @@ declare(strict_types=1);
namespace Icewind\SMB; namespace Icewind\SMB;
class StringBuffer { final class StringBuffer {
/** @var string */ /** @var string */
private $buffer = ""; private $buffer = "";
/** @var int */ /** @var int */

View file

@ -8,7 +8,7 @@ namespace Icewind\SMB;
use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\Exception;
class System implements ISystem { final class System implements ISystem {
/** @var (string|null)[] */ /** @var (string|null)[] */
private $paths = []; private $paths = [];

View file

@ -5,7 +5,7 @@
*/ */
namespace Icewind\SMB; namespace Icewind\SMB;
class TimeZoneProvider implements ITimeZoneProvider { final class TimeZoneProvider implements ITimeZoneProvider {
/** /**
* @var string[] * @var string[]
*/ */

View file

@ -14,7 +14,7 @@ use Icewind\SMB\Exception\ConnectionRefusedException;
use Icewind\SMB\Exception\InvalidHostException; use Icewind\SMB\Exception\InvalidHostException;
use Icewind\SMB\Exception\NoLoginServerException; use Icewind\SMB\Exception\NoLoginServerException;
class Connection extends RawConnection { final class Connection extends RawConnection {
const DELIMITER = 'smb:'; const DELIMITER = 'smb:';
const DELIMITER_LENGTH = 4; const DELIMITER_LENGTH = 4;

View file

@ -6,7 +6,7 @@
namespace Icewind\SMB\Wrapped; namespace Icewind\SMB\Wrapped;
class ErrorCodes { final class ErrorCodes {
/** /**
* connection errors * connection errors
*/ */

View file

@ -9,7 +9,7 @@ namespace Icewind\SMB\Wrapped;
use Icewind\SMB\ACL; use Icewind\SMB\ACL;
use Icewind\SMB\IFileInfo; use Icewind\SMB\IFileInfo;
class FileInfo implements IFileInfo { final class FileInfo implements IFileInfo {
/** @var string */ /** @var string */
protected $path; protected $path;
/** @var string */ /** @var string */

View file

@ -11,7 +11,7 @@ use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\RevisionMismatchException; use Icewind\SMB\Exception\RevisionMismatchException;
use Icewind\SMB\INotifyHandler; use Icewind\SMB\INotifyHandler;
class NotifyHandler implements INotifyHandler { final class NotifyHandler implements INotifyHandler {
/** @var Connection */ /** @var Connection */
private $connection; private $connection;

View file

@ -20,7 +20,7 @@ use Icewind\SMB\Exception\NoLoginServerException;
use Icewind\SMB\Exception\NotEmptyException; use Icewind\SMB\Exception\NotEmptyException;
use Icewind\SMB\Exception\NotFoundException; use Icewind\SMB\Exception\NotFoundException;
class Parser { final class Parser {
const MSG_NOT_FOUND = 'Error opening local file '; const MSG_NOT_FOUND = 'Error opening local file ';
/** /**

View file

@ -16,7 +16,7 @@ use Icewind\SMB\Exception\InvalidHostException;
use Icewind\SMB\IShare; use Icewind\SMB\IShare;
use Icewind\SMB\ISystem; use Icewind\SMB\ISystem;
class Server extends AbstractServer { final class Server extends AbstractServer {
/** /**
* Check if the smbclient php extension is available * Check if the smbclient php extension is available
* *

View file

@ -27,7 +27,7 @@ use Icewind\Streams\CallbackWrapper;
use Icewind\SMB\Native\NativeShare; use Icewind\SMB\Native\NativeShare;
use Icewind\SMB\Native\NativeServer; use Icewind\SMB\Native\NativeServer;
class Share extends AbstractShare { final class Share extends AbstractShare {
/** /**
* @var IServer $server * @var IServer $server
*/ */