diff --git a/src/AsyncAwsS3/AsyncAwsS3Adapter.php b/src/AsyncAwsS3/AsyncAwsS3Adapter.php index 12b200b70..7cd1c1757 100644 --- a/src/AsyncAwsS3/AsyncAwsS3Adapter.php +++ b/src/AsyncAwsS3/AsyncAwsS3Adapter.php @@ -112,8 +112,8 @@ public function __construct( array $metadataFields = self::EXTRA_METADATA_FIELDS, ) { $this->prefixer = new PathPrefixer($prefix); - $this->visibility = $visibility ?: new PortableVisibilityConverter(); - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->visibility = $visibility ?? new PortableVisibilityConverter(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); $this->forwardedOptions = $forwardedOptions; $this->metadataFields = $metadataFields; } @@ -315,6 +315,7 @@ public function move(string $source, string $destination, Config $config): void public function copy(string $source, string $destination, Config $config): void { try { + $visibility = $config->get(Config::OPTION_VISIBILITY); if ($visibility === null && $config->get('retain_visibility', true)) { diff --git a/src/AsyncAwsS3/S3ClientStub.php b/src/AsyncAwsS3/S3ClientStub.php index db65fa9fe..f83e7c815 100644 --- a/src/AsyncAwsS3/S3ClientStub.php +++ b/src/AsyncAwsS3/S3ClientStub.php @@ -59,7 +59,7 @@ public function __construct(SimpleS3Client $client, $configuration = []) public function throwExceptionWhenExecutingCommand(string $commandName, Exception $exception = null): void { - $this->stagedExceptions[$commandName] = $exception ?: new NetworkException(); + $this->stagedExceptions[$commandName] = $exception ?? new NetworkException(); } public function stageResultForCommand(string $commandName, Result $result): void diff --git a/src/AwsS3V3/AwsS3V3Adapter.php b/src/AwsS3V3/AwsS3V3Adapter.php index 9e35a50e8..3d8e551ac 100644 --- a/src/AwsS3V3/AwsS3V3Adapter.php +++ b/src/AwsS3V3/AwsS3V3Adapter.php @@ -108,8 +108,8 @@ public function __construct( private array $multipartUploadOptions = self::MUP_AVAILABLE_OPTIONS, ) { $this->prefixer = new PathPrefixer($prefix); - $this->visibility = $visibility ?: new PortableVisibilityConverter(); - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->visibility = $visibility ?? new PortableVisibilityConverter(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); } public function fileExists(string $path): bool @@ -397,8 +397,8 @@ private function retrievePaginatedListing(array $options): Generator $resultPaginator = $this->client->getPaginator('ListObjectsV2', $options + $this->options); foreach ($resultPaginator as $result) { - yield from ($result->get('CommonPrefixes') ?: []); - yield from ($result->get('Contents') ?: []); + yield from ($result->get('CommonPrefixes') ?? []); + yield from ($result->get('Contents') ?? []); } } diff --git a/src/AwsS3V3/S3ClientStub.php b/src/AwsS3V3/S3ClientStub.php index 82a32eeee..d056fb882 100644 --- a/src/AwsS3V3/S3ClientStub.php +++ b/src/AwsS3V3/S3ClientStub.php @@ -71,7 +71,7 @@ public function failOnNextCopy(): void public function throwExceptionWhenExecutingCommand(string $commandName, S3Exception $exception = null): void { - $this->stagedExceptions[$commandName] = $exception ?: new S3Exception($commandName, new Command($commandName)); + $this->stagedExceptions[$commandName] = $exception ?? new S3Exception($commandName, new Command($commandName)); } public function throw500ExceptionWhenExecutingCommand(string $commandName): void diff --git a/src/Filesystem.php b/src/Filesystem.php index 0a8ef09ba..1a7cd93f8 100644 --- a/src/Filesystem.php +++ b/src/Filesystem.php @@ -29,7 +29,7 @@ public function __construct( private ?TemporaryUrlGenerator $temporaryUrlGenerator = null, ) { $this->config = new Config($config); - $this->pathNormalizer = $pathNormalizer ?: new WhitespacePathNormalizer(); + $this->pathNormalizer = $pathNormalizer ?? new WhitespacePathNormalizer(); } public function fileExists(string $location): bool @@ -183,7 +183,7 @@ public function visibility(string $path): string public function publicUrl(string $path, array $config = []): string { $this->publicUrlGenerator ??= $this->resolvePublicUrlGenerator() - ?: throw UnableToGeneratePublicUrl::noGeneratorConfigured($path); + ?? throw UnableToGeneratePublicUrl::noGeneratorConfigured($path); $config = $this->config->extend($config); return $this->publicUrlGenerator->publicUrl($path, $config); @@ -191,7 +191,7 @@ public function publicUrl(string $path, array $config = []): string public function temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []): string { - $generator = $this->temporaryUrlGenerator ?: $this->adapter; + $generator = $this->temporaryUrlGenerator ?? $this->adapter; if ($generator instanceof TemporaryUrlGenerator) { return $generator->temporaryUrl($path, $expiresAt, $this->config->extend($config)); diff --git a/src/Ftp/FtpAdapter.php b/src/Ftp/FtpAdapter.php index 4b63d4eab..61218af34 100644 --- a/src/Ftp/FtpAdapter.php +++ b/src/Ftp/FtpAdapter.php @@ -62,10 +62,10 @@ public function __construct( private bool $detectMimeTypeUsingPath = false, ) { $this->systemType = $this->connectionOptions->systemType(); - $this->connectionProvider = $connectionProvider ?: new FtpConnectionProvider(); - $this->connectivityChecker = $connectivityChecker ?: new NoopCommandConnectivityChecker(); - $this->visibilityConverter = $visibilityConverter ?: new PortableVisibilityConverter(); - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->connectionProvider = $connectionProvider ?? new FtpConnectionProvider(); + $this->connectivityChecker = $connectivityChecker ?? new NoopCommandConnectivityChecker(); + $this->visibilityConverter = $visibilityConverter ?? new PortableVisibilityConverter(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); $this->useRawListOptions = $connectionOptions->useRawListOptions(); } diff --git a/src/GoogleCloudStorage/GoogleCloudStorageAdapter.php b/src/GoogleCloudStorage/GoogleCloudStorageAdapter.php index f152fbc92..f08f39e78 100644 --- a/src/GoogleCloudStorage/GoogleCloudStorageAdapter.php +++ b/src/GoogleCloudStorage/GoogleCloudStorageAdapter.php @@ -64,8 +64,8 @@ public function __construct( MimeTypeDetector $mimeTypeDetector = null ) { $this->prefixer = new PathPrefixer($prefix); - $this->visibilityHandler = $visibilityHandler ?: new PortableVisibilityHandler(); - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->visibilityHandler = $visibilityHandler ?? new PortableVisibilityHandler(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); } public function publicUrl(string $path, Config $config): string diff --git a/src/GoogleCloudStorage/StubRiggedBucket.php b/src/GoogleCloudStorage/StubRiggedBucket.php index 794f89a76..efa41f31d 100644 --- a/src/GoogleCloudStorage/StubRiggedBucket.php +++ b/src/GoogleCloudStorage/StubRiggedBucket.php @@ -38,7 +38,7 @@ public function upload($data, array $options = []) private function setupTrigger(string $method, string $name, ?Throwable $throwable): void { - $this->triggers[$method][$name] = $throwable ?: new LogicException('unknown error'); + $this->triggers[$method][$name] = $throwable ?? new LogicException('unknown error'); } private function pushTrigger(string $method, string $name): void diff --git a/src/InMemory/InMemoryFile.php b/src/InMemory/InMemoryFile.php index f9d90ac5a..7891d8da4 100644 --- a/src/InMemory/InMemoryFile.php +++ b/src/InMemory/InMemoryFile.php @@ -19,7 +19,7 @@ class InMemoryFile public function updateContents(string $contents, ?int $timestamp): void { $this->contents = $contents; - $this->lastModified = $timestamp ?: time(); + $this->lastModified = $timestamp ?? time(); } public function lastModified(): int diff --git a/src/InMemory/InMemoryFilesystemAdapter.php b/src/InMemory/InMemoryFilesystemAdapter.php index 3dddd315c..0bccacc5e 100644 --- a/src/InMemory/InMemoryFilesystemAdapter.php +++ b/src/InMemory/InMemoryFilesystemAdapter.php @@ -35,7 +35,7 @@ public function __construct( private string $defaultVisibility = Visibility::PUBLIC, MimeTypeDetector $mimeTypeDetector = null ) { - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); } public function fileExists(string $path): bool diff --git a/src/Local/LocalFilesystemAdapter.php b/src/Local/LocalFilesystemAdapter.php index 60b898554..43f5179e5 100644 --- a/src/Local/LocalFilesystemAdapter.php +++ b/src/Local/LocalFilesystemAdapter.php @@ -81,7 +81,7 @@ public function __construct( $visibility ??= new PortableVisibilityConverter(); $this->visibility = $visibility; $this->rootLocation = $location; - $this->mimeTypeDetector = $mimeTypeDetector ?: new FallbackMimeTypeDetector(new FinfoMimeTypeDetector()); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FallbackMimeTypeDetector(new FinfoMimeTypeDetector()); if ( ! $lazyRootCreation) { $this->ensureRootDirectoryExists(); diff --git a/src/PhpseclibV2/SftpAdapter.php b/src/PhpseclibV2/SftpAdapter.php index dc7336fd1..a9560f843 100644 --- a/src/PhpseclibV2/SftpAdapter.php +++ b/src/PhpseclibV2/SftpAdapter.php @@ -63,8 +63,8 @@ public function __construct( ) { $this->connectionProvider = $connectionProvider; $this->prefixer = new PathPrefixer($root); - $this->visibilityConverter = $visibilityConverter ?: new PortableVisibilityConverter(); - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->visibilityConverter = $visibilityConverter ?? new PortableVisibilityConverter(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); } public function fileExists(string $path): bool diff --git a/src/PhpseclibV2/SftpConnectionProvider.php b/src/PhpseclibV2/SftpConnectionProvider.php index 136b76541..b1b793d79 100644 --- a/src/PhpseclibV2/SftpConnectionProvider.php +++ b/src/PhpseclibV2/SftpConnectionProvider.php @@ -97,7 +97,7 @@ public function __construct( $this->port = $port; $this->timeout = $timeout; $this->hostFingerprint = $hostFingerprint; - $this->connectivityChecker = $connectivityChecker ?: new SimpleConnectivityChecker(); + $this->connectivityChecker = $connectivityChecker ?? new SimpleConnectivityChecker(); $this->maxTries = $maxTries; } diff --git a/src/PhpseclibV3/SftpAdapter.php b/src/PhpseclibV3/SftpAdapter.php index 301a1bfb8..128f0eaa3 100644 --- a/src/PhpseclibV3/SftpAdapter.php +++ b/src/PhpseclibV3/SftpAdapter.php @@ -43,8 +43,8 @@ public function __construct( private bool $detectMimeTypeUsingPath = false, ) { $this->prefixer = new PathPrefixer($root); - $this->visibilityConverter = $visibilityConverter ?: new PortableVisibilityConverter(); - $this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector(); + $this->visibilityConverter = $visibilityConverter ?? new PortableVisibilityConverter(); + $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); } public function fileExists(string $path): bool diff --git a/src/PhpseclibV3/SftpConnectionProvider.php b/src/PhpseclibV3/SftpConnectionProvider.php index dc52c7fe7..86ee17269 100644 --- a/src/PhpseclibV3/SftpConnectionProvider.php +++ b/src/PhpseclibV3/SftpConnectionProvider.php @@ -44,7 +44,7 @@ public function __construct( private array $preferredAlgorithms = [], private bool $disableStatCache = true, ) { - $this->connectivityChecker = $connectivityChecker ?: new SimpleConnectivityChecker(); + $this->connectivityChecker = $connectivityChecker ?? new SimpleConnectivityChecker(); } public function provideConnection(): SFTP