Skip to content

Commit

Permalink
Replace various short-ternary operators with null coalescing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
jnoordsij committed Nov 4, 2023
1 parent ded9ba3 commit a0ea95e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions AwsS3V3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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') ?? []);
}
}

Expand All @@ -416,7 +416,7 @@ public function copy(string $source, string $destination, Config $config): void
{
try {
/** @var string $visibility */
$visibility = $config->get(Config::OPTION_VISIBILITY) ?: $this->visibility($source)->visibility();
$visibility = $config->get(Config::OPTION_VISIBILITY) ?? $this->visibility($source)->visibility();
} catch (Throwable $exception) {
throw UnableToCopyFile::fromLocationTo(
$source,
Expand Down
2 changes: 1 addition & 1 deletion S3ClientStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a0ea95e

Please sign in to comment.