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
13 changes: 8 additions & 5 deletions lib/Activity/ActivityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ public function __construct(

/**
* Publish a new-Share Activity
*
* @param Form $form The shared form
* @param string $shareeId UserId, the form has been shared to
*/
public function publishNewShare(Form $form, string $shareeId) {
public function publishNewShare(Form $form, string $shareeId): void {
$event = $this->manager->generateEvent();
$event->setApp($this->appName)
->setType(ActivityConstants::TYPE_NEWSHARE)
Expand All @@ -49,10 +50,11 @@ public function publishNewShare(Form $form, string $shareeId) {

/**
* Publish a new-GroupShare Activity to each affected user
*
* @param Form $form The shared form
* @param string $groupId Group the form has been shared to
*/
public function publishNewGroupShare(Form $form, string $groupId) {
public function publishNewGroupShare(Form $form, string $groupId): void {
$affectedUsers = $this->groupManager->get($groupId)->getUsers();

foreach ($affectedUsers as $user) {
Expand All @@ -79,7 +81,7 @@ public function publishNewGroupShare(Form $form, string $groupId) {
* @param Form $form The shared form
* @param string $circleId Circle the form has been shared to
*/
public function publishNewCircleShare(Form $form, string $circleId) {
public function publishNewCircleShare(Form $form, string $circleId): void {
$users = $this->circlesService->getCircleUsers($circleId);

foreach ($users as $user) {
Expand All @@ -102,10 +104,11 @@ public function publishNewCircleShare(Form $form, string $circleId) {

/**
* Publish a new-Submission Activity
*
* @param Form $form The affected Form
* @param string $submitterID ID of the User who submitted the form. Can also be our 'anon-user-'-ID
*/
public function publishNewSubmission(Form $form, string $submitterID) {
public function publishNewSubmission(Form $form, string $submitterID): void {
$event = $this->manager->generateEvent();
$event->setApp($this->appName)
->setType(ActivityConstants::TYPE_NEWSUBMISSION)
Expand All @@ -127,7 +130,7 @@ public function publishNewSubmission(Form $form, string $submitterID) {
* @param Form $form The affected Form
* @param string $submitterID ID of the User who submitted the form. Can also be our 'anon-user-'-ID
*/
public function publishNewSharedSubmission(Form $form, int $shareType, string $shareWith, string $submitterID) {
public function publishNewSharedSubmission(Form $form, int $shareType, string $shareWith, string $submitterID): void {
$users = [];
switch ($shareType) {
case IShare::TYPE_USER:
Expand Down
4 changes: 3 additions & 1 deletion lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public function __construct(
// CORS preflight
/**
* Handle CORS options request by calling parent function
*
* @return void
*/
#[ApiRoute(verb: 'OPTIONS', url: '/api/v3/{path}', requirements: ['path' => '.+'])]
public function preflightedCors() {
Expand Down Expand Up @@ -1527,7 +1529,7 @@ public function uploadFiles(int $formId, int $questionId, string $shareHash = ''
* @param array $question
* @param string[]|array<array{uploadedFileId: string, uploadedFileName: string}> $answerArray
*/
private function storeAnswersForQuestion(Form $form, $submissionId, array $question, array $answerArray) {
private function storeAnswersForQuestion(Form $form, $submissionId, array $question, array $answerArray): void {
foreach ($answerArray as $answer) {
$answerEntity = new Answer();
$answerEntity->setSubmissionId($submissionId);
Expand Down
4 changes: 3 additions & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ protected function insertHeaderOnIos(): void {

/**
* Set CSP options to allow the page be embedded using <iframe>
*
* @return TemplateResponse
*/
protected function setEmbeddedCSP(TemplateResponse $response) {
protected function setEmbeddedCSP(TemplateResponse $response): TemplateResponse {
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameAncestorDomain('*');

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getAccess(): array {
/**
* @param FormsAccess $access
*/
public function setAccess(array $access) {
public function setAccess(array $access): void {
// No further permissions -> 0
// Permit all users, but don't show in navigation -> 1
// Permit all users and show in navigation -> 2
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getExtraSettings(): array {
/**
* @param FormsQuestionExtraSettings $extraSettings
*/
public function setExtraSettings(array $extraSettings) {
public function setExtraSettings(array $extraSettings): void {
// Remove extraSettings that are not set
foreach ($extraSettings as $key => $value) {
if ($value === false) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getPermissions(): array {
/**
* @param list<FormsPermission> $permissions
*/
public function setPermissions(array $permissions) {
public function setPermissions(array $permissions): void {
$this->setPermissionsJson(
// Make sure to only encode array values as the indices might be non consecutively so it would be encoded as a json object
json_encode($permissions)
Expand Down
3 changes: 3 additions & 0 deletions lib/Migration/Version010200Date20200323141300.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
return $schema;
}

/**
* @return void
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
Expand Down
3 changes: 3 additions & 0 deletions lib/Migration/Version020202Date20210311150843.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ public function __construct(IDBConnection $connection) {

/**
* Update old Access-Objects to be full objects containing (empty) user- and group-key.
*
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*
* @return void
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
$qb_fetch = $this->connection->getQueryBuilder();
Expand Down
5 changes: 4 additions & 1 deletion lib/Migration/Version020300Date20210406114130.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@
return null;
}

/**
* @return void
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
$qb_update = $this->connection->getQueryBuilder();

$qb_update->update('forms_v2_questions')
->set('is_required', 'mandatory');
$qb_update->execute();
$qb_update->executeStatement();

Check warning on line 61 in lib/Migration/Version020300Date20210406114130.php

View check run for this annotation

Codecov / codecov/patch

lib/Migration/Version020300Date20210406114130.php#L61

Added line #L61 was not covered by tests
}
}
2 changes: 2 additions & 0 deletions lib/Migration/Version040200Date20240219201500.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

/**
* Set all old forms to active state
*
* @return void
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
$query = $this->db->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/FormsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ private function getSharesWithUser(int $formId, string $userId): array {
* @param string $questionType the question type
* @return bool if the settings are valid
*/
public function areExtraSettingsValid(array $extraSettings, string $questionType) {
public function areExtraSettingsValid(array $extraSettings, string $questionType): bool {
if (count($extraSettings) === 0) {
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
findUnusedBaselineEntry="true"
findUnusedCode="false"
resolveFromConfigFile="true"
totallyTyped="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
Loading
Loading