Skip to content

Commit

Permalink
Merge pull request #3715 from nextcloud/maintenance/next
Browse files Browse the repository at this point in the history
Maintenance
  • Loading branch information
dartcafe authored Sep 28, 2024
2 parents 81aade8 + 35bb6ae commit 2676031
Show file tree
Hide file tree
Showing 55 changed files with 1,866 additions and 792 deletions.
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
require_once 'vendor/autoload.php';

use Nextcloud\CodingStandard\Config;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$config = new Config();
$config
->setParallelConfig(ParallelConfigFactory::detect())
->getFinder()
->ignoreVCSIgnored(true)
->notPath('build')
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
app_name=polls

project_dir=.
build_dir=./build
build_dir=$(project_dir)/build
build_tools_dir=$(build_dir)/tools
build_source_dir=$(build_dir)/source
appstore_build_dir=$(build_dir)/artifacts/appstore
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"optimize-autoloader": true,
"autoloader-suffix": "Polls",
"platform": {
"php": "8.0"
},
"php": "8.0"
},
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
Expand All @@ -36,7 +36,7 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"doctrine/dbal": "3.7",
"doctrine/dbal": "3.8.6",
"league/factory-muffin": "^3.0",
"league/factory-muffin-faker": "^2.0",
"nextcloud/coding-standard": "^1.0",
Expand Down
46 changes: 23 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/Controller/PublicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public function getSession(): JSONResponse {

/**
* Watch poll for updates
* @param ?int $offset only watch changes after this timestamp
* @param int|null $offset only watch changes after this timestamp
*/
#[PublicPage]
#[ShareTokenRequired]
public function watchPoll(?int $offset): JSONResponse {
public function watchPoll(int|null $offset): JSONResponse {
return $this->responseLong(fn () => [
'updates' => $this->watchService->watchUpdates($this->userSession->getShare()->getPollId(), $offset)
]);
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/WatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public function __construct(
/**
* Watch poll for updates
* @param int $pollId poll id of poll to wqatch
* @param ?int $offset only watch changes after this timestamp
* @param int|null $offset only watch changes after this timestamp
*/
#[NoAdminRequired]
#[NoCSRFRequired]
public function watchPoll(int $pollId, ?int $offset): JSONResponse {
public function watchPoll(int $pollId, int|null $offset): JSONResponse {
return $this->responseLong(fn () => ['updates' => $this->watchService->watchUpdates($pollId, $offset)]);
}
}
2 changes: 1 addition & 1 deletion lib/Dashboard/PollWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getIconClass(): string {
return 'icon-polls-dark';
}

public function getUrl(): ?string {
public function getUrl(): string|null {
return $this->urlGenerator->linkToRouteAbsolute(AppConstants::APP_ID . '.page.index');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Comment extends EntityWithUser implements JsonSerializable {
public $id = null;
protected int $pollId = 0;
protected string $userId = '';
protected ?string $comment = null;
protected string|null $comment = null;
protected int $timestamp = 0;
protected int $deleted = 0;

Expand Down
6 changes: 3 additions & 3 deletions lib/Db/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Log extends Entity implements JsonSerializable {
// schema columns
public $id = null;
protected int $pollId = 0;
protected ?string $userId = '';
protected ?string $displayName = '';
protected ?string $messageId = '';
protected string|null $userId = '';
protected string|null $displayName = '';
protected string|null $messageId = '';
protected int $created = 0;
protected int $processed = 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Option extends EntityWithUser implements JsonSerializable {
protected int $deleted = 0;

// joined columns
protected ?string $userVoteAnswer = '';
protected string|null $userVoteAnswer = '';
protected int $optionLimit = 0;
protected int $voteLimit = 0;
protected int $userCountYesVotes = 0;
Expand Down
10 changes: 5 additions & 5 deletions lib/Db/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class Poll extends EntityWithUser implements JsonSerializable {
public $id = null;
protected string $type = '';
protected string $title = '';
protected ?string $description = '';
protected ?string $owner = '';
protected string|null $description = '';
protected string|null $owner = '';
protected int $created = 0;
protected int $expire = 0;
protected int $deleted = 0;
Expand All @@ -146,15 +146,15 @@ class Poll extends EntityWithUser implements JsonSerializable {
protected int $hideBookedUp = 0;
protected int $useNo = 0;
protected int $lastInteraction = 0;
protected ?string $miscSettings = '';
protected string|null $miscSettings = '';

// joined columns
protected ?int $isCurrentUserLocked = 0;
protected int|null $isCurrentUserLocked = 0;
protected int $maxDate = 0;
protected int $minDate = 0;
protected string $userRole = self::ROLE_NONE;
protected string $shareToken = '';
protected ?string $groupShares = '';
protected string|null $groupShares = '';
protected int $countOptions = 0;

// subqueried columns
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/PollMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ protected function joinOptionsForMaxDate(IQueryBuilder &$qb, string $fromAlias):
/**
* Subquery for votes count
*/
protected function subQueryVotesCount(string $fromAlias, IParameter $currentUserId, ?IParameter $answerFilter = null): IQueryBuilder {
protected function subQueryVotesCount(string $fromAlias, IParameter $currentUserId, IParameter|null $answerFilter = null): IQueryBuilder {
$subAlias = 'user_vote_sub';

$subQuery = $this->db->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Preferences extends Entity implements JsonSerializable {
public $id = 0;
protected string $userId = '';
protected int $timestamp = 0;
protected ?string $preferences = '';
protected string|null $preferences = '';

public function __construct() {
$this->addType('timestamp', 'int');
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/PreferencesMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(IDBConnection $db) {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return Preferences
*/
public function find(?string $userId): Preferences {
public function find(string|null $userId): Preferences {
$qb = $this->db->getQueryBuilder();

$qb->select('*')
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/QBMapperWithUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class QBMapperWithUser extends QBMapper {
public function __construct(
IDBConnection $db,
string $tableName,
?string $entityClass = null
string|null $entityClass = null
) {
parent::__construct($db, $tableName, $entityClass);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Db/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ class Share extends EntityWithUser implements JsonSerializable {
protected string $type = '';
protected string $label = '';
protected string $userId = '';
protected ?string $displayName = null;
protected ?string $emailAddress = null;
protected string|null $displayName = null;
protected string|null $emailAddress = null;
protected int $invitationSent = 0;
protected int $reminderSent = 0;
protected int $locked = 0;
protected ?string $miscSettings = '';
protected string|null $miscSettings = '';
protected int $deleted = 0;

// joined columns
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/TableManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function removeOrphaned(): void {
*
* @psalm-return list<string>
*/
public function deleteAllDuplicates(?IOutput $output = null): array {
public function deleteAllDuplicates(IOutput|null $output = null): array {
$messages = [];
foreach (TableSchema::UNIQUE_INDICES as $tableName => $index) {
$count = $this->deleteDuplicates($tableName, $index['columns']);
Expand Down Expand Up @@ -346,7 +346,7 @@ public function fixVotes(): void {
}
}

public function resetLastInteraction(?int $timestamp = null): array {
public function resetLastInteraction(int|null $timestamp = null): array {
$messages = [];
$timestamp = $timestamp ?? time();
$query = $this->connection->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/UserMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getParticipants(int $pollId): array {
return $users;
}

public function getUserFromUserBase(string $userId, ?int $pollId = null): User {
public function getUserFromUserBase(string $userId, int|null $pollId = null): User {
$user = $this->userManager->get($userId);
if ($user instanceof IUser) {
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Vote extends EntityWithUser implements JsonSerializable {
protected int $deleted = 0;

// joined columns
protected ?int $optionId = null;
protected int|null $optionId = null;

public function __construct() {
$this->addType('id', 'int');
Expand Down
8 changes: 4 additions & 4 deletions lib/Event/BaseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use OCP\EventDispatcher\Event;

abstract class BaseEvent extends Event {
protected ?string $activityObjectType = null;
protected ?string $eventId = null;
protected string|null $activityObjectType = null;
protected string|null $eventId = null;
protected array $activitySubjectParams = [];
protected bool $log = true;
protected Poll $poll;
Expand Down Expand Up @@ -73,7 +73,7 @@ public function getNotification(): array {
return [];
}

public function getActivityObjectType(): ?string {
public function getActivityObjectType(): string|null {
return $this->activityObjectType;
}

Expand All @@ -84,7 +84,7 @@ public function getActivityObjectId(): int {
return $this->eventObject->getId();
}

public function getActivityType(): ?string {
public function getActivityType(): string|null {
return $this->eventId;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Exceptions/ShareAlreadyExistsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
class ShareAlreadyExistsException extends Exception {
public function __construct(
string $e = 'Share already exists',
private ?Share $existingShare = null,
private Share|null $existingShare = null,
) {
parent::__construct($e, Http::STATUS_OK);
}
public function getShare(): ?Share {
public function getShare(): Share|null {
return $this->existingShare;
}
}
Loading

0 comments on commit 2676031

Please sign in to comment.