add some type hinting

This commit is contained in:
Robin Appelman 2019-11-06 14:33:04 +01:00
commit 5ba2a3cc31
3 changed files with 7 additions and 7 deletions

View file

@ -80,7 +80,7 @@ class DiscoverHandler {
return false; return false;
} }
private function hashDefinition(SearchPropertyDefinition $definition) { private function hashDefinition(SearchPropertyDefinition $definition): string {
return $definition->dataType return $definition->dataType
. (($definition->searchable) ? '1' : '0') . (($definition->searchable) ? '1' : '0')
. (($definition->sortable) ? '1' : '0') . (($definition->sortable) ? '1' : '0')
@ -91,7 +91,7 @@ class DiscoverHandler {
* @param SearchPropertyDefinition[] $propertyDefinitions * @param SearchPropertyDefinition[] $propertyDefinitions
* @return BasicSearchSchema * @return BasicSearchSchema
*/ */
private function getBasicSearchForProperties(array $propertyDefinitions) { private function getBasicSearchForProperties(array $propertyDefinitions): BasicSearchSchema {
/** @var PropDesc[] $groups */ /** @var PropDesc[] $groups */
$groups = []; $groups = [];
foreach ($propertyDefinitions as $propertyDefinition) { foreach ($propertyDefinitions as $propertyDefinition) {

View file

@ -37,7 +37,7 @@ class PathHelper {
$this->server = $server; $this->server = $server;
} }
public function getPathFromUri($uri) { public function getPathFromUri($uri): ?string {
if (strpos($uri, '://') === false) { if (strpos($uri, '://') === false) {
return $uri; return $uri;
} }

View file

@ -96,7 +96,7 @@ class SearchHandler {
* @return Query * @return Query
* @throws BadRequest * @throws BadRequest
*/ */
private function getQueryForXML(BasicSearch $xml, array $allProps) { private function getQueryForXML(BasicSearch $xml, array $allProps): Query {
$orderBy = array_map(function (\SearchDAV\XML\Order $order) use ($allProps) { $orderBy = array_map(function (\SearchDAV\XML\Order $order) use ($allProps) {
if (!isset($allProps[$order->property])) { if (!isset($allProps[$order->property])) {
throw new BadRequest('requested order by property is not a valid property for this scope'); throw new BadRequest('requested order by property is not a valid property for this scope');
@ -109,7 +109,7 @@ class SearchHandler {
}, $xml->orderBy); }, $xml->orderBy);
$select = array_map(function ($propName) use ($allProps) { $select = array_map(function ($propName) use ($allProps) {
if (!isset($allProps[$propName])) { if (!isset($allProps[$propName])) {
return; return null;
} }
$prop = $allProps[$propName]; $prop = $allProps[$propName];
if (!$prop->selectable) { if (!$prop->selectable) {
@ -130,7 +130,7 @@ class SearchHandler {
* @return Operator * @return Operator
* @throws BadRequest * @throws BadRequest
*/ */
private function transformOperator(\SearchDAV\XML\Operator $operator, array $allProps) { private function transformOperator(\SearchDAV\XML\Operator $operator, array $allProps): Operator {
$arguments = array_map(function ($argument) use ($allProps) { $arguments = array_map(function ($argument) use ($allProps) {
if (is_string($argument)) { if (is_string($argument)) {
if (!isset($allProps[$argument])) { if (!isset($allProps[$argument])) {
@ -167,7 +167,7 @@ class SearchHandler {
* @param int $depth * @param int $depth
* @return \Iterator * @return \Iterator
*/ */
private function getPropertiesIteratorResults($results, $propertyNames = [], $depth = 0) { private function getPropertiesIteratorResults($results, $propertyNames = [], $depth = 0): \Iterator {
$propFindType = $propertyNames ? PropFind::NORMAL : PropFind::ALLPROPS; $propFindType = $propertyNames ? PropFind::NORMAL : PropFind::ALLPROPS;
foreach ($results as $result) { foreach ($results as $result) {