mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 17:44:06 +02:00
strict typing and php 7.1
This commit is contained in:
parent
b3fde1c79b
commit
e8cf5e7644
25 changed files with 43 additions and 36 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -98,6 +98,7 @@ class SearchHandler {
|
|||
* @param BasicSearch $xml
|
||||
* @param SearchPropertyDefinition[] $allProps
|
||||
* @return Query
|
||||
* @throws BadRequest
|
||||
*/
|
||||
private function getQueryForXML(BasicSearch $xml, array $allProps) {
|
||||
$orderBy = array_map(function(\SearchDAV\XML\Order $order) use ($allProps) {
|
||||
|
|
@ -127,6 +128,12 @@ class SearchHandler {
|
|||
return new Query($select, $xml->from, $where, $orderBy, $xml->limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \SearchDAV\XML\Operator $operator
|
||||
* @param array $allProps
|
||||
* @return Operator
|
||||
* @throws BadRequest
|
||||
*/
|
||||
private function transformOperator(\SearchDAV\XML\Operator $operator, array $allProps) {
|
||||
$arguments = array_map(function($argument) use ($allProps) {
|
||||
if (is_string($argument)) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -60,7 +60,7 @@ class Operator {
|
|||
* @param string $type
|
||||
* @param array $arguments
|
||||
*/
|
||||
public function __construct($type = '', array $arguments = []) {
|
||||
public function __construct(string $type = '', array $arguments = []) {
|
||||
$this->type = $type;
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -46,7 +46,7 @@ class Order {
|
|||
* @param SearchPropertyDefinition $property
|
||||
* @param string $order
|
||||
*/
|
||||
public function __construct(SearchPropertyDefinition $property, $order) {
|
||||
public function __construct(SearchPropertyDefinition $property, string $order) {
|
||||
$this->property = $property;
|
||||
$this->order = $order;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -52,7 +52,7 @@ class Scope {
|
|||
* @param int|string $depth
|
||||
* @param string|null $path
|
||||
*/
|
||||
public function __construct($href = '', $depth = 1, $path = null) {
|
||||
public function __construct(string $href = '', $depth = 1, string $path = null) {
|
||||
$this->href = $href;
|
||||
$this->depth = $depth;
|
||||
$this->path = $path;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -70,7 +70,7 @@ class BasicSearch implements XmlDeserializable {
|
|||
* @return BasicSearch
|
||||
* @throws ParseException
|
||||
*/
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader): BasicSearch {
|
||||
$search = new self();
|
||||
|
||||
$elements = \Sabre\Xml\Deserializer\keyValue($reader);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -29,7 +29,7 @@ use SearchDAV\DAV\SearchPlugin;
|
|||
* The limit and offset of a search query
|
||||
*/
|
||||
class Limit extends \SearchDAV\Query\Limit implements XmlDeserializable {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader): Limit {
|
||||
$limit = new self();
|
||||
|
||||
$elements = \Sabre\Xml\Deserializer\keyValue($reader);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -26,7 +26,7 @@ use Sabre\Xml\Reader;
|
|||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
class Literal extends \SearchDAV\Query\Literal implements XmlDeserializable {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader): Literal {
|
||||
$literal = new self();
|
||||
|
||||
$literal->value = $reader->readText();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -50,12 +50,12 @@ class Operator implements XmlDeserializable {
|
|||
* @param string $type
|
||||
* @param array $arguments
|
||||
*/
|
||||
public function __construct($type = '', array $arguments = []) {
|
||||
public function __construct(string $type = '', array $arguments = []) {
|
||||
$this->type = $type;
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader): Operator {
|
||||
$operator = new self();
|
||||
|
||||
$operator->type = $reader->getClark();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -45,12 +45,12 @@ class Order implements XmlDeserializable {
|
|||
* @param string $property
|
||||
* @param string $order
|
||||
*/
|
||||
public function __construct($property = '', $order = \SearchDAV\Query\Order::ASC) {
|
||||
public function __construct(string $property = '', string $order = \SearchDAV\Query\Order::ASC) {
|
||||
$this->property = $property;
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader): Order {
|
||||
$order = new self();
|
||||
|
||||
$childs = \Sabre\Xml\Deserializer\keyValue($reader);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
@ -25,7 +25,7 @@ use Sabre\Xml\Reader;
|
|||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
class Scope extends \SearchDAV\Query\Scope implements XmlDeserializable {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader): Scope {
|
||||
$scope = new self();
|
||||
|
||||
$values = \Sabre\Xml\Deserializer\keyValue($reader);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue