aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-11-03 15:27:17 +0100
committerSimon L <szaimen@e.mail.de>2023-11-03 15:27:17 +0100
commitb681cf735a29b6ae25e03813b2efe77e4fe25613 (patch)
tree66fd9891c0d4abc2c31c17f446bf080d07941388
parent531f5d1e4fcbc3e3f1801b272935affbed0acd90 (diff)
downloadnextcloud-server-b681cf735a29b6ae25e03813b2efe77e4fe25613.tar.gz
nextcloud-server-b681cf735a29b6ae25e03813b2efe77e4fe25613.zip
address review
Signed-off-by: Simon L <szaimen@e.mail.de>
-rw-r--r--build/psalm-baseline.xml7
-rw-r--r--lib/private/Preview/Generator.php8
2 files changed, 4 insertions, 11 deletions
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 8a2c728ab5b..273c7ef4709 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -3075,14 +3075,7 @@
<file src="lib/private/Preview/Generator.php">
<InvalidArgument>
<code>$maxPreviewImage</code>
- <code>$semId</code>
</InvalidArgument>
- <InvalidReturnStatement>
- <code>$sem</code>
- </InvalidReturnStatement>
- <InvalidReturnType>
- <code>false|resource</code>
- </InvalidReturnType>
<LessSpecificReturnType>
<code>null|string</code>
</LessSpecificReturnType>
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index d936f1d65ad..958f58e2a01 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -221,7 +221,7 @@ class Generator {
*
* @param int $semId
* @param int $concurrency
- * @return false|resource the semaphore on success or false on failure
+ * @return false|\SysvSemaphore the semaphore on success or false on failure
*/
public static function guardWithSemaphore(int $semId, int $concurrency) {
if (!extension_loaded('sysvsem')) {
@@ -240,11 +240,11 @@ class Generator {
/**
* Releases the semaphore acquired from {@see Generator::guardWithSemaphore()}.
*
- * @param resource|bool $semId the semaphore identifier returned by guardWithSemaphore
+ * @param false|\SysvSemaphore $semId the semaphore identifier returned by guardWithSemaphore
* @return bool
*/
- public static function unguardWithSemaphore($semId): bool {
- if ($semId === false || get_class($semId) !== 'SysvSemaphore' || !extension_loaded('sysvsem')) {
+ public static function unguardWithSemaphore(false|\SysvSemaphore $semId): bool {
+ if ($semId === false || !($semId instanceof \SysvSemaphore)) {
return false;
}
return sem_release($semId);