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

View file

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

View file

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