Skip to content

Commit

Permalink
Merge pull request #1134 from nextcloud/fix/string-IQueryFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Aug 18, 2022
2 parents 1197780 + 377cecb commit bbc5723
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build/
.settings/
vendor/
.php-cs-fixer.cache
.php_cs.cache
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions lib/Db/DeprecatedCirclesRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use OCA\Circles\Service\TimezoneService;
use OCP\DB\QueryBuilder\ICompositeExpression;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use OCP\IL10N;

Expand Down Expand Up @@ -195,7 +194,7 @@ private function generateLimitSecret(IQueryBuilder $qb, $circleUniqueId, $type,
* @param IQueryBuilder $qb
* @param int $type
*
* @return IQueryFunction
* @return null|string
*/
private function generateLimitClosed(IQueryBuilder $qb, $type) {
if (!(DeprecatedCircle::CIRCLES_CLOSED & (int)$type)) {
Expand All @@ -214,7 +213,7 @@ private function generateLimitClosed(IQueryBuilder $qb, $type) {
* @param IQueryBuilder $qb
* @param int $type
*
* @return IQueryFunction
* @return null|string
*/
private function generateLimitPublic(IQueryBuilder $qb, $type) {
if (!(DeprecatedCircle::CIRCLES_PUBLIC & (int)$type)) {
Expand Down
29 changes: 14 additions & 15 deletions lib/Tools/Db/ExtendedQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
use OCA\Circles\Tools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\ICompositeExpression;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -403,7 +402,7 @@ public function lt(string $field, int $value, bool $lte = false, string $alias =
*
* @return string
*/
public function exprLike(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
public function exprLike(string $field, string $value, string $alias = '', bool $cs = true): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -416,7 +415,7 @@ public function exprLike(string $field, string $value, string $alias = '', bool
}
}

public function exprLimit(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
public function exprLimit(string $field, string $value, string $alias = '', bool $cs = true): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -434,7 +433,7 @@ public function exprLimit(string $field, string $value, string $alias = '', bool
}
}

public function exprLimitInt(string $field, int $value, string $alias = ''): IQueryFunction {
public function exprLimitInt(string $field, int $value, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -452,7 +451,7 @@ public function exprLimitInt(string $field, int $value, string $alias = ''): IQu
*
* @return string
*/
public function exprLimitBool(string $field, bool $value, string $alias = ''): IQueryFunction {
public function exprLimitBool(string $field, bool $value, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand Down Expand Up @@ -553,7 +552,7 @@ public function exprLimitArray(
*
* @return string
*/
public function exprLimitInArray(string $field, array $values, string $alias = ''): IQueryFunction {
public function exprLimitInArray(string $field, array $values, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -571,7 +570,7 @@ public function exprLimitInArray(string $field, array $values, string $alias = '
*
* @return string
*/
public function exprLimitBitwise(string $field, int $flag, string $alias = ''): IQueryFunction {
public function exprLimitBitwise(string $field, int $flag, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -593,7 +592,7 @@ public function exprLimitBitwise(string $field, int $flag, string $alias = ''):
*
* @return string
*/
public function exprLt(string $field, int $value, bool $lte = false, string $alias = ''): IQueryFunction {
public function exprLt(string $field, int $value, bool $lte = false, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -615,7 +614,7 @@ public function exprLt(string $field, int $value, bool $lte = false, string $ali
*
* @return string
*/
public function exprGt(string $field, int $value, bool $gte = false, string $alias = ''): IQueryFunction {
public function exprGt(string $field, int $value, bool $gte = false, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand Down Expand Up @@ -724,7 +723,7 @@ public function filterBitwise(string $field, int $flag, string $alias = ''): voi
*
* @return string
*/
public function exprUnlike(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
public function exprUnlike(string $field, string $value, string $alias = '', bool $cs = true): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -748,7 +747,7 @@ public function exprUnlike(string $field, string $value, string $alias = '', boo
*
* @return string
*/
public function exprFilter(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
public function exprFilter(string $field, string $value, string $alias = '', bool $cs = true): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -774,7 +773,7 @@ public function exprFilter(string $field, string $value, string $alias = '', boo
*
* @return string
*/
public function exprFilterInt(string $field, int $value, string $alias = ''): IQueryFunction {
public function exprFilterInt(string $field, int $value, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -792,7 +791,7 @@ public function exprFilterInt(string $field, int $value, string $alias = ''): IQ
*
* @return string
*/
public function exprFilterBool(string $field, bool $value, string $alias = ''): IQueryFunction {
public function exprFilterBool(string $field, bool $value, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand Down Expand Up @@ -893,7 +892,7 @@ public function exprFilterArray(
*
* @return string
*/
public function exprFilterInArray(string $field, array $values, string $alias = ''): IQueryFunction {
public function exprFilterInArray(string $field, array $values, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand All @@ -911,7 +910,7 @@ public function exprFilterInArray(string $field, array $values, string $alias =
*
* @return string
*/
public function exprFilterBitwise(string $field, int $flag, string $alias = ''): IQueryFunction {
public function exprFilterBitwise(string $field, int $flag, string $alias = ''): string {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
}
Expand Down
21 changes: 2 additions & 19 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
<code>$this-&gt;federationNotifications</code>
<code>Notifications</code>
</UndefinedDocblockClass>
<UndefinedFunction occurrences="1">
<code>setSubject($subject)</code>
</UndefinedFunction>
<UndefinedInterfaceMethod occurrences="4">
<code>getLazyRootFolder</code>
<code>setHtmlBody</code>
Expand Down Expand Up @@ -145,16 +142,14 @@
</InvalidScalarArgument>
</file>
<file src="lib/Db/DeprecatedCirclesRequestBuilder.php">
<InvalidNullableReturnType occurrences="3">
<InvalidNullableReturnType occurrences="1">
<code>ICompositeExpression</code>
<code>string</code>
<code>string</code>
</InvalidNullableReturnType>
<InvalidReturnStatement occurrences="1"/>
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
<NullableReturnStatement occurrences="4">
<NullableReturnStatement occurrences="2">
<code>null</code>
<code>null</code>
<code>null</code>
Expand Down Expand Up @@ -209,9 +204,6 @@
<InvalidScalarArgument occurrences="1">
<code>$id</code>
</InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$getData</code>
</RedundantCondition>
</file>
<file src="lib/Db/TokensRequest.php">
<InvalidScalarArgument occurrences="2">
Expand Down Expand Up @@ -784,9 +776,6 @@
<code>IShare</code>
<code>IShare</code>
</InvalidNullableReturnType>
<InvalidReturnType occurrences="1">
<code>iterable</code>
</InvalidReturnType>
<LessSpecificImplementedReturnType occurrences="1">
<code>array</code>
</LessSpecificImplementedReturnType>
Expand All @@ -800,12 +789,6 @@
<ParamNameMismatch occurrences="1">
<code>$shareId</code>
</ParamNameMismatch>
<RedundantCondition occurrences="1">
<code>!is_null($node)</code>
</RedundantCondition>
<TypeDoesNotContainNull occurrences="1">
<code>0</code>
</TypeDoesNotContainNull>
</file>
<file src="lib/ShareByCircleProviderDeprecated.php">
<ImplementedReturnTypeMismatch occurrences="4">
Expand Down

0 comments on commit bbc5723

Please sign in to comment.