Skip to content

Commit

Permalink
fix: Handle null checks with the ?? operator
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Sep 15, 2024
1 parent 614f9ec commit c57e684
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/External/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function __construct(
* @throws \Doctrine\DBAL\Exception
*/
public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = '', $parent = -1) {
$user = $user ?: $this->uid;
$user = $user ?? $this->uid;
$accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING;
$name = Filesystem::normalizePath('/' . $name);

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Log/LogDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function logDetails(string $app, $message, int $level): array {
$url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--';
$method = is_string($request->getMethod()) ? $request->getMethod() : '--';
if ($this->config->getValue('installed', false)) {
$user = \OC_User::getUser() ?: '--';
$user = \OC_User::getUser() ?? '--';
} else {
$user = '--';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/User/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Database extends ABackend implements
public function __construct($eventDispatcher = null, $table = 'users') {
$this->cache = new CappedMemoryCache();
$this->table = $table;
$this->eventDispatcher = $eventDispatcher ?: \OCP\Server::get(IEventDispatcher::class);
$this->eventDispatcher = $eventDispatcher ?? \OCP\Server::get(IEventDispatcher::class);
}

/**
Expand Down

0 comments on commit c57e684

Please sign in to comment.