Skip to content

Conversation

@miaulalala
Copy link
Contributor

  • Resolves: #

Summary

New coding standard fixes

Checklist

@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 requested review from blizzz and kesselb September 5, 2024 19:25
@miaulalala miaulalala self-assigned this Sep 5, 2024
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

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

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison

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.

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

Check notice

Code scanning / Psalm

RedundantConditionGivenDocblockType

Docblock-defined type array<array-key, mixed> for $oldEventComponents is always array<array-key, mixed>
// 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

Operand of type false is always falsy
// 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

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

Argument 1 of strcasecmp cannot be null, possibly null value provided
/** @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

Docblock-defined type DateTimeImmutable for $dateTime is always DateTimeImmutable

// 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

Argument 1 of strcasecmp cannot be null, possibly null value provided

// 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

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

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison

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

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
@miaulalala miaulalala deleted the fix/cs-fixer-errors branch September 5, 2024 20:25
@skjnldsv skjnldsv mentioned this pull request Jan 7, 2025
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.

6 participants