Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
use OCP\Files\Template\RegisterTemplateCreatorEvent;

class Application extends App implements IBootstrap {
public const APP_NAME = 'text';
public const string APP_NAME = 'text';

public function __construct(array $params = []) {
parent::__construct(self::APP_NAME, $params);
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/AttachmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class AttachmentController extends ApiController implements ISessionAwareController {
use TSessionAwareController;
public const IMAGE_MIME_TYPES = [
public const array IMAGE_MIME_TYPES = [
'image/png',
'image/jpeg',
'image/jpg',
Expand All @@ -44,7 +44,7 @@
'image/heic',
'image/heif',
];
public const BROWSER_SUPPORTED_IMAGE_MIME_TYPES = [
public const array BROWSER_SUPPORTED_IMAGE_MIME_TYPES = [
'image/png',
'image/jpeg',
'image/jpg',
Expand Down Expand Up @@ -168,7 +168,7 @@
}
}

private function getUploadedFile(string $key): array {

Check failure on line 171 in lib/Controller/AttachmentController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidNullableReturnType

lib/Controller/AttachmentController.php:171:49: InvalidNullableReturnType: The declared return type 'array<array-key, mixed>' for OCA\Text\Controller\AttachmentController::getUploadedFile is not nullable, but 'array<array-key, mixed>|null' contains null (see https://psalm.dev/144)
$file = $this->request->getUploadedFile($key);
$error = null;
$phpFileUploadErrors = [
Expand All @@ -182,16 +182,16 @@
UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload'),
];

if (empty($file)) {

Check failure on line 185 in lib/Controller/AttachmentController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

RiskyTruthyFalsyComparison

lib/Controller/AttachmentController.php:185:7: 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. (see https://psalm.dev/356)
$error = $this->l10n->t('No file uploaded or file size exceeds maximum of %s', [Util::humanFileSize(Util::uploadLimit())]);
}
if (!empty($file) && array_key_exists('error', $file) && $file['error'] !== UPLOAD_ERR_OK) {

Check failure on line 188 in lib/Controller/AttachmentController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

RiskyTruthyFalsyComparison

lib/Controller/AttachmentController.php:188:8: 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. (see https://psalm.dev/356)
$error = $phpFileUploadErrors[$file['error']];
}
if ($error !== null) {
throw new UploadException($error);
}
return $file;

Check failure on line 194 in lib/Controller/AttachmentController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

NullableReturnStatement

lib/Controller/AttachmentController.php:194:10: NullableReturnStatement: The declared return type 'array<array-key, mixed>' for OCA\Text\Controller\AttachmentController::getUploadedFile is not nullable, but the function returns 'array<array-key, mixed>|null' (see https://psalm.dev/139)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use OCP\IRequest;

class SettingsController extends Controller {
public const ACCEPTED_KEYS = [
public const array ACCEPTED_KEYS = [
'workspace_enabled',
'is_full_width_editor'
];
Expand Down
8 changes: 4 additions & 4 deletions lib/DAV/WorkspacePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
use Sabre\DAV\ServerPlugin;

class WorkspacePlugin extends ServerPlugin {
public const WORKSPACE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace';
public const WORKSPACE_FILE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace-file';
public const WORKSPACE_PROPERTY_FLAT = '{http://nextcloud.org/ns}rich-workspace-flat';
public const WORKSPACE_FILE_PROPERTY_FLAT = '{http://nextcloud.org/ns}rich-workspace-file-flat';
public const string WORKSPACE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace';
public const string WORKSPACE_FILE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace-file';
public const string WORKSPACE_PROPERTY_FLAT = '{http://nextcloud.org/ns}rich-workspace-flat';
public const string WORKSPACE_FILE_PROPERTY_FLAT = '{http://nextcloud.org/ns}rich-workspace-file-flat';

private Server $server;

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Step.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Step extends Entity implements JsonSerializable {
* To ensure that new steps always have a larger version than those that
* used the version field, use the largest possible 32-bit integer value.
*/
public const VERSION_STORED_IN_ID = 2147483647;
public const int VERSION_STORED_IN_ID = 2147483647;

public $id = null;
protected string $data = '';
Expand Down
2 changes: 1 addition & 1 deletion lib/DirectEditing/TextDocumentCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use OCP\IL10N;

class TextDocumentCreator extends ACreateEmpty {
public const CREATOR_ID = 'textdocument';
public const string CREATOR_ID = 'textdocument';

/**
* @var IL10N
Expand Down
6 changes: 3 additions & 3 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
use OCP\Notification\UnknownNotificationException;

class Notifier implements INotifier {
public const TYPE_MENTIONED = 'mentioned';
public const SUBJECT_MENTIONED_SOURCE_USER = 'sourceUser';
public const SUBJECT_MENTIONED_TARGET_USER = 'targetUser';
public const string TYPE_MENTIONED = 'mentioned';
public const string SUBJECT_MENTIONED_SOURCE_USER = 'sourceUser';
public const string SUBJECT_MENTIONED_TARGET_USER = 'targetUser';

public function __construct(
private IFactory $factory,
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DocumentService {
/**
* Delay to wait for between autosave versions
*/
public const AUTOSAVE_MINIMUM_DELAY = 10;
public const int AUTOSAVE_MINIMUM_DELAY = 10;

private bool $saveFromText = false;

Expand Down
4 changes: 2 additions & 2 deletions lib/Service/EncodingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
namespace OCA\Text\Service;

class EncodingService {
public const COMMON_ENCODINGS = [ 'UTF-8', 'GB2312', 'GBK', 'BIG-5', 'SJIS-win', 'EUC-JP', 'Windows-1252', 'ISO-8859-15', 'ISO-8859-1', 'ASCII'];
public const array COMMON_ENCODINGS = [ 'UTF-8', 'GB2312', 'GBK', 'BIG-5', 'SJIS-win', 'EUC-JP', 'Windows-1252', 'ISO-8859-15', 'ISO-8859-1', 'ASCII'];

public const UTF_BOMs = [
public const array UTF_BOMs = [
'UTF-32BE' => "\x00\x00\xfe\xff",
'UTF-32LE' => "\xff\xfe\x00\x00",
'UTF-16BE' => "\xfe\xff",
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/InitialStateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use OCP\TaskProcessing\IManager;

class InitialStateProvider {
private const ASSISTANT_TASK_TYPES = [
private const array ASSISTANT_TASK_TYPES = [
'core:text2text',
'core:text2text:formalization',
'core:text2text:headline',
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/SessionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use OCP\Security\ISecureRandom;

class SessionService {
public const SESSION_VALID_TIME = 5 * 60;
public const int SESSION_VALID_TIME = 5 * 60;

private SessionMapper $sessionMapper;
private ISecureRandom $secureRandom;
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
class WorkspaceService {
private IL10N $l10n;

public const DEFAULT_FILENAME = 'Readme.md';
public const string DEFAULT_FILENAME = 'Readme.md';

private const SUPPORTED_STATIC_FILENAMES = [
private const array SUPPORTED_STATIC_FILENAMES = [
self::DEFAULT_FILENAME,
'README.md',
'readme.md',
Expand Down
12 changes: 6 additions & 6 deletions lib/YjsMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
*/
class YjsMessage {

public const YJS_MESSAGE_SYNC = 0;
public const YJS_MESSAGE_AWARENESS = 1;
public const YJS_MESSAGE_AWARENESS_QUERY = 3;
public const int YJS_MESSAGE_SYNC = 0;
public const int YJS_MESSAGE_AWARENESS = 1;
public const int YJS_MESSAGE_AWARENESS_QUERY = 3;

public const YJS_MESSAGE_SYNC_STEP1 = 0;
public const YJS_MESSAGE_SYNC_STEP2 = 1;
public const YJS_MESSAGE_SYNC_UPDATE = 2;
public const int YJS_MESSAGE_SYNC_STEP1 = 0;
public const int YJS_MESSAGE_SYNC_STEP2 = 1;
public const int YJS_MESSAGE_SYNC_UPDATE = 2;

private int $pos = 0;

Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
findUnusedCode="false"
phpVersion="8.2"
phpVersion="8.3"
>
<stubs>
<file name="tests/stub.php" preloadClasses="true"/>
Expand Down
Loading