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
60 changes: 0 additions & 60 deletions build/psalm-baseline-ocp.xml
Original file line number Diff line number Diff line change
@@ -1,68 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
<file src="lib/public/AppFramework/ApiController.php">
<NoInterfaceProperties>
<code><![CDATA[$this->request->server]]></code>
</NoInterfaceProperties>
</file>
<file src="lib/public/AppFramework/App.php">
<UndefinedClass>
<code><![CDATA[\OC]]></code>
</UndefinedClass>
</file>
<file src="lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php">
<UndefinedClass>
<code><![CDATA[\OC]]></code>
</UndefinedClass>
</file>
<file src="lib/public/AppFramework/Http/Response.php">
<UndefinedClass>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
</UndefinedClass>
</file>
<file src="lib/public/Defaults.php">
<UndefinedClass>
<code><![CDATA[\OC]]></code>
</UndefinedClass>
</file>
<file src="lib/public/Diagnostics/IQueryLogger.php">
<LessSpecificImplementedReturnType>
<code><![CDATA[mixed]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/public/EventDispatcher/GenericEvent.php">
<MissingTemplateParam>
<code><![CDATA[ArrayAccess]]></code>
<code><![CDATA[IteratorAggregate]]></code>
</MissingTemplateParam>
</file>
<file src="lib/public/Files.php">
<UndefinedClass>
<code><![CDATA[\OC]]></code>
</UndefinedClass>
</file>
<file src="lib/public/L10N/ILanguageIterator.php">
<MissingTemplateParam>
<code><![CDATA[\Iterator]]></code>
</MissingTemplateParam>
</file>
<file src="lib/public/Util.php">
<UndefinedClass>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
<code><![CDATA[\OC]]></code>
</UndefinedClass>
</file>
</files>
24 changes: 0 additions & 24 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3780,9 +3780,6 @@
<InvalidArgument>
<code><![CDATA[microtime(true)]]></code>
</InvalidArgument>
<InvalidReturnType>
<code><![CDATA[stopQuery]]></code>
</InvalidReturnType>
</file>
<file src="lib/private/DirectEditing/Manager.php">
<InvalidReturnType>
Expand Down Expand Up @@ -4679,11 +4676,6 @@
<code><![CDATA[\Test\Util\User\Dummy]]></code>
</UndefinedClass>
</file>
<file src="lib/public/AppFramework/ApiController.php">
<NoInterfaceProperties>
<code><![CDATA[$this->request->server]]></code>
</NoInterfaceProperties>
</file>
<file src="lib/public/AppFramework/Http/Response.php">
<LessSpecificReturnStatement>
<code><![CDATA[array_merge($mergeWith, $this->headers)]]></code>
Expand All @@ -4700,22 +4692,6 @@
<code><![CDATA[array{0: int, 1: int, 2: int}]]></code>
</MoreSpecificReturnType>
</file>
<file src="lib/public/Diagnostics/IQueryLogger.php">
<LessSpecificImplementedReturnType>
<code><![CDATA[mixed]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/public/EventDispatcher/GenericEvent.php">
<MissingTemplateParam>
<code><![CDATA[ArrayAccess]]></code>
<code><![CDATA[IteratorAggregate]]></code>
</MissingTemplateParam>
</file>
<file src="lib/public/L10N/ILanguageIterator.php">
<MissingTemplateParam>
<code><![CDATA[\Iterator]]></code>
</MissingTemplateParam>
</file>
<file src="lib/public/Preview/BeforePreviewFetchedEvent.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->mode]]></code>
Expand Down
5 changes: 2 additions & 3 deletions lib/public/AppFramework/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ public function __construct($appName,
#[PublicPage]
#[NoAdminRequired]
public function preflightedCors() {
if (isset($this->request->server['HTTP_ORIGIN'])) {
$origin = $this->request->server['HTTP_ORIGIN'];
} else {
$origin = $this->request->getHeader('origin');
if ($origin === '') {
$origin = '*';
}

Expand Down
6 changes: 4 additions & 2 deletions lib/public/AppFramework/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace OCP\AppFramework;

use OC\ServerContainer;
use OCP\IConfig;
use OCP\Server;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -44,7 +46,7 @@ public static function buildAppNamespace(string $appId, string $topNamespace = '
* @since 6.0.0
*/
public function __construct(string $appName, array $urlParams = []) {
$runIsSetupDirectly = \OC::$server->getConfig()->getSystemValueBool('debug')
$runIsSetupDirectly = Server::get(IConfig::class)->getSystemValueBool('debug')
&& !ini_get('zend.exception_ignore_args');

if ($runIsSetupDirectly) {
Expand All @@ -71,7 +73,7 @@ public function __construct(string $appName, array $urlParams = []) {
}

if (!$setUpViaQuery && $applicationClassName !== \OCP\AppFramework\App::class) {
\OCP\Server::get(LoggerInterface::class)->error($e->getMessage(), [
Server::get(LoggerInterface::class)->error($e->getMessage(), [
'app' => $appName,
'exception' => $e,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class RedirectToDefaultAppResponse extends RedirectResponse {
* @deprecated 23.0.0 Use RedirectResponse() with IURLGenerator::linkToDefaultPageUrl() instead
*/
public function __construct(int $status = Http::STATUS_SEE_OTHER, array $headers = []) {
/** @var IURLGenerator $urlGenerator */
$urlGenerator = \OC::$server->get(IURLGenerator::class);
$urlGenerator = \OCP\Server::get(IURLGenerator::class);
parent::__construct($urlGenerator->linkToDefaultPageUrl(), $status, $headers);
}
}
7 changes: 3 additions & 4 deletions lib/public/AppFramework/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public function cacheFor(int $cacheSeconds, bool $public = false, bool $immutabl

// Set expires header
$expires = new \DateTime();
/** @var ITimeFactory $time */
$time = \OCP\Server::get(ITimeFactory::class);
$expires->setTimestamp($time->getTime());
$expires->add(new \DateInterval('PT' . $cacheSeconds . 'S'));
Expand Down Expand Up @@ -184,10 +183,10 @@ public function addHeader($name, $value) {
if ($this->status === Http::STATUS_NOT_MODIFIED
&& stripos($name, 'x-') === 0) {
/** @var IConfig $config */
$config = \OC::$server->get(IConfig::class);
$config = \OCP\Server::get(IConfig::class);

if ($config->getSystemValueBool('debug', false)) {
\OC::$server->get(LoggerInterface::class)->error('Setting custom header on a 304 is not supported (Header: {header})', [
\OCP\Server::get(LoggerInterface::class)->error('Setting custom header on a 304 is not supported (Header: {header})', [
'header' => $name,
]);
}
Expand Down Expand Up @@ -229,7 +228,7 @@ public function getHeaders() {
/**
* @psalm-suppress UndefinedClass
*/
$request = \OC::$server->get(IRequest::class);
$request = \OCP\Server::get(IRequest::class);
$mergeWith = [
'X-Request-Id' => $request->getId(),
'Cache-Control' => 'no-cache, no-store, must-revalidate',
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Defaults {
*/
public function __construct(?\OC_Defaults $defaults = null) {
if ($defaults === null) {
$defaults = \OC::$server->get('ThemingDefaults');
$defaults = \OCP\Server::get('ThemingDefaults');
}
$this->defaults = $defaults;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Diagnostics/IQueryLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function startQuery($sql, ?array $params = null, ?array $types = null);
* Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to
* be returned with getQueries() method.
*
* @return mixed
* @return void
* @since 8.0.0
*/
public function stopQuery();
Expand Down
4 changes: 3 additions & 1 deletion lib/public/EventDispatcher/GenericEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
/**
* Class GenericEvent
*
* convenience reimplementation of \Symfony\Component\GenericEvent against
* convenience re-implementation of \Symfony\Component\GenericEvent against
* \OCP\EventDispatcher\Event
*
* @since 18.0.0
* @template-implements ArrayAccess<array-key, mixed>
* @template-implements IteratorAggregate<array-key, mixed>
* @deprecated 22.0.0 use \OCP\EventDispatcher\Event
*/
class GenericEvent extends Event implements ArrayAccess, IteratorAggregate {
Expand Down
4 changes: 3 additions & 1 deletion lib/public/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace OCP;

use OCP\Files\IMimeTypeDetector;

/**
* This class provides access to the internal filesystem abstraction layer. Use
* this class exclusively if you want to access files
Expand Down Expand Up @@ -67,7 +69,7 @@ public static function rmdirr($dir, bool $deleteSelf = true) {
* @deprecated 14.0.0
*/
public static function getMimeType($path) {
return \OC::$server->getMimeTypeDetector()->detect($path);
return Server::get(IMimeTypeDetector::class)->detect($path);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files_FullTextSearch/Model/AFilesDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is mostly used by 3rd party apps that want to complete the IIndexDocument
* with more information about a file before its index:
*
* \OC::$server->getEventDispatcher()->addListener(
* \OCP\Server::get(IEventDispatcher::class)->addListener(
* '\OCA\Files_FullTextSearch::onFileIndexing',
* function(GenericEvent $e) {
* //@var \OCP\Files\Node $file
Expand Down
10 changes: 4 additions & 6 deletions lib/public/L10N/ILanguageIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* if settings are not present or truncating is not applicable, the iterator
* skips to the next valid item itself
*
*
* @template-extends \Iterator<int, string>
* @since 14.0.0
*/
interface ILanguageIterator extends \Iterator {
Expand All @@ -36,22 +36,20 @@ public function current(): string;
* Move forward to next element
*
* @since 14.0.0
* @return void
*/
#[\ReturnTypeWillChange]
public function next();
public function next(): void;

/**
* Return the key of the current element
*
* @since 14.0.0
*/
public function key():int;
public function key(): int;

/**
* Checks if current position is valid
*
* @since 14.0.0
*/
public function valid():bool;
public function valid(): bool;
}
2 changes: 1 addition & 1 deletion lib/public/Mail/IMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* Example usage:
*
* $mailer = \OC::$server->get(\OCP\Mail\IMailer::class);
* $mailer = \OCP\Server::get(\OCP\Mail\IMailer::class);
* $message = $mailer->createMessage();
* $message->setSubject('Your Subject');
* $message->setFrom(['[email protected]' => 'Nextcloud Notifier']);
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Profiler/IProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* ```php
* <?php
* $profiler = \OC::$server->get(IProfiler::class);
* $profiler = \OCP\Server::get(IProfiler::class);
* $profiles = $profiler->find('/settings/users', 10);
* ```
*
Expand Down
4 changes: 2 additions & 2 deletions lib/public/Security/ICrypto.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* it will use the secret defined in config.php as key. Additionally the message will be HMAC'd.
*
* Usage:
* $encryptWithDefaultPassword = \OC::$server->getCrypto()->encrypt('EncryptedText');
* $encryptWithCustomPassword = \OC::$server->getCrypto()->encrypt('EncryptedText', 'password');
* $encryptWithDefaultPassword = \OCP\Server::get(ICrypto::class)->encrypt('EncryptedText');
* $encryptWithCustomPassword = \OCP\Server::get(ICrypto::class)->encrypt('EncryptedText', 'password');
*
* @since 8.0.0
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/public/Security/IHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*
* Usage:
* // Hashing a message
* $hash = \OC::$server->get(\OCP\Security\IHasher::class)->hash('MessageToHash');
* $hash = \OCP\Server::get(\OCP\Security\IHasher::class)->hash('MessageToHash');
* // Verifying a message - $newHash will contain the newly calculated hash
* $newHash = null;
* var_dump(\OC::$server->get(\OCP\Security\IHasher::class)->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
* var_dump(\OCP\Server::get(\OCP\Security\IHasher::class)->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
* var_dump($newHash);
*
* @since 8.0.0
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Security/ISecureRandom.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* use a fallback.
*
* Usage:
* \OC::$server->get(ISecureRandom::class)->generate(10);
* \OCP\Server::get(ISecureRandom::class)->generate(10);
*
* @since 8.0.0
*/
Expand Down
Loading
Loading