Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/private/Preview/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use OCP\Preview\IVersionedPreviewFile;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use SysvSemaphore;

class Generator {
public const SEMAPHORE_ID_ALL = 0x0a11;
Expand Down Expand Up @@ -311,7 +312,7 @@ private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file,
*
* @param int $semId
* @param int $concurrency
* @return false|resource the semaphore on success or false on failure
* @return false|resource|SysvSemaphore the semaphore on success or false on failure
Copy link
Member Author

Choose a reason for hiding this comment

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

For some reasone resource still needs to be listed here because psalm gets confused otherwise

Copy link
Contributor

Choose a reason for hiding this comment

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

What is psalm saying? Most likely the stubs for this extension are not up to date with php 8, no?

*/
public static function guardWithSemaphore(int $semId, int $concurrency) {
if (!extension_loaded('sysvsem')) {
Expand All @@ -330,7 +331,7 @@ public static function guardWithSemaphore(int $semId, int $concurrency) {
/**
* Releases the semaphore acquired from {@see Generator::guardWithSemaphore()}.
*
* @param resource|bool $semId the semaphore identifier returned by guardWithSemaphore
* @param SysvSemaphore|bool $semId the semaphore identifier returned by guardWithSemaphore
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param SysvSemaphore|bool $semId the semaphore identifier returned by guardWithSemaphore
* @param SysvSemaphore|false $semId the semaphore identifier returned by guardWithSemaphore

Makes no sense to accept true, no?

* @return bool
*/
public static function unguardWithSemaphore($semId): bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to fix the call to is_resource in here, it will always be false

Expand Down