Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adjust code to adhere to coding standard #47789

Merged
merged 2 commits into from
Sep 5, 2024
Merged

Conversation

miaulalala
Copy link
Contributor

  • Resolves: #

Summary

New coding standard fixes

Checklist

Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala added 3. to review Waiting for reviews ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Sep 5, 2024
@miaulalala miaulalala self-assigned this Sep 5, 2024
Signed-off-by: Anna Larch <anna@nextcloud.com>
@@ -397,8 +397,7 @@ private function doSoftValidation(): void {
}

foreach (['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute',
'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute']
as $expertSetting => $effectiveSetting) {
'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks a bit funny

$calendar = $this->caldavBackend->getCalendarByUri($this->principalInfo['uri'], $name);
if(!empty($calendar)) {
if (!empty($calendar)) {

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison Note

Operand of type array<array-key, mixed>|null contains type array<array-key, mixed>, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead.
return ['old' => null, 'new' => $newEventComponents];
}

$oldEventComponents = $old->getComponents();
if(is_array($oldEventComponents) && !empty($oldEventComponents)) {
if (is_array($oldEventComponents) && !empty($oldEventComponents)) {

Check notice

Code scanning / Psalm

RedundantConditionGivenDocblockType Note

Docblock-defined type array<array-key, mixed> for $oldEventComponents is always array<array-key, mixed>
@@ -151,7 +151,7 @@

// No changed events after all - this shouldn't happen if there is significant change yet here we are
// The scheduling status is debatable
if(empty($vEvent)) {
if (empty($vEvent)) {

Check notice

Code scanning / Psalm

DocblockTypeContradiction Note

Operand of type false is always falsy
@@ -151,7 +151,7 @@

// No changed events after all - this shouldn't happen if there is significant change yet here we are
// The scheduling status is debatable
if(empty($vEvent)) {
if (empty($vEvent)) {

Check notice

Code scanning / Psalm

DocblockTypeContradiction Note

Docblock-defined type Sabre\VObject\Component\VEvent for $vEvent is never falsy
/** @var Parameter $partstat */
$partstat = $organizer['PARTSTAT'];
if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of strcasecmp cannot be null, possibly null value provided
@@ -101,7 +101,7 @@
if (isset($component['DTSTART']) && $userStatusTimestamp !== null) {
/** @var DateTimeImmutable $dateTime */
$dateTime = $component['DTSTART'][0];
if($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {
if ($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {

Check notice

Code scanning / Psalm

RedundantConditionGivenDocblockType Note

Docblock-defined type DateTimeImmutable for $dateTime is always DateTimeImmutable
@@ -58,7 +58,7 @@
}

// Don't add share for owner
if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {
if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of strcasecmp cannot be null, possibly null value provided
@@ -83,7 +83,7 @@
}

// Don't add unshare for owner
if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {
if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of strcasecmp cannot be null, possibly null value provided
@@ -499,10 +499,10 @@
return;
}
// If there is a custom message, don't overwrite it
if(empty($status->getCustomMessage())) {
if (empty($status->getCustomMessage())) {

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison Note

Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead.
$status->setCustomMessage($predefinedMessage['message']);
}
if(empty($status->getCustomIcon())) {
if (empty($status->getCustomIcon())) {

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison Note

Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead.
@miaulalala miaulalala marked this pull request as ready for review September 5, 2024 20:01
@miaulalala miaulalala merged commit 9aafc0f into master Sep 5, 2024
180 checks passed
@miaulalala miaulalala deleted the fix/cs-fixer-errors branch September 5, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants