Skip to content

Commit

Permalink
fix: ensure DateTime conversion to string
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
  • Loading branch information
solracsf authored Nov 18, 2023
1 parent be69ea9 commit b49e576
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,9 @@ public function createShare(
$share->setSharedWith($shareWith);
$share->setPermissions($permissions);
if ($expireDate !== '') {
if ($expireDate instanceof \DateTime) {

Check failure on line 783 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

TypeDoesNotContainType

apps/files_sharing/lib/Controller/ShareAPIController.php:783:9: TypeDoesNotContainType: Cannot resolve types for $expireDate - non-empty-string does not contain DateTime (see https://psalm.dev/056)

Check failure

Code scanning / Psalm

TypeDoesNotContainType Error

Cannot resolve types for $expireDate - non-empty-string does not contain DateTime
$expireDate = $expireDate->format('Y-m-d');
}
try {
$expireDate = $this->parseDate($expireDate);
$share->setExpirationDate($expireDate);
Expand All @@ -801,6 +804,9 @@ public function createShare(
$share->setSharedWith($shareWith);
$share->setPermissions($permissions);
if ($expireDate !== '') {
if ($expireDate instanceof \DateTime) {

Check failure on line 807 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

TypeDoesNotContainType

apps/files_sharing/lib/Controller/ShareAPIController.php:807:9: TypeDoesNotContainType: Cannot resolve types for $expireDate - non-empty-string does not contain DateTime (see https://psalm.dev/056)

Check failure

Code scanning / Psalm

TypeDoesNotContainType Error

Cannot resolve types for $expireDate - non-empty-string does not contain DateTime
$expireDate = $expireDate->format('Y-m-d');
}
try {
$expireDate = $this->parseDate($expireDate);
$share->setExpirationDate($expireDate);
Expand Down Expand Up @@ -845,6 +851,9 @@ public function createShare(

//Expire date
if ($expireDate !== '') {
if ($expireDate instanceof \DateTime) {
$expireDate = $expireDate->format('Y-m-d');
}
try {
$expireDate = $this->parseDate($expireDate);
$share->setExpirationDate($expireDate);
Expand Down Expand Up @@ -1384,6 +1393,9 @@ public function updateShare(
if ($expireDate === '') {
$share->setExpirationDate(null);
} elseif ($expireDate !== null) {
if ($expireDate instanceof \DateTime) {

Check failure on line 1396 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

TypeDoesNotContainType

apps/files_sharing/lib/Controller/ShareAPIController.php:1396:8: TypeDoesNotContainType: Cannot resolve types for $expireDate - non-empty-string does not contain DateTime (see https://psalm.dev/056)

Check failure

Code scanning / Psalm

TypeDoesNotContainType Error

Cannot resolve types for $expireDate - non-empty-string does not contain DateTime
$expireDate = $expireDate->format('Y-m-d');
}
try {
$expireDate = $this->parseDate($expireDate);
} catch (\Exception $e) {
Expand Down

0 comments on commit b49e576

Please sign in to comment.