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
43 changes: 43 additions & 0 deletions build/psalm/OcpSinceChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ private static function checkClassComment(ClassLike $stmt, FileSource $statement
)
);
}
foreach ($parsedDocblock->tags['since'] ?? [] as $since) {
self::checkSinceIsReleasable(trim($since), $statementsSource, $stmt);
}

if (isset($parsedDocblock->tags['depreacted'])) {
IssueBuffer::maybeAdd(
Expand Down Expand Up @@ -184,6 +187,9 @@ private static function checkStatementComment(Stmt $stmt, FileSource $statements
)
);
}
foreach ($parsedDocblock->tags['since'] ?? [] as $since) {
self::checkSinceIsReleasable(trim($since), $statementsSource, $stmt);
}

if (isset($parsedDocblock->tags['depreacted'])) {
IssueBuffer::maybeAdd(
Expand Down Expand Up @@ -213,9 +219,46 @@ private static function checkAttributeHasValidSinceVersion(\PhpParser\Node\Attri
new CodeLocation($statementsSource, $stmt)
)
);
} else {
self::checkSinceIsReleasable($arg->value->value, $statementsSource, $stmt);
}
}
}
}
}

/**
* A since version must not be newer than the next patch release of the
* current branch, so backports with an unadjusted since fail
*/
private static function checkSinceIsReleasable(string $since, FileSource $statementsSource, \PhpParser\Node $stmt): void {
// Backports may list multiple versions: "33.0.1, 32.0.7"
if (!preg_match('/^\d+(\.\d+)*(\s*,\s*\d+(\.\d+)*)*/', $since, $list)) {
return;
}

$maxVersion = self::getMaxSinceVersion();
foreach (preg_split('/\s*,\s*/', $list[0]) as $version) {
if (version_compare($version, $maxVersion, '<=')) {
return;
}
}

IssueBuffer::maybeAdd(
new InvalidDocblock(
'Since version ' . $list[0] . ' is newer than the next release ' . $maxVersion . ' of this branch, please adjust it to the version the change is released in.',
new CodeLocation($statementsSource, $stmt)
)
);
}

private static function getMaxSinceVersion(): string {
static $maxVersion = null;
if ($maxVersion === null) {
require __DIR__ . '/../../version.php';
/** @var array{0: int, 1: int, 2: int, 3: int} $OC_Version */
$maxVersion = $OC_Version[0] . '.' . $OC_Version[1] . '.' . ($OC_Version[2] + 1);
}
return $maxVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public function registerConfigLexicon(string $configLexiconClass): void;
* Register an implementation of {@see IGlobalScaleService}.
*
* @param class-string<IGlobalScaleService> $globalScaleServiceClass
* @since 34.0.3
* @since 33.0.9
*/
public function registerGlobalScaleService(string $globalScaleServiceClass): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function hasAnnotation(string $name): bool;
* Log a debug line if the annotation is used.
*
* @param class-string<T> $attributeClass
* @since 34.0.0
* @since 33.0.1
*/
public function hasAnnotationOrAttribute(?string $annotationName, string $attributeClass): bool;
}
2 changes: 1 addition & 1 deletion lib/public/Authentication/IProvideUserSecretBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface IProvideUserSecretBackend {
* secret but is unable to do so.
*
* @since 23.0.0
* @since 35.0.0 The returns value is now optional.
* @since 33.0.7 The returns value is now optional.
*/
public function getCurrentUserSecret(): ?string;
}
4 changes: 2 additions & 2 deletions lib/public/Calendar/CalendarImportOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function setValidate(int $value): void {
/**
* Gets whether to include object counts as the first yielded value
*
* @since 35.0.0
* @since 33.0.10
*/
public function getCounts(): bool {
return $this->counts;
Expand All @@ -167,7 +167,7 @@ public function getCounts(): bool {
/**
* Sets whether to include object counts as the first yielded value
*
* @since 35.0.0
* @since 33.0.10
*/
public function setCounts(bool $counts): void {
$this->counts = $counts;
Expand Down
38 changes: 19 additions & 19 deletions lib/public/Contacts/ContactsImportOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@
/**
* Contacts Import Options
*
* @since 35.0.0
* @since 33.0.10
*/
final class ContactsImportOptions {

/**
* @since 35.0.0
* @since 33.0.10
*/
public const FORMATS = ['vcf', 'jcf', 'xcf'];

/**
* @since 35.0.0
* @since 33.0.10
*/
public const VALIDATE_NONE = 0;
/**
* @since 35.0.0
* @since 33.0.10
*/
public const VALIDATE_SKIP = 1;
/**
* @since 35.0.0
* @since 33.0.10
*/
public const VALIDATE_FAIL = 2;
/**
* @since 35.0.0
* @since 33.0.10
*/
public const VALIDATE_OPTIONS = [
self::VALIDATE_NONE,
self::VALIDATE_SKIP,
self::VALIDATE_FAIL,
];
/**
* @since 35.0.0
* @since 33.0.10
*/
public const ERROR_CONTINUE = 0;
/**
* @since 35.0.0
* @since 33.0.10
*/
public const ERROR_FAIL = 1;
/**
* @since 35.0.0
* @since 33.0.10
*/
public const ERROR_OPTIONS = [
self::ERROR_CONTINUE,
Expand All @@ -69,7 +69,7 @@ final class ContactsImportOptions {
* Gets the import format
*
* @return 'vcf'|'jcf'|'xcf' (defaults to vcf)
* @since 35.0.0
* @since 33.0.10
*/
public function getFormat(): string {
return $this->format;
Expand All @@ -79,7 +79,7 @@ public function getFormat(): string {
* Sets the import format
*
* @param 'vcf'|'jcf'|'xcf' $value
* @since 35.0.0
* @since 33.0.10
*/
public function setFormat(string $value): void {
if (!in_array($value, self::FORMATS, true)) {
Expand All @@ -91,7 +91,7 @@ public function setFormat(string $value): void {
/**
* Gets whether to supersede existing objects
*
* @since 35.0.0
* @since 33.0.10
*/
public function getSupersede(): bool {
return $this->supersede;
Expand All @@ -100,7 +100,7 @@ public function getSupersede(): bool {
/**
* Sets whether to supersede existing objects
*
* @since 35.0.0
* @since 33.0.10
*/
public function setSupersede(bool $supersede): void {
$this->supersede = $supersede;
Expand All @@ -110,7 +110,7 @@ public function setSupersede(bool $supersede): void {
* Gets how to handle object errors
*
* @return int 0 - continue, 1 - fail
* @since 35.0.0
* @since 33.0.10
*/
public function getErrors(): int {
return $this->errors;
Expand All @@ -122,7 +122,7 @@ public function getErrors(): int {
* @param int $value 0 - continue, 1 - fail
*
* @template $value of self::ERROR_*
* @since 35.0.0
* @since 33.0.10
*/
public function setErrors(int $value): void {
if (!in_array($value, self::ERROR_OPTIONS, true)) {
Expand All @@ -135,7 +135,7 @@ public function setErrors(int $value): void {
* Gets how to handle object validation
*
* @return int 0 - no validation, 1 - validate and skip on issue, 2 - validate and fail on issue
* @since 35.0.0
* @since 33.0.10
*/
public function getValidate(): int {
return $this->validate;
Expand All @@ -147,7 +147,7 @@ public function getValidate(): int {
* @param int $value 0 - no validation, 1 - validate and skip on issue, 2 - validate and fail on issue
*
* @template $value of self::VALIDATE_*
* @since 35.0.0
* @since 33.0.10
*/
public function setValidate(int $value): void {
if (!in_array($value, self::VALIDATE_OPTIONS, true)) {
Expand All @@ -159,7 +159,7 @@ public function setValidate(int $value): void {
/**
* Gets whether to include object counts as the first yielded value
*
* @since 35.0.0
* @since 33.0.10
*/
public function getCounts(): bool {
return $this->counts;
Expand All @@ -168,7 +168,7 @@ public function getCounts(): bool {
/**
* Sets whether to include object counts as the first yielded value
*
* @since 35.0.0
* @since 33.0.10
*/
public function setCounts(bool $counts): void {
$this->counts = $counts;
Expand Down
8 changes: 4 additions & 4 deletions lib/public/Files/Events/UserHomeSetupEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* Event triggered after the users home mount has been setup, before any other
* mounts are setup.
*
* @since 34.0.0
* @since 33.0.3
*/
class UserHomeSetupEvent extends Event {
/**
* @since 34.0.0
* @since 33.0.3
*/
public function __construct(
private readonly IUser $user,
Expand All @@ -31,14 +31,14 @@ public function __construct(
}

/**
* @since 34.0.0
* @since 33.0.3
*/
public function getUser(): IUser {
return $this->user;
}

/**
* @since 34.0.0
* @since 33.0.3
*/
public function getHomeMount(): IMountPoint {
return $this->homeMount;
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public function getMetadata(): array;
* Get the filecache data for the file
*
* @return ICacheEntry
* @since 34.0.0
* @since 33.0.3
*/
public function getData(): ICacheEntry;
}
6 changes: 3 additions & 3 deletions lib/public/GlobalScale/IConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function onlyInternalFederation(): bool;
* This instance is then only used to log in the users and then redirect them
* to their associated secondary instance.
*
* @since 34.0.3
* @since 33.0.8
*/
public function isPrimary(): bool;

Expand All @@ -47,7 +47,7 @@ public function isPrimary(): bool;
*
* These instances are the actual instance of a user and hold all their data.
*
* @since 34.0.3
* @since 33.0.8
*/
public function isSecondary(): bool;

Expand All @@ -57,7 +57,7 @@ public function isSecondary(): bool;
* These users won't be redirected to a secondary instance and instead will
* stay on the primary instance to manage the configuration of the instance.
*
* @since 34.0.3
* @since 33.0.8
*/
public function isPrimaryAdmin(string $userId): bool;
}
6 changes: 3 additions & 3 deletions lib/public/GlobalScale/IGlobalScaleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* This service is only available when the globalsiteselector application is enabled.
*
* @since 34.0.3
* @since 33.0.9
*/
interface IGlobalScaleService {
/**
Expand All @@ -28,7 +28,7 @@ interface IGlobalScaleService {
* @param non-empty-string $path
* @return string The url of the secondary
* @throws \Exception When unable to send the payload.
* @since 34.0.3
* @since 33.0.9
*/
public function sendToSecondary(IUser $user, string $path, array $payload): string;

Expand All @@ -39,7 +39,7 @@ public function sendToSecondary(IUser $user, string $path, array $payload): stri
*
* @param non-empty-string $jwt The payload encoded as a JWT
* @return array The original payload as sent by {@see IGlobalScaleService::sendToSecondary}
* @since 34.0.3
* @since 33.0.9
*/
public function decodePayload(string $jwt): array;
}
4 changes: 2 additions & 2 deletions lib/public/IAddressBookWritable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
/**
* IAddressBook Interface extension for checking if the address book is writable
*
* @since 35.0.0
* @since 33.0.10
*/
interface IAddressBookWritable extends IAddressBook {
/**
* Indicates whether the address book can be modified
*
* @since 35.0.0
* @since 33.0.10
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/public/IUserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function getExistingUser(string $userId, ?string $displayName = null): IU
*
* @param \OCP\Federation\ICloudId $federatedUserId A cloud ID of the federated user
* @return IUser
* @since 35.0.0
* @since 33.0.8
*/
public function getFederatedUser(\OCP\Federation\ICloudId $cloudId): IUser;
}
2 changes: 1 addition & 1 deletion lib/public/OCM/Events/LocalOCMDiscoveryEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function registerResourceType(string $name, array $shareTypes, array $pro
*
* @return IOCMProvider
*
* @since 35.0.0
* @since 33.0.9
*/
public function getProvider(): IOCMProvider {
return $this->provider;
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Security/Ip/IRemoteAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function allowsAdminActions(): bool;

/**
* Check if the current remote address is allowed to bypass the password confirmation.
* @since 35.0.0
* @since 33.0.8
*/
public function allowsBypassPasswordConfirmation(): bool;
}
Loading
Loading