Skip to content
Open
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
11 changes: 10 additions & 1 deletion build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<DeprecatedConstant>
<code><![CDATA[CommentsEvent::EVENT_ADD]]></code>
</DeprecatedConstant>
<DeprecatedMethod>
<code><![CDATA[getEvent]]></code>
</DeprecatedMethod>
</file>
<file src="apps/comments/lib/Listener/CommentsEventListener.php">
<DeprecatedConstant>
Expand All @@ -52,6 +55,9 @@
<code><![CDATA[CommentsEvent::EVENT_PRE_UPDATE]]></code>
<code><![CDATA[CommentsEvent::EVENT_UPDATE]]></code>
</DeprecatedConstant>
<DeprecatedMethod>
<code><![CDATA[getEvent]]></code>
</DeprecatedMethod>
</file>
<file src="apps/comments/lib/MaxAutoCompleteResultsInitialState.php">
<DeprecatedMethod>
Expand All @@ -63,6 +69,10 @@
<code><![CDATA[CommentsEvent::EVENT_DELETE]]></code>
<code><![CDATA[CommentsEvent::EVENT_PRE_UPDATE]]></code>
</DeprecatedConstant>
<DeprecatedMethod>
<code><![CDATA[getEvent]]></code>
<code><![CDATA[getEvent]]></code>
</DeprecatedMethod>
</file>
<file src="apps/dav/appinfo/v1/publicwebdav.php">
<InternalMethod>
Expand Down Expand Up @@ -2083,7 +2093,6 @@
<file src="apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php">
<DeprecatedMethod>
<code><![CDATA[hasAnnotation]]></code>
<code><![CDATA[hasAnnotation]]></code>
</DeprecatedMethod>
<InvalidReturnType>
<code><![CDATA[Response]]></code>
Expand Down
8 changes: 6 additions & 2 deletions build/psalm/OcpSinceChecker.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\EnumCase;
use Psalm\CodeLocation;
use Psalm\DocComment;
use Psalm\Exception\DocblockParseException;
Expand Down Expand Up @@ -34,13 +39,12 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event): voi
} else {
self::checkClassComment($classLike, $statementsSource);
}

foreach ($classLike->stmts as $stmt) {
if ($stmt instanceof ClassConst) {
self::checkStatementComment($stmt, $statementsSource, 'constant');
}

if ($stmt instanceof ClassMethod) {
if ($stmt instanceof ClassMethod && ($stmt->isPublic() || $stmt->isProtected())) {
self::checkStatementComment($stmt, $statementsSource, 'method');
}

Expand Down
4 changes: 4 additions & 0 deletions lib/public/AppFramework/Attribute/ASince.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ abstract class ASince {
* @param string $since For shipped apps and server code such as core/ and lib/,
* this should be the server version. For other apps it
* should be the semantic app version.
* @since 32.0.0
Comment thread
nickvergessen marked this conversation as resolved.
*/
public function __construct(
protected string $since,
) {
}

/**
* @since 32.0.0
*/
public function getSince(): string {
return $this->since;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,25 @@
#[Consumable(since: '32.0.0')]
#[Implementable(since: '32.0.0')]
class ExceptionalImplementable {
/**
* @since 32.0.0
*/
public function __construct(
protected string $app,
protected ?string $class = null,
) {
}

/**
* @since 32.0.0
*/
public function getApp(): string {
return $this->app;
}

/**
* @since 32.0.0
*/
public function getClass(): ?string {
return $this->class;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/public/AppFramework/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public function buildResponse($response, $format = 'json') {
. $format . '!');
}

/**
* @since 33.0.0
*/
public function isResponderRegistered(string $responder): bool {
return isset($this->responders[$responder]);
}
Expand Down
10 changes: 10 additions & 0 deletions lib/public/AppFramework/Db/SnowflakeAwareEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ abstract class SnowflakeAwareEntity extends Entity {
/** @psalm-param $_fieldTypes array<string, Types::*> */
protected array $_fieldTypes = ['id' => Types::STRING];

/**
* @since 33.0.0
*/
public function setId($id): void {
throw new \LogicException('Use generated id to set a new id to the Snowflake aware entity.');
}

/**
* Automatically creates a snowflake ID
* @since 33.0.0
*/
public function generateId(): void {
if ($this->id === null) {
Expand All @@ -41,10 +45,16 @@ public function generateId(): void {
}
}

/**
* @since 33.0.0
*/
public function getCreatedAt(): ?\DateTimeImmutable {
return $this->getSnowflake()?->getCreatedAt();
}

/**
* @since 33.0.0
*/
public function getSnowflake(): ?Snowflake {
if ($this->id === null) {
return null;
Expand Down
1 change: 1 addition & 0 deletions lib/public/AppFramework/Http/Attribute/RequestHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class RequestHeader {
* @param lowercase-string $name The name of the request header
* @param non-empty-string $description The description of the request header
* @param bool $indirect Allow indirect usage of the header for example in a middleware. Enabling this turns off the check which ensures that the header must be referenced in the controller method.
* @since 32.0.0
*/
public function __construct(
protected string $name,
Expand Down
7 changes: 7 additions & 0 deletions lib/public/AppFramework/PublicShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
*/
abstract class PublicShareController extends Controller {

/**
* @since 33.0.0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

needs adjustment on backport

*/
public const DAV_AUTHENTICATED_FRONTEND = 'public_link_authenticated_frontend';

/** @var string */
Expand Down Expand Up @@ -118,6 +121,8 @@ public function shareNotFound() {

/**
* Validate the token and password hash stored in session
*
* @since 33.0.0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

needs adjustment on backport

*/
protected function validateTokenSession(string $token, string $passwordHash): bool {
$allowedTokensJSON = $this->session->get(self::DAV_AUTHENTICATED_FRONTEND) ?? '[]';
Expand All @@ -131,6 +136,8 @@ protected function validateTokenSession(string $token, string $passwordHash): bo

/**
* Store the token and password hash in session
*
* @since 33.0.0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

needs adjustment on backport

*/
protected function storeTokenSession(string $token, string $passwordHash = ''): void {
$allowedTokensJSON = $this->session->get(self::DAV_AUTHENTICATED_FRONTEND) ?? '[]';
Expand Down
30 changes: 30 additions & 0 deletions lib/public/BackgroundJob/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public function __construct(
) {
}

/**
* @since 25.0.0
*/
#[Override]
public function start(IJobList $jobList): void {
$jobList->setLastRun($this);
Expand All @@ -59,45 +62,72 @@ public function start(IJobList $jobList): void {
}
}

/**
* @since 15.0.0
*/
#[Override]
final public function setId(string $id): void {
$this->id = $id;
}

/**
* @since 15.0.0
*/
#[Override]
final public function setLastRun(int $lastRun): void {
$this->lastRun = $lastRun;
}

/**
* @since 15.0.0
*/
#[Override]
public function setArgument(mixed $argument): void {
$this->argument = $argument;
}

/**
* @since 15.0.0
*/
#[Override]
final public function getId(): string {
return $this->id;
}

/**
* @since 15.0.0
*/
#[Override]
final public function getLastRun(): int {
return $this->lastRun;
}

/**
* @since 15.0.0
*/
#[Override]
public function getArgument(): mixed {
return $this->argument;
}

/**
* @since 25.0.0
*/
#[Override]
public function setAllowParallelRuns(bool $allow): void {
$this->allowParallelRuns = $allow;
}

/**
* @since 25.0.0
*/
#[Override]
public function getAllowParallelRuns(): bool {
return $this->allowParallelRuns;
}

/**
* @since 15.0.0
*/
abstract protected function run($argument);
}
10 changes: 10 additions & 0 deletions lib/public/Calendar/CalendarExportOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class CalendarExportOptions {
* Gets the export format
*
* @return 'ical'|'jcal'|'xcal' (defaults to ical)
* @since 32.0.0
*/
public function getFormat(): string {
return $this->format;
Expand All @@ -33,34 +34,43 @@ public function getFormat(): string {
* Sets the export format
*
* @param 'ical'|'jcal'|'xcal' $format
* @since 32.0.0
*/
public function setFormat(string $format): void {
$this->format = $format;
}

/**
* Gets the start of the range to export
*
* @since 32.0.0
*/
public function getRangeStart(): ?string {
return $this->rangeStart;
}

/**
* Sets the start of the range to export
*
* @since 32.0.0
*/
public function setRangeStart(?string $rangeStart): void {
$this->rangeStart = $rangeStart;
}

/**
* Gets the number of objects to export
*
* @since 32.0.0
*/
public function getRangeCount(): ?int {
return $this->rangeCount;
}

/**
* Sets the number of objects to export
*
* @since 32.0.0
*/
public function setRangeCount(?int $rangeCount): void {
$this->rangeCount = $rangeCount;
Expand Down
Loading
Loading