Skip to content

Commit 82429a7

Browse files
committed
feat: run rector with new rules
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 41a231e commit 82429a7

42 files changed

Lines changed: 61 additions & 56 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/dav/appinfo/v1/publicwebdav.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use OCP\L10N\IFactory as IL10nFactory;
3535
use OCP\Security\Bruteforce\IThrottler;
3636
use OCP\Server;
37+
use OCP\Share\IShare;
3738
use Psr\Log\LoggerInterface;
3839

3940
// load needed apps
@@ -132,7 +133,7 @@ function (\Sabre\DAV\Server $server) use (
132133
Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
133134

134135
$rootFolder = Server::get(IRootFolder::class);
135-
$userId = $share->getShareType() === \OCP\Share\IShare::TYPE_REMOTE
136+
$userId = $share->getShareType() === IShare::TYPE_REMOTE
136137
? $share->getShareOwner()
137138
: $share->getSharedBy();
138139
$userFolder = $rootFolder->getUserFolder($userId);

‎apps/dav/lib/CalDAV/CalDavBackend.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ public function calendarSearch($principalUri, array $filters, $limit = null, $of
21662166
$result = [];
21672167
while ($row = $stmt->fetchAssociative()) {
21682168
$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
2169-
if (!in_array($path, $result)) {
2169+
if (!in_array($path, $result, true)) {
21702170
$result[] = $path;
21712171
}
21722172
}

‎apps/dav/lib/CalDAV/EventReader.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function __construct(VCalendar|VEvent|array|string $input, ?string $uid =
182182
// evaluate if start date is floating
183183
// set duration to 24 hours and calculate the end date
184184
// according to the rfc any event without a end date or duration is a complete day
185-
elseif ($this->baseEventStartDateFloating == true) {
185+
elseif ($this->baseEventStartDateFloating === true) {
186186
$this->baseEventDuration = 86400;
187187
$this->baseEventEndDate = DateTimeImmutable::createFromInterface($this->baseEventStartDate)
188188
->setTimestamp($this->baseEventStartDate->getTimestamp() + $this->baseEventDuration);

‎apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function getAllEMailAddressesFromEvent(VEvent $vevent):array {
247247
}
248248

249249
$cuType = $this->getCUTypeOfAttendee($attendee);
250-
if (\in_array($cuType, ['RESOURCE', 'ROOM', 'UNKNOWN'])) {
250+
if (\in_array($cuType, ['RESOURCE', 'ROOM', 'UNKNOWN'], true)) {
251251
// Don't send emails to things
252252
continue;
253253
}

‎apps/dav/lib/Connector/Sabre/CachingTree.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function markDirty($path) {
3131
$path = trim($path, '/');
3232
foreach ($this->cache as $nodePath => $node) {
3333
$nodePath = (string)$nodePath;
34-
if ($path === '' || $nodePath == $path || str_starts_with($nodePath, $path . '/')) {
34+
if ($path === '' || $nodePath === $path || str_starts_with($nodePath, $path . '/')) {
3535
unset($this->cache[$nodePath]);
3636
}
3737
}

‎apps/dav/lib/DAV/CustomPropertiesBackend.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@ public function propFind($path, PropFind $propFind): void {
276276
}
277277

278278
private function isPropertyAllowed(string $property): bool {
279-
if (in_array($property, self::IGNORED_PROPERTIES)) {
279+
if (in_array($property, self::IGNORED_PROPERTIES, true)) {
280280
return false;
281281
}
282282
if (str_starts_with($property, '{http://owncloud.org/ns}') || str_starts_with($property, '{http://nextcloud.org/ns}')) {
283-
return in_array($property, self::ALLOWED_NC_PROPERTIES);
283+
return in_array($property, self::ALLOWED_NC_PROPERTIES, true);
284284
}
285285
return true;
286286
}
@@ -651,7 +651,7 @@ private function encodeValueForDatabase(string $path, string $name, mixed $value
651651
"Property \"$name\" has an invalid value of type " . gettype($value),
652652
);
653653
} else {
654-
if (!in_array($value::class, self::ALLOWED_SERIALIZED_CLASSES)) {
654+
if (!in_array($value::class, self::ALLOWED_SERIALIZED_CLASSES, true)) {
655655
throw new DavException(
656656
"Property \"$name\" has an invalid value of class " . $value::class,
657657
);

‎apps/dav/lib/DAV/Sharing/Backend.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function applyShareAcl(array $shares, array $acl): array {
224224
'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
225225
'protected' => true,
226226
];
227-
} elseif (in_array($this->service->getResourceType(), ['calendar','addressbook'])) {
227+
} elseif (in_array($this->service->getResourceType(), ['calendar','addressbook'], true)) {
228228
// Allow changing the properties of read only calendars,
229229
// so users can change the visibility.
230230
$acl[] = [

‎apps/dav/lib/SystemTag/SystemTagsInUseCollection.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
protected string $mediaType = '',
3333
) {
3434
$this->name = 'systemtags-assigned';
35-
if ($this->mediaType != '') {
35+
if ($this->mediaType !== '') {
3636
$this->name .= '/' . $this->mediaType;
3737
}
3838
}

‎apps/encryption/lib/Command/CleanOrphanedKeys.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9494
foreach ($orphanedKeys as $keyPath) {
9595
$output->writeln('Orphaned key found: ' . $keyPath);
9696
}
97-
if (count($orphanedKeys) == 0) {
97+
if (count($orphanedKeys) === 0) {
9898
return self::SUCCESS;
9999
}
100100
$question = new ConfirmationQuestion('Do you want to delete all orphaned keys? (y/n) ', false);
@@ -199,7 +199,7 @@ private function deleteSpecific(InputInterface $input, OutputInterface $output,
199199
return $k !== trim($path);
200200
});
201201
}
202-
if (count($orphanedKeys) == 0) {
202+
if (count($orphanedKeys) === 0) {
203203
return;
204204
}
205205
$output->writeln('Remaining orphaned keys: ');

‎apps/encryption/lib/Command/FixKeyLocation.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private function findKeysByFileName(string $basePath, string $name) {
323323
throw new \Exception('Invalid base path ' . $basePath);
324324
}
325325
while ($child = readdir($dh)) {
326-
if ($child != '..' && $child != '.') {
326+
if ($child !== '..' && $child !== '.') {
327327
$childPath = $basePath . '/' . $child;
328328

329329
// recurse if the child is not a key folder

0 commit comments

Comments
 (0)