mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-08-02 12:14:54 +02:00
refactor(phpstan): Bump phpstan level to 6
Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
parent
76d787ac73
commit
4ccbe75c73
5 changed files with 23 additions and 21 deletions
|
|
@ -34,6 +34,6 @@
|
||||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||||
"cs:fix": "php-cs-fixer fix",
|
"cs:fix": "php-cs-fixer fix",
|
||||||
"psalm": "psalm.phar",
|
"psalm": "psalm.phar",
|
||||||
"phpstan": "phpstan analyse --level 5 src"
|
"phpstan": "phpstan analyse --level 6 src"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,9 @@ use SearchDAV\XML\QueryDiscoverResponse;
|
||||||
use SearchDAV\XML\Scope;
|
use SearchDAV\XML\Scope;
|
||||||
|
|
||||||
class DiscoverHandler {
|
class DiscoverHandler {
|
||||||
/** @var ISearchBackend */
|
private ISearchBackend $searchBackend;
|
||||||
private $searchBackend;
|
private PathHelper $pathHelper;
|
||||||
|
private QueryParser $queryParser;
|
||||||
/** @var PathHelper */
|
|
||||||
private $pathHelper;
|
|
||||||
|
|
||||||
/** @var QueryParser */
|
|
||||||
private $queryParser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ISearchBackend $searchBackend
|
* @param ISearchBackend $searchBackend
|
||||||
|
|
@ -54,6 +49,9 @@ class DiscoverHandler {
|
||||||
$this->queryParser = $queryParser;
|
$this->queryParser = $queryParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed>|object|string $xml
|
||||||
|
*/
|
||||||
public function handelDiscoverRequest($xml, RequestInterface $request, ResponseInterface $response): bool {
|
public function handelDiscoverRequest($xml, RequestInterface $request, ResponseInterface $response): bool {
|
||||||
if (!isset($xml['{DAV:}basicsearch'])) {
|
if (!isset($xml['{DAV:}basicsearch'])) {
|
||||||
$response->setStatus(400);
|
$response->setStatus(400);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ use function Sabre\Xml\Deserializer\keyValue;
|
||||||
use function Sabre\Xml\Deserializer\repeatingElements;
|
use function Sabre\Xml\Deserializer\repeatingElements;
|
||||||
|
|
||||||
class QueryParser extends Service {
|
class QueryParser extends Service {
|
||||||
|
/** @var array<string, string> */
|
||||||
public $namespaceMap = [
|
public $namespaceMap = [
|
||||||
'DAV:' => 'd',
|
'DAV:' => 'd',
|
||||||
'http://sabredav.org/ns' => 's',
|
'http://sabredav.org/ns' => 's',
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,9 @@ use SearchDAV\Query\Query;
|
||||||
use SearchDAV\XML\BasicSearch;
|
use SearchDAV\XML\BasicSearch;
|
||||||
|
|
||||||
class SearchHandler {
|
class SearchHandler {
|
||||||
/** @var ISearchBackend */
|
private ISearchBackend $searchBackend;
|
||||||
private $searchBackend;
|
private PathHelper $pathHelper;
|
||||||
|
private Server $server;
|
||||||
/** @var PathHelper */
|
|
||||||
private $pathHelper;
|
|
||||||
|
|
||||||
/** @var Server */
|
|
||||||
private $server;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ISearchBackend $searchBackend
|
* @param ISearchBackend $searchBackend
|
||||||
|
|
@ -55,6 +50,9 @@ class SearchHandler {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed>|object|string $xml
|
||||||
|
*/
|
||||||
public function handleSearchRequest($xml, ResponseInterface $response): bool {
|
public function handleSearchRequest($xml, ResponseInterface $response): bool {
|
||||||
if (!isset($xml['{DAV:}basicsearch'])) {
|
if (!isset($xml['{DAV:}basicsearch'])) {
|
||||||
$response->setStatus(400);
|
$response->setStatus(400);
|
||||||
|
|
@ -168,7 +166,7 @@ class SearchHandler {
|
||||||
* @param SearchResult[] $results
|
* @param SearchResult[] $results
|
||||||
* @param string[] $propertyNames
|
* @param string[] $propertyNames
|
||||||
* @param int $depth
|
* @param int $depth
|
||||||
* @return \Iterator<array>
|
* @return \Iterator<array<string, mixed>>
|
||||||
*/
|
*/
|
||||||
private function getPropertiesIteratorResults(array $results, array $propertyNames = [], int $depth = 0): \Iterator {
|
private function getPropertiesIteratorResults(array $results, array $propertyNames = [], int $depth = 0): \Iterator {
|
||||||
$propFindType = $propertyNames ? PropFind::NORMAL : PropFind::ALLPROPS;
|
$propFindType = $propertyNames ? PropFind::NORMAL : PropFind::ALLPROPS;
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,13 @@ use function Sabre\Xml\Deserializer\keyValue;
|
||||||
*/
|
*/
|
||||||
class BasicSearch implements XmlDeserializable {
|
class BasicSearch implements XmlDeserializable {
|
||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var list<string>
|
||||||
*
|
*
|
||||||
* The list of properties to be selected, specified in clark notation
|
* The list of properties to be selected, specified in clark notation
|
||||||
*/
|
*/
|
||||||
public $select;
|
public $select;
|
||||||
/**
|
/**
|
||||||
* @var Scope[]
|
* @var list<Scope>
|
||||||
*
|
*
|
||||||
* The collections to perform the search in
|
* The collections to perform the search in
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,7 +49,7 @@ class BasicSearch implements XmlDeserializable {
|
||||||
*/
|
*/
|
||||||
public $where;
|
public $where;
|
||||||
/**
|
/**
|
||||||
* @var Order[]
|
* @var list<Order>
|
||||||
*
|
*
|
||||||
* The list of order operations that should be used to order the results.
|
* The list of order operations that should be used to order the results.
|
||||||
*
|
*
|
||||||
|
|
@ -66,6 +66,11 @@ class BasicSearch implements XmlDeserializable {
|
||||||
*/
|
*/
|
||||||
public $limit;
|
public $limit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $select
|
||||||
|
* @param list<Scope> $from
|
||||||
|
* @param list<Order> $orderBy
|
||||||
|
*/
|
||||||
public function __construct(array $select, array $from, ?Operator $where, array $orderBy, Limit $limit) {
|
public function __construct(array $select, array $from, ?Operator $where, array $orderBy, Limit $limit) {
|
||||||
$this->select = $select;
|
$this->select = $select;
|
||||||
$this->from = $from;
|
$this->from = $from;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue