Skip to content
Closed
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
27 changes: 9 additions & 18 deletions lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,15 @@ protected function getParameterTypeForProperty(Entity $entity, string $property)
return IQueryBuilder::PARAM_STR;
}

switch ($types[ $property ]) {
case 'int':
case 'integer':
return IQueryBuilder::PARAM_INT;
case 'string':
return IQueryBuilder::PARAM_STR;
case 'bool':
case 'boolean':
return IQueryBuilder::PARAM_BOOL;
case 'blob':
return IQueryBuilder::PARAM_LOB;
case 'datetime':
return IQueryBuilder::PARAM_DATE;
case 'json':
return IQueryBuilder::PARAM_JSON;
}

return IQueryBuilder::PARAM_STR;
return match ($types[$property]) {
'int', 'integer' => IQueryBuilder::PARAM_INT,
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in the talk PR I think this decreases readability and since it has no advantage we shouldn't do it, so that patches in the area can be backported with less chance for conflicts.

'string' => IQueryBuilder::PARAM_STR,
'bool', 'boolean' => IQueryBuilder::PARAM_BOOL,
'blob' => IQueryBuilder::PARAM_LOB,
'datetime' => IQueryBuilder::PARAM_DATE,
'json' => IQueryBuilder::PARAM_JSON,
default => IQueryBuilder::PARAM_STR,
};
}

/**
Expand Down
25 changes: 9 additions & 16 deletions lib/public/Files/StorageNotAvailableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,14 @@ public function __construct($message = '', $code = self::STATUS_ERROR, \Exceptio
* @since 9.0.0
*/
public static function getStateCodeName($code) {
switch ($code) {
case self::STATUS_SUCCESS:
return 'ok';
case self::STATUS_ERROR:
return 'error';
case self::STATUS_INDETERMINATE:
return 'indeterminate';
case self::STATUS_UNAUTHORIZED:
return 'unauthorized';
case self::STATUS_TIMEOUT:
return 'timeout';
case self::STATUS_NETWORK_ERROR:
return 'network error';
default:
return 'unknown';
}
return match ($code) {
self::STATUS_SUCCESS => 'ok',
self::STATUS_ERROR => 'error',
self::STATUS_INDETERMINATE => 'indeterminate',
self::STATUS_UNAUTHORIZED => 'unauthorized',
self::STATUS_TIMEOUT => 'timeout',
self::STATUS_NETWORK_ERROR => 'network error',
default => 'unknown',
};
}
}