Skip to content
Snippets Groups Projects
Commit 91b3421c authored by Robin Appelman's avatar Robin Appelman
Browse files

stubs for psalm

parent 64c6dcc3
No related merge requests found
......@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace OCA\NotifyPush\Controller;
use OC\AppFramework\Http\Request;
use OCA\NotifyPush\Queue\IQueue;
use OCA\NotifyPush\Queue\RedisQueue;
use OCP\App\IAppManager;
......@@ -65,8 +66,10 @@ class TestController extends Controller {
*/
public function remote(): DataDisplayResponse {
if ($this->queue instanceof RedisQueue) {
$this->queue->getConnection()->set("notify_push_forwarded_header", $this->request->getHeader('x-forwarded-for'));
$this->queue->getConnection()->set("notify_push_remote", $this->request->server['REMOTE_ADDR']);
if ($this->request instanceof Request) {
$this->queue->getConnection()->set("notify_push_forwarded_header", $this->request->getHeader('x-forwarded-for'));
$this->queue->getConnection()->set("notify_push_remote", $this->request->server['REMOTE_ADDR']);
}
}
return new DataDisplayResponse($this->request->getRemoteAddress());
}
......
......@@ -4,7 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config"
errorBaseline="tests/psalm-baseline.xml"
phpVersion="7.3"
>
<projectFiles>
......@@ -13,22 +12,7 @@
<extraFiles>
<directory name="vendor/christophwurst/nextcloud"/>
</extraFiles>
<issueHandlers>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="OC" />
<referencedClass name="OC\RedisFactory" />
</errorLevel>
</UndefinedClass>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="OC\RedisFactory"/>
</errorLevel>
</UndefinedDocblockClass>
<MissingDependency>
<errorLevel type="suppress">
<file name="lib/AppInfo/Application.php"/>
</errorLevel>
</MissingDependency>
</issueHandlers>
<stubs>
<file name="tests/stub.phpstub" preloadClasses="true"/>
</stubs>
</psalm>
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<file src="lib/AppInfo/Application.php">
<InvalidArgument occurrences="3">
<code>addListener</code>
<code>addListener</code>
<code>addListener</code>
</InvalidArgument>
</file>
</files>
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2021 Robin Appelman <robin@icewind.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace {
class OC {
/** @var string */
public static $configDir;
}
}
namespace OC {
class RedisFactory {
public function getInstance(): \Redis {}
public function isAvailable(){}
}
}
namespace OC\AppFramework\Http {
use OCP\IRequest;
abstract class Request implements IRequest {
public $server = [];
}
}
namespace OC\Files\Cache {
use OCP\EventDispatcher\Event;
use OCP\Files\Cache\ICacheEvent;
abstract class AbstractCacheEvent extends Event implements ICacheEvent {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment