diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ce3b3fbf8..57f0a5937 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -30,24 +30,12 @@ parameters: count: 1 path: src/contracts/Event/BeforeParseEvent.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Event\\BeforeParseEvent\:\:getValueObject\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Event/BeforeParseEvent.php - - message: '#^Method Ibexa\\Contracts\\Rest\\Event\\BeforeParseEvent\:\:setData\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/contracts/Event/BeforeParseEvent.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Event\\BeforeParseEvent\:\:setValueObject\(\) has parameter \$valueObject with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/contracts/Event/BeforeParseEvent.php - - message: '#^Property Ibexa\\Contracts\\Rest\\Event\\BeforeParseEvent\:\:\$data type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -60,24 +48,12 @@ parameters: count: 1 path: src/contracts/Event/ParseEvent.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Event\\ParseEvent\:\:__construct\(\) has parameter \$valueObject with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/contracts/Event/ParseEvent.php - - message: '#^Method Ibexa\\Contracts\\Rest\\Event\\ParseEvent\:\:getData\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/contracts/Event/ParseEvent.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Event\\ParseEvent\:\:getValueObject\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Event/ParseEvent.php - - message: '#^Property Ibexa\\Contracts\\Rest\\Event\\ParseEvent\:\:\$data type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -96,12 +72,6 @@ parameters: count: 1 path: src/contracts/Input/ParsingDispatcher.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Input\\ParsingDispatcher\:\:internalParse\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Input/ParsingDispatcher.php - - message: '#^Method Ibexa\\Contracts\\Rest\\Input\\ParsingDispatcher\:\:internalParse\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -132,42 +102,18 @@ parameters: count: 1 path: src/contracts/Output/ValueObjectVisitor.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitDescriptionsList\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Output/ValueObjectVisitor.php - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitDescriptionsList\(\) has parameter \$descriptions with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/contracts/Output/ValueObjectVisitor.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitLimitation\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Output/ValueObjectVisitor.php - - - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitNamesList\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Output/ValueObjectVisitor.php - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitNamesList\(\) has parameter \$names with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/contracts/Output/ValueObjectVisitor.php - - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitTranslatedList\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/contracts/Output/ValueObjectVisitor.php - - message: '#^Method Ibexa\\Contracts\\Rest\\Output\\ValueObjectVisitor\:\:visitTranslatedList\(\) has parameter \$translatedElements with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -198,30 +144,12 @@ parameters: count: 1 path: src/lib/FieldTypeProcessor/ImageProcessor.php - - - message: '#^Method Ibexa\\Rest\\FieldTypeProcessor\\RelationListProcessor\:\:postProcessValueHash\(\) has parameter \$outgoingValueHash with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/FieldTypeProcessor/RelationListProcessor.php - - message: '#^Method Ibexa\\Rest\\FieldTypeProcessor\\RelationListProcessor\:\:postProcessValueHash\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/lib/FieldTypeProcessor/RelationListProcessor.php - - - message: '#^Method Ibexa\\Rest\\FieldTypeProcessor\\RelationProcessor\:\:postProcessValueHash\(\) has parameter \$outgoingValueHash with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/FieldTypeProcessor/RelationProcessor.php - - - - message: '#^Method Ibexa\\Rest\\FieldTypeProcessor\\RelationProcessor\:\:postProcessValueHash\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/FieldTypeProcessor/RelationProcessor.php - - message: '#^Cannot call method getFieldTypeIdentifier\(\) on Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinition\|null\.$#' identifier: method.nonObject @@ -265,8 +193,8 @@ parameters: path: src/lib/Input/Handler/Xml.php - - message: '#^Cannot assign new offset to array\|string\.$#' - identifier: offsetAssign.dimType + message: '#^Cannot access an offset on array\|bool\|float\|int\|string\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/lib/Input/Handler/Xml.php @@ -282,18 +210,6 @@ parameters: count: 1 path: src/lib/Input/Handler/Xml.php - - - message: '#^Method Ibexa\\Rest\\Input\\Handler\\Xml\:\:convertDom\(\) should return array but returns array\\|string\.$#' - identifier: return.type - count: 1 - path: src/lib/Input/Handler/Xml.php - - - - message: '#^Method Ibexa\\Rest\\Input\\Handler\\Xml\:\:convertDom\(\) should return array but returns null\.$#' - identifier: return.type - count: 1 - path: src/lib/Input/Handler/Xml.php - - message: '#^Method Ibexa\\Rest\\Input\\Handler\\Xml\:\:parseFieldTypeHash\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -312,24 +228,12 @@ parameters: count: 1 path: src/lib/Input/Handler/Xml.php - - - message: '#^Property Ibexa\\Rest\\Input\\Handler\\Xml\:\:\$fieldTypeHashElements has no type specified\.$#' - identifier: missingType.property - count: 1 - path: src/lib/Input/Handler/Xml.php - - message: '#^Property Ibexa\\Rest\\Input\\Handler\\Xml\:\:\$forceList type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/lib/Input/Handler/Xml.php - - - message: '#^Method Ibexa\\Rest\\Input\\Parser\\ContentObjectStates\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Input/Parser/ContentObjectStates.php - - message: '#^Method Ibexa\\Rest\\Input\\ParserTools\:\:isEmbeddedObject\(\) has parameter \$objectElement with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -366,24 +270,6 @@ parameters: count: 1 path: src/lib/Message.php - - - message: '#^Property Ibexa\\Rest\\Message\:\:\$headers type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Message.php - - - - message: '#^Method Ibexa\\Rest\\Output\\FieldTypeSerializer\:\:serializeHash\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Output/FieldTypeSerializer.php - - - - message: '#^Method Ibexa\\Rest\\Output\\FieldTypeSerializer\:\:serializeValue\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Output/FieldTypeSerializer.php - - message: '#^Access to an undefined property Ibexa\\Rest\\Output\\Generator\\Json\\JsonObject\:\:\$\#text\.$#' identifier: property.notFound @@ -414,12 +300,6 @@ parameters: count: 1 path: src/lib/Security/Authenticator/RestAuthenticator.php - - - message: '#^Method Ibexa\\Rest\\Server\\Controller\\BinaryContent\:\:getImageVariation\(\) should return Ibexa\\Contracts\\Core\\Variation\\Values\\Variation but returns Ibexa\\Rest\\Server\\Values\\CachedValue\.$#' - identifier: return.type - count: 1 - path: src/lib/Server/Controller/BinaryContent.php - - message: '#^Method Ibexa\\Rest\\Server\\Controller\\BinaryContent\:\:parseImageId\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -444,36 +324,6 @@ parameters: count: 2 path: src/lib/Server/Controller/BinaryContent.php - - - message: '#^Method Ibexa\\Rest\\Server\\Controller\\Options\:\:getRouteOptions\(\) has parameter \$allowedMethods with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Controller/Options.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Controller\\Root\:\:__construct\(\) has parameter \$rootResourceBuilder with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Controller/Root.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Controller\\Root\:\:loadRootResource\(\) should return Ibexa\\Rest\\Values\\Root but returns array\|Ibexa\\Rest\\Values\\Root\.$#' - identifier: return.type - count: 1 - path: src/lib/Server/Controller/Root.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Controller\\Services\:\:__construct\(\) has parameter \$countriesInfo with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Controller/Services.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Controller\\Services\:\:\$countriesInfo type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Controller/Services.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\AbstractDestinationLocationParser\:\:parse\(\) has Ibexa\\Contracts\\Rest\\Exceptions\\Parser in PHPDoc @throws tag but it''s not thrown\.$#' identifier: throws.unusedType @@ -624,30 +474,6 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Aggregation\\Range\\AbstractRangeParser\:\:visitRangeValue\(\) has parameter \$value with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Aggregation\\Range\\DateTimeRangeParser\:\:visitRangeValue\(\) has parameter \$value with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Input/Parser/Aggregation/Range/DateTimeRangeParser.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Aggregation\\Range\\FloatRangeParser\:\:visitRangeValue\(\) has parameter \$value with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Input/Parser/Aggregation/Range/FloatRangeParser.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Aggregation\\Range\\IntRangeParser\:\:visitRangeValue\(\) has parameter \$value with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Input/Parser/Aggregation/Range/IntRangeParser.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Aggregation\\RawRangeAggregationParser\:\:parseAggregation\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -696,132 +522,24 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/ContentCreate.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\ContentUpdate\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/ContentUpdate.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\:\:dispatchAggregation\(\) has parameter \$aggregationData with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: src/lib/Server/Input/Parser/Criterion.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\:\:getCriterionMediaType\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Input/Parser/Criterion.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\:\:getCriterionMediaType\(\) has parameter \$criterionName with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Input/Parser/Criterion.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\:\:getSortClauseMediaType\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Input/Parser/Criterion.php - - - - message: '#^Possibly invalid array key type \(list\\|string\)\.$#' - identifier: offsetAccess.invalidOffset - count: 1 - path: src/lib/Server/Input/Parser/Criterion.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\Ancestor\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/Ancestor.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ContentId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ContentId.php - - message: '#^Parameter \#1 \$value of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\ContentId constructor expects array\\|int, list\ given\.$#' identifier: argument.type count: 1 path: src/lib/Server/Input/Parser/Criterion/ContentId.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ContentRemoteId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ContentRemoteId.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ContentTypeGroupId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ContentTypeId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ContentTypeId.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ContentTypeIdentifier\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ContentTypeIdentifier.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\Field\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/Field.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\FullText\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/FullText.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LanguageCode\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/LanguageCode.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LocationId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/LocationId.php - - message: '#^Parameter \#1 \$value of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\LocationId constructor expects array\\|int, list\ given\.$#' identifier: argument.type count: 1 path: src/lib/Server/Input/Parser/Criterion/LocationId.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LocationRemoteId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/LocationRemoteId.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LogicalAnd\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/LogicalAnd.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LogicalNot\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/LogicalNot.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LogicalOperator\:\:getFlattenedCriteriaData\(\) has parameter \$criteriaByType with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -840,54 +558,18 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/Criterion/LogicalOperator.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\LogicalOr\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/LogicalOr.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ObjectStateId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ObjectStateId.php - - message: '#^Parameter \#1 \$value of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\ObjectStateId constructor expects array\\|int, list\ given\.$#' identifier: argument.type count: 1 path: src/lib/Server/Input/Parser/Criterion/ObjectStateId.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ParentLocationId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ParentLocationId.php - - message: '#^Parameter \#1 \$value of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\ParentLocationId constructor expects array\\|int, list\ given\.$#' identifier: argument.type count: 1 path: src/lib/Server/Input/Parser/Criterion/ParentLocationId.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\ParentLocationRemoteId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/ParentLocationRemoteId.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\SectionId\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/SectionId.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\Subtree\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/Subtree.php - - message: '#^Parameter \#1 \$value of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\UserId constructor expects array\\|int, list\ given\.$#' identifier: argument.type @@ -900,12 +582,6 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/Criterion/UserMetadata.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Criterion\\Visibility\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/Criterion/Visibility.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\FieldDefinitionUpdate\:\:getFieldDefinition\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -930,12 +606,6 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/LocationCreate.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\LocationUpdate\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/LocationUpdate.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\Query\:\:processCriteriaArray\(\) has parameter \$criteriaArray with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -966,18 +636,6 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/RestoreTrashItemInput.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\RoleAssignInput\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/RoleAssignInput.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\SessionInput\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/SessionInput.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\SortClause\\Field\:\:normalizeData\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -990,18 +648,6 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/SortClause/Field.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\SortClause\\Field\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/SortClause/Field.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\URLAliasCreate\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/URLAliasCreate.php - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\URLAliasCreate\:\:parse\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -1026,72 +672,18 @@ parameters: count: 1 path: src/lib/Server/Input/Parser/UserGroupCreate.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\UserGroupUpdate\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/UserGroupUpdate.php - - message: '#^Parameter \#1 \$locationId of method Ibexa\\Contracts\\Core\\Repository\\LocationService\:\:loadLocation\(\) expects int, string given\.$#' identifier: argument.type count: 1 path: src/lib/Server/Input/Parser/UserGroupUpdate.php - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\UserUpdate\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/UserUpdate.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\VersionUpdate\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/VersionUpdate.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\ViewInput\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/ViewInput.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Input\\Parser\\ViewInputOneDotOne\:\:parse\(\) has parameter \$data with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Input/Parser/ViewInputOneDotOne.php - - - - message: '#^PHPDoc tag @var above a method has no effect\.$#' - identifier: varTag.misplaced - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Author.php - - - - message: '#^PHPDoc tag @var does not specify variable name\.$#' - identifier: varTag.noVariable - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Author.php - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CachedValue\:\:getParameter\(\) has no return type specified\.$#' identifier: missingType.return count: 1 path: src/lib/Server/Output/ValueObjectVisitor/CachedValue.php - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CachedValue\:\:getParameter\(\) has parameter \$defaultValue with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CachedValue.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CachedValue\:\:getParameter\(\) has parameter \$parameterName with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CachedValue.php - - message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\Translation\:\:\$message\.$#' identifier: property.notFound @@ -1116,36 +708,6 @@ parameters: count: 1 path: src/lib/Server/Output/ValueObjectVisitor/ContentFieldValidationException.php - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\ContentTypeGroup\:\:visitContentTypeGroupAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroup.php - - - - message: '#^Access to offset ''Alpha2'' on an unknown class Ibexa\\Core\\Repository\\Values\\ContentType\\Countries\.$#' - identifier: class.notFound - count: 2 - path: src/lib/Server/Output/ValueObjectVisitor/CountryList.php - - - - message: '#^Access to offset ''Alpha3'' on an unknown class Ibexa\\Core\\Repository\\Values\\ContentType\\Countries\.$#' - identifier: class.notFound - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CountryList.php - - - - message: '#^Access to offset ''IDC'' on an unknown class Ibexa\\Core\\Repository\\Values\\ContentType\\Countries\.$#' - identifier: class.notFound - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CountryList.php - - - - message: '#^Access to offset ''Name'' on an unknown class Ibexa\\Core\\Repository\\Values\\ContentType\\Countries\.$#' - identifier: class.notFound - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CountryList.php - - message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\CreatedContent\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CreatedContent\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Rest\\Server\\Values\\RestContent\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\RestContent\:\:visit\(\)$#' identifier: method.childParameterType @@ -1188,18 +750,6 @@ parameters: count: 1 path: src/lib/Server/Output/ValueObjectVisitor/CreatedObjectStateGroup.php - - - message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\CreatedPolicy\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CreatedPolicy\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\PolicyDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy\:\:visit\(\)$#' - identifier: method.childParameterType - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CreatedPolicy.php - - - - message: '#^Parameter \#3 \$data of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy\:\:visit\(\) expects Ibexa\\Contracts\\Core\\Repository\\Values\\User\\PolicyDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy, Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Policy given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CreatedPolicy.php - - message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\CreatedRelation\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CreatedRelation\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Rest\\Server\\Values\\RestRelation\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\RestRelation\:\:visit\(\)$#' identifier: method.childParameterType @@ -1207,23 +757,11 @@ parameters: path: src/lib/Server/Output/ValueObjectVisitor/CreatedRelation.php - - message: '#^Access to an undefined property Ibexa\\Rest\\Server\\Values\\RestRole\:\:\$id\.$#' - identifier: property.notFound - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php - - - - message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\CreatedRole\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CreatedRole\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\RoleDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visit\(\)$#' + message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\CreatedRole\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CreatedRole\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Role\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visit\(\)$#' identifier: method.childParameterType count: 1 path: src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php - - - message: '#^Parameter \#3 \$data of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visit\(\) expects Ibexa\\Contracts\\Core\\Repository\\Values\\User\\RoleDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role, Ibexa\\Rest\\Server\\Values\\RestRole given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php - - message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\CreatedSection\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\CreatedSection\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Section\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Section\:\:visit\(\)$#' identifier: method.childParameterType @@ -1273,65 +811,17 @@ parameters: path: src/lib/Server/Output/ValueObjectVisitor/DeletedUserSession.php - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\ImageVariation\:\:visitImageVariationAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/ImageVariation.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Location\:\:visitLocationAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Location.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\ObjectStateGroup\:\:visitObjectStateGroupAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroup.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy\:\:visitPolicyAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Policy.php - - - - message: '#^Parameter \#3 \$data of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy\:\:visitPolicyAttributes\(\) expects Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Policy, Ibexa\\Contracts\\Core\\Repository\\Values\\User\\PolicyDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Policy given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Policy.php - - - - message: '#^Access to an undefined property Ibexa\\Rest\\Server\\Values\\RestRole\:\:\$id\.$#' - identifier: property.notFound - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php - - - - message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\PublishedRole\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\PublishedRole\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\RoleDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visit\(\)$#' + message: '#^Parameter \#3 \$data \(Ibexa\\Rest\\Server\\Values\\PublishedRole\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\PublishedRole\:\:visit\(\) should be compatible with parameter \$data \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Role\) of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visit\(\)$#' identifier: method.childParameterType count: 1 path: src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php - - - message: '#^Parameter \#3 \$data of method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visit\(\) expects Ibexa\\Contracts\\Core\\Repository\\Values\\User\\RoleDraft\|Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role, Ibexa\\Rest\\Server\\Values\\RestRole given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php - - message: '#^Parameter \#2 \$whatIsWrong of class Ibexa\\Core\\Base\\Exceptions\\BadStateException constructor expects string, int given\.$#' identifier: argument.type count: 1 path: src/lib/Server/Output/ValueObjectVisitor/RestContent.php - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContent\:\:\$path \(string\) on left side of \?\? is not nullable\.$#' - identifier: nullCoalesce.property - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/RestContent.php - - message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content\:\:\$valueObject\.$#' identifier: property.notFound @@ -1362,18 +852,6 @@ parameters: count: 1 path: src/lib/Server/Output/ValueObjectVisitor/RestUser.php - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visitRoleAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Role.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Role\:\:visitRoleAttributes\(\) has parameter \$data with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Role.php - - message: '#^Parameter \#1 \$roleAssignment of class Ibexa\\Rest\\Server\\Values\\RestUserGroupRoleAssignment constructor expects Ibexa\\Contracts\\Core\\Repository\\Values\\User\\UserGroupRoleAssignment, Ibexa\\Contracts\\Core\\Repository\\Values\\User\\RoleAssignment given\.$#' identifier: argument.type @@ -1386,24 +864,6 @@ parameters: count: 1 path: src/lib/Server/Output/ValueObjectVisitor/RoleAssignmentList.php - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Section\:\:visitSectionAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Section.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\URLAlias\:\:visitURLAliasAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/URLAlias.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\URLWildcard\:\:visitURLWildcardAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/URLWildcard.php - - message: '#^Parameter \#4 \$mainLocation of class Ibexa\\Rest\\Server\\Values\\RestUser constructor expects Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location, Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|null given\.$#' identifier: argument.type @@ -1411,166 +871,16 @@ parameters: path: src/lib/Server/Output/ValueObjectVisitor/User.php - - message: '#^Parameter \#4 \$mainLocation of class Ibexa\\Rest\\Server\\Values\\RestUserGroup constructor expects Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location, Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/UserGroup.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\UserSession\:\:visitUserSessionAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/UserSession.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\Version\:\:visitVersionAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/Version.php - - - - message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\VersionInfo\:\:\$names\.$#' - identifier: property.notFound - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\VersionInfo\:\:visitVersionInfoAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Output\\ValueObjectVisitor\\VersionTranslationInfo\:\:visitVersionTranslationInfoAttributes\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Output/ValueObjectVisitor/VersionTranslationInfo.php - - - - message: '#^PHPDoc tag @return with type array\|Ibexa\\Rest\\Values\\Root is not subtype of native type Ibexa\\Rest\\Values\\Root\.$#' - identifier: return.phpDocType - count: 1 - path: src/lib/Server/Service/ExpressionRouterRootResourceBuilder.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Service\\RootResourceBuilderInterface\:\:buildRootResource\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Service/RootResourceBuilderInterface.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Values\\CachedValue\:\:__construct\(\) has parameter \$cacheTags with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Values/CachedValue.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Values\\CachedValue\:\:checkCacheTags\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/Server/Values/CachedValue.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Values\\CachedValue\:\:checkCacheTags\(\) has parameter \$tags with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Values/CachedValue.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Values\\CountryList\:\:__construct\(\) has parameter \$countries with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Values/CountryList.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\CountryList\:\:\$countries has unknown class Ibexa\\Core\\Repository\\Values\\ContentType\\Countries as its type\.$#' - identifier: class.notFound - count: 1 - path: src/lib/Server/Values/CountryList.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Values\\Options\:\:__construct\(\) has parameter \$allowedMethods with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Server/Values/Options.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\Options\:\:\$allowedMethods type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/Server/Values/Options.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RelationList\:\:\$path \(string\) does not accept string\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RelationList.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContent\:\:\$contentType \(Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\) does not accept Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestContent.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContent\:\:\$currentVersion \(Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content\) does not accept Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestContent.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContent\:\:\$mainLocation \(Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\) does not accept Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestContent.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContent\:\:\$path \(string\) does not accept string\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestContent.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContent\:\:\$relations \(array\\) does not accept array\\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestContent.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestContentType\:\:\$fieldDefinitions \(array\\) does not accept array\\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestContentType.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RestLocationUpdateStruct\:\:\$hidden \(bool\) does not accept bool\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RestLocationUpdateStruct.php - - - - message: '#^Property Ibexa\\Rest\\Server\\Values\\RoleAssignment\:\:\$limitation \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Limitation\\RoleLimitation\) does not accept Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Limitation\\RoleLimitation\|null\.$#' - identifier: assign.propertyType - count: 1 - path: src/lib/Server/Values/RoleAssignment.php - - - - message: '#^Access to an undefined property Ibexa\\Rest\\Server\\Values\\SeeOther\:\:\$redirectUri\.$#' - identifier: property.notFound - count: 1 - path: src/lib/Server/Values/SeeOther.php - - - - message: '#^Method Ibexa\\Rest\\Server\\Values\\SeeOther\:\:__construct\(\) has parameter \$redirectUri with no type specified\.$#' - identifier: missingType.parameter + message: '#^Parameter \#4 \$mainLocation of class Ibexa\\Rest\\Server\\Values\\RestUserGroup constructor expects Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location, Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|null given\.$#' + identifier: argument.type count: 1 - path: src/lib/Server/Values/SeeOther.php + path: src/lib/Server/Output/ValueObjectVisitor/UserGroup.php - - message: '#^Property Ibexa\\Rest\\Server\\Values\\Version\:\:\$path \(string\) does not accept string\|null\.$#' - identifier: assign.propertyType + message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\VersionInfo\:\:\$names\.$#' + identifier: property.notFound count: 1 - path: src/lib/Server/Values/Version.php + path: src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php - message: '#^Property Ibexa\\Rest\\Server\\View\\AcceptHeaderVisitorDispatcher\:\:\$mapping type has no value type specified in iterable type array\.$#' @@ -1590,24 +900,6 @@ parameters: count: 1 path: src/lib/Values/ContentObjectStates.php - - - message: '#^Method Ibexa\\Rest\\Values\\Resource\:\:__construct\(\) has parameter \$href with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Values/Resource.php - - - - message: '#^Method Ibexa\\Rest\\Values\\Resource\:\:__construct\(\) has parameter \$mediaType with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Values/Resource.php - - - - message: '#^Method Ibexa\\Rest\\Values\\Resource\:\:__construct\(\) has parameter \$name with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/Values/Resource.php - - message: '#^Class Ibexa\\Rest\\Values\\Resource referenced with incorrect case\: Ibexa\\Rest\\Values\\resource\.$#' identifier: class.nameCase @@ -1620,12 +912,6 @@ parameters: count: 1 path: src/lib/Values/Root.php - - - message: '#^Property Ibexa\\Tests\\Bundle\\Rest\\CorsOptions\\RestProviderTest\:\:\$matchRequestResult has no type specified\.$#' - identifier: missingType.property - count: 1 - path: tests/bundle/CorsOptions/RestProviderTest.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\DependencyInjection\\Compiler\\FieldTypeProcessorPassTest\:\:dataProviderForProcess\(\) return type has no value type specified in iterable type iterable\.$#' identifier: missingType.iterableValue @@ -1680,12 +966,6 @@ parameters: count: 1 path: tests/bundle/Functional/ContentTest.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\ContentTest\:\:testCopyContent\(\) has parameter \$restContentHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/ContentTest.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\ContentTest\:\:testCreateRelation\(\) has parameter \$restContentVersionHref with no type specified\.$#' identifier: missingType.parameter @@ -1788,12 +1068,6 @@ parameters: count: 1 path: tests/bundle/Functional/ContentTypeTest.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\ContentTypeTest\:\:testPublishContentTypeDraft\(\) has parameter \$contentTypeHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/ContentTypeTest.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\ContentTypeTest\:\:testUnlinkContentTypeFromGroup\(\) has parameter \$contentTypeHref with no type specified\.$#' identifier: missingType.parameter @@ -1872,30 +1146,6 @@ parameters: count: 1 path: tests/bundle/Functional/ObjectStateTest.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testAddPolicy\(\) has parameter \$roleHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testAddPolicyByRoleDraft\(\) has parameter \$roleDraftHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testAssignRoleToUser\(\) has parameter \$roleHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testAssignRoleToUserGroup\(\) has parameter \$roleHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/RoleTest.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testAssignRoleToUserWithLimitation\(\) has parameter \$limitation with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -1908,36 +1158,6 @@ parameters: count: 1 path: tests/bundle/Functional/RoleTest.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testDeleteRoleDraft\(\) has parameter \$roleDraftHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testLoadPolicies\(\) has parameter \$roleHref with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testPublishRoleDraft\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\RoleTest\:\:testUpdatePolicy\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/RoleTest.php - - - - message: '#^PHPDoc tag @param references unknown parameter\: \$roleHref$#' - identifier: parameter.notFound - count: 1 - path: tests/bundle/Functional/RoleTest.php - - message: '#^Unreachable statement \- code above always terminates\.$#' identifier: deadCode.unreachable @@ -2406,24 +1626,6 @@ parameters: count: 1 path: tests/bundle/Functional/TestCase.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:addCreatedElement\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/TestCase.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:assertHttpResponseCodeEquals\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/TestCase.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:assertHttpResponseCodeEquals\(\) has parameter \$expected with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/TestCase.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:assertHttpResponseHasHeader\(\) has no return type specified\.$#' identifier: missingType.return @@ -2436,12 +1638,6 @@ parameters: count: 1 path: tests/bundle/Functional/TestCase.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:assertHttpResponseHasHeader\(\) has parameter \$header with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/TestCase.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:clearCreatedElement\(\) has parameter \$contentArray with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2472,42 +1668,12 @@ parameters: count: 1 path: tests/bundle/Functional/TestCase.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:generateMediaTypeString\(\) has parameter \$typeString with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/TestCase.php - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:getContentLocations\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue count: 1 path: tests/bundle/Functional/TestCase.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:getHttpHost\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/TestCase.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:getHttpResponseCodeErrorMessage\(\) has parameter \$errorMessage with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/TestCase.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:getLoginPassword\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/TestCase.php - - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:getLoginUsername\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/bundle/Functional/TestCase.php - - message: '#^Property Ibexa\\Tests\\Bundle\\Rest\\Functional\\TestCase\:\:\$createdContent type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2526,12 +1692,6 @@ parameters: count: 1 path: tests/bundle/Functional/TestCase.php - - - message: '#^Method Ibexa\\Tests\\Bundle\\Rest\\Functional\\TrashTest\:\:testDeleteTrashItem\(\) has parameter \$trashItemId with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/bundle/Functional/TrashTest.php - - message: '#^Unreachable statement \- code above always terminates\.$#' identifier: deadCode.unreachable @@ -2670,18 +1830,6 @@ parameters: count: 1 path: tests/lib/FieldTypeProcessor/ImageProcessorTest.php - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\MediaProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/MediaProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\MediaProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/MediaProcessorTest.php - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\MediaProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' identifier: missingType.parameter @@ -2694,126 +1842,12 @@ parameters: count: 1 path: tests/lib/FieldTypeProcessor/MediaProcessorTest.php - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationListProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationListProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationListProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationListProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationListProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationListProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationListProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationListProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\RelationProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/RelationProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\TimeProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/TimeProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\TimeProcessorTest\:\:testPostProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/TimeProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\TimeProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$inputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/TimeProcessorTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\FieldTypeProcessor\\TimeProcessorTest\:\:testPreProcessFieldSettingsHash\(\) has parameter \$outputSettings with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/FieldTypeProcessor/TimeProcessorTest.php - - message: '#^Argument of an invalid type list\\|false supplied for foreach, only iterables are supported\.$#' identifier: foreach.nonIterable count: 1 path: tests/lib/Input/Handler/XmlTest.php - - - message: '#^Method Ibexa\\Tests\\Rest\\Input\\Handler\\XmlTest\:\:testConvertXml\(\) has parameter \$expectation with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/Input/Handler/XmlTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Input\\Handler\\XmlTest\:\:testConvertXml\(\) has parameter \$xml with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/Input/Handler/XmlTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\FieldTypeSerializerTest\:\:getContentTypeMock\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/FieldTypeSerializerTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\FieldTypeSerializerTest\:\:getFieldTypeMock\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/FieldTypeSerializerTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\FieldTypeSerializerTest\:\:getFieldTypeProcessorMock\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/FieldTypeSerializerTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\FieldTypeSerializerTest\:\:getFieldTypeProcessorRegistryMock\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/FieldTypeSerializerTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\FieldTypeSerializerTest\:\:getFieldTypeServiceMock\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/FieldTypeSerializerTest.php - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\Generator\\FieldTypeHashGeneratorBaseTest\:\:getGenerator\(\) has no return type specified\.$#' identifier: missingType.return @@ -2856,12 +1890,6 @@ parameters: count: 1 path: tests/lib/Output/ValueObjectVisitorBaseTest.php - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\ValueObjectVisitorBaseTest\:\:addRouteExpectation\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/ValueObjectVisitorBaseTest.php - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\ValueObjectVisitorBaseTest\:\:addRouteExpectation\(\) has parameter \$arguments with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2874,24 +1902,6 @@ parameters: count: 1 path: tests/lib/Output/ValueObjectVisitorBaseTest.php - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\ValueObjectVisitorBaseTest\:\:assertXPath\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/ValueObjectVisitorBaseTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\ValueObjectVisitorBaseTest\:\:getVisitor\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/ValueObjectVisitorBaseTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Output\\ValueObjectVisitorBaseTest\:\:resetRouterMock\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Output/ValueObjectVisitorBaseTest.php - - message: '#^Parameter \#1 \$document of class DOMXPath constructor expects DOMDocument, DOMDocument\|null given\.$#' identifier: argument.type @@ -2952,30 +1962,6 @@ parameters: count: 1 path: tests/lib/Server/Input/Parser/ContentUpdateTest.php - - - message: '#^Method Ibexa\\Tests\\Rest\\Server\\Input\\Parser\\ContentUpdateTest\:\:testParseFailureInvalidDate\(\) has parameter \$element with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/Server/Input/Parser/ContentUpdateTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Server\\Input\\Parser\\ContentUpdateTest\:\:testParseFailureInvalidDate\(\) has parameter \$exceptionMessage with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/Server/Input/Parser/ContentUpdateTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Server\\Input\\Parser\\ContentUpdateTest\:\:testParseFailureInvalidHref\(\) has parameter \$element with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/Server/Input/Parser/ContentUpdateTest.php - - - - message: '#^Method Ibexa\\Tests\\Rest\\Server\\Input\\Parser\\ContentUpdateTest\:\:testParseFailureInvalidHref\(\) has parameter \$exceptionMessage with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: tests/lib/Server/Input/Parser/ContentUpdateTest.php - - message: '#^Method Ibexa\\Tests\\Rest\\Server\\Input\\Parser\\Criterion\\DateMetadataTest\:\:testParseProvider\(\) return type has no value type specified in iterable type iterable\.$#' identifier: missingType.iterableValue diff --git a/src/bundle/ApiLoader/Factory.php b/src/bundle/ApiLoader/Factory.php index 5180ea3ad..f6b013ae0 100644 --- a/src/bundle/ApiLoader/Factory.php +++ b/src/bundle/ApiLoader/Factory.php @@ -24,10 +24,6 @@ class Factory protected Repository $repository; - /** - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - */ public function __construct(ConfigResolverInterface $configResolver, Repository $repository) { $this->configResolver = $configResolver; @@ -49,10 +45,6 @@ public function getMediaFieldTypeProcessor(): MediaProcessor /** * Factory for ezpublish_rest.field_type_processor.ibexa_image. - * - * @param \Symfony\Component\Routing\RouterInterface $router - * - * @return \Ibexa\Rest\FieldTypeProcessor\ImageProcessor */ public function getImageFieldTypeProcessor(RouterInterface $router): ImageProcessor { diff --git a/src/bundle/ApiPlatform/Head.php b/src/bundle/ApiPlatform/Head.php index 2149dfcc5..2afb884e1 100644 --- a/src/bundle/ApiPlatform/Head.php +++ b/src/bundle/ApiPlatform/Head.php @@ -106,8 +106,8 @@ public function __construct( ?bool $forceEager = null, ?int $priority = null, ?string $name = null, - $provider = null, - $processor = null, + callable|string|null $provider = null, + callable|string|null $processor = null, ?OptionsInterface $stateOptions = null, array|Parameters|null $parameters = null, array $extraProperties = [], diff --git a/src/bundle/DependencyInjection/Compiler/FieldTypeProcessorPass.php b/src/bundle/DependencyInjection/Compiler/FieldTypeProcessorPass.php index 9db3caf9f..577667f48 100644 --- a/src/bundle/DependencyInjection/Compiler/FieldTypeProcessorPass.php +++ b/src/bundle/DependencyInjection/Compiler/FieldTypeProcessorPass.php @@ -15,7 +15,7 @@ class FieldTypeProcessorPass implements CompilerPassInterface { - private const FIELD_TYPE_PROCESSOR_SERVICE_TAG = 'ibexa.rest.field_type.processor'; + private const string FIELD_TYPE_PROCESSOR_SERVICE_TAG = 'ibexa.rest.field_type.processor'; public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/Compiler/InputHandlerPass.php b/src/bundle/DependencyInjection/Compiler/InputHandlerPass.php index 3b5fc2725..3ae245085 100644 --- a/src/bundle/DependencyInjection/Compiler/InputHandlerPass.php +++ b/src/bundle/DependencyInjection/Compiler/InputHandlerPass.php @@ -20,7 +20,7 @@ */ class InputHandlerPass implements CompilerPassInterface { - public const INPUT_HANDLER_SERVICE_TAG = 'ibexa.rest.input.handler'; + public const string INPUT_HANDLER_SERVICE_TAG = 'ibexa.rest.input.handler'; public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/Compiler/InputParserPass.php b/src/bundle/DependencyInjection/Compiler/InputParserPass.php index 933b4c591..f88183b40 100644 --- a/src/bundle/DependencyInjection/Compiler/InputParserPass.php +++ b/src/bundle/DependencyInjection/Compiler/InputParserPass.php @@ -20,7 +20,7 @@ */ class InputParserPass implements CompilerPassInterface { - public const INPUT_PARSER_SERVICE_TAG = 'ibexa.rest.input.parser'; + public const string INPUT_PARSER_SERVICE_TAG = 'ibexa.rest.input.parser'; public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/Compiler/OutputVisitorPass.php b/src/bundle/DependencyInjection/Compiler/OutputVisitorPass.php index 9269e080f..0f9a2c321 100644 --- a/src/bundle/DependencyInjection/Compiler/OutputVisitorPass.php +++ b/src/bundle/DependencyInjection/Compiler/OutputVisitorPass.php @@ -22,7 +22,7 @@ */ class OutputVisitorPass implements CompilerPassInterface { - public const OUTPUT_VISITOR_SERVICE_TAG = 'ibexa.rest.output.visitor'; + public const string OUTPUT_VISITOR_SERVICE_TAG = 'ibexa.rest.output.visitor'; public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/IbexaRestExtension.php b/src/bundle/DependencyInjection/IbexaRestExtension.php index 3c2193157..c70963652 100644 --- a/src/bundle/DependencyInjection/IbexaRestExtension.php +++ b/src/bundle/DependencyInjection/IbexaRestExtension.php @@ -27,7 +27,7 @@ */ class IbexaRestExtension extends ConfigurableExtension implements PrependExtensionInterface { - public const EXTENSION_NAME = 'ibexa_rest'; + public const string EXTENSION_NAME = 'ibexa_rest'; public function getAlias(): string { diff --git a/src/bundle/RestEvents.php b/src/bundle/RestEvents.php index 3579e956e..0b7f7a84e 100644 --- a/src/bundle/RestEvents.php +++ b/src/bundle/RestEvents.php @@ -12,5 +12,5 @@ final class RestEvents /** * The REST_CSRF_TOKEN_VALIDATED event occurs after CSRF token has been validated as correct. */ - public const REST_CSRF_TOKEN_VALIDATED = 'ezpublish.rest.csrf_token_validated'; + public const string REST_CSRF_TOKEN_VALIDATED = 'ezpublish.rest.csrf_token_validated'; } diff --git a/src/bundle/Routing/OptionsLoader/Mapper.php b/src/bundle/Routing/OptionsLoader/Mapper.php index a6d92ec12..2a1587dd7 100644 --- a/src/bundle/Routing/OptionsLoader/Mapper.php +++ b/src/bundle/Routing/OptionsLoader/Mapper.php @@ -33,13 +33,8 @@ public function mapRoute(Route $route): Route /** * Merges the methods from $restRoute into the _method default of $optionsRoute. - * - * @param \Symfony\Component\Routing\Route $restRoute - * @param \Symfony\Component\Routing\Route $optionsRoute - * - * @return \Symfony\Component\Routing\Route $optionsRoute with the methods from $restRoute in the _methods default */ - public function mergeMethodsDefault(Route $optionsRoute, Route $restRoute) + public function mergeMethodsDefault(Route $optionsRoute, Route $restRoute): Route { $mergedRoute = clone $optionsRoute; $mergedRoute->setDefault( diff --git a/src/bundle/Routing/OptionsLoader/RouteCollectionMapper.php b/src/bundle/Routing/OptionsLoader/RouteCollectionMapper.php index 9c335b152..7fd6ab715 100644 --- a/src/bundle/Routing/OptionsLoader/RouteCollectionMapper.php +++ b/src/bundle/Routing/OptionsLoader/RouteCollectionMapper.php @@ -25,10 +25,6 @@ public function __construct(Mapper $mapper) /** * Iterates over $restRouteCollection, and returns the corresponding RouteCollection of OPTIONS REST routes. - * - * @param \Symfony\Component\Routing\RouteCollection $restRouteCollection - * - * @return \Symfony\Component\Routing\RouteCollection */ public function mapCollection(RouteCollection $restRouteCollection): RouteCollection { diff --git a/src/bundle/UriParser/UriParser.php b/src/bundle/UriParser/UriParser.php index f2feb4603..01ea030ae 100644 --- a/src/bundle/UriParser/UriParser.php +++ b/src/bundle/UriParser/UriParser.php @@ -27,7 +27,7 @@ final class UriParser implements UriParserInterface * @see \Ibexa\Contracts\Rest\UriParser\UriParserInterface::isRestRequest() * @see \Ibexa\Contracts\Rest\UriParser\UriParserInterface::hasRestPrefix() */ - public const DEFAULT_REST_PREFIX_PATTERN = '/^\/api\/[a-zA-Z0-9-_]+\/v\d+(\.\d+)?\//'; + public const string DEFAULT_REST_PREFIX_PATTERN = '/^\/api\/[a-zA-Z0-9-_]+\/v\d+(\.\d+)?\//'; private UrlMatcherInterface $urlMatcher; diff --git a/src/contracts/Event/BeforeParseEvent.php b/src/contracts/Event/BeforeParseEvent.php index f790bc7dc..d6bd012b1 100644 --- a/src/contracts/Event/BeforeParseEvent.php +++ b/src/contracts/Event/BeforeParseEvent.php @@ -17,12 +17,11 @@ final class BeforeParseEvent extends BeforeEvent private string $mediaType; - /** @var mixed|null */ - private $valueObject = null; + private mixed $valueObject = null; public function __construct( array $data, - string $mediaType + string $mediaType, ) { $this->data = $data; $this->mediaType = $mediaType; @@ -48,7 +47,7 @@ public function setMediaType(string $mediaType): void $this->mediaType = $mediaType; } - public function getValueObject() + public function getValueObject(): mixed { if (!$this->hasValueObject()) { throw new UnexpectedValueException('Return value is not set. Check hasValueObject() or set it using setValueObject() before you call the getter.'); @@ -57,7 +56,7 @@ public function getValueObject() return $this->valueObject; } - public function setValueObject($valueObject): void + public function setValueObject(mixed $valueObject): void { $this->valueObject = $valueObject; } diff --git a/src/contracts/Event/ParseEvent.php b/src/contracts/Event/ParseEvent.php index 65becbc4c..48eaf6b72 100644 --- a/src/contracts/Event/ParseEvent.php +++ b/src/contracts/Event/ParseEvent.php @@ -12,15 +12,14 @@ final class ParseEvent extends AfterEvent { - /** @var mixed */ - private $valueObject; + private mixed $valueObject; private array $data; private string $mediaType; public function __construct( - $valueObject, + mixed $valueObject, array $data, string $mediaType ) { @@ -39,7 +38,7 @@ public function getMediaType(): string return $this->mediaType; } - public function getValueObject() + public function getValueObject(): mixed { return $this->valueObject; } diff --git a/src/contracts/FieldTypeProcessor.php b/src/contracts/FieldTypeProcessor.php index 8e246f030..fc2250cda 100644 --- a/src/contracts/FieldTypeProcessor.php +++ b/src/contracts/FieldTypeProcessor.php @@ -24,11 +24,9 @@ abstract class FieldTypeProcessor * * @see \Ibexa\Rest\Input\FieldTypeParser * - * @param mixed $incomingValueHash - * * @return mixed Pre processed hash */ - public function preProcessValueHash($incomingValueHash) + public function preProcessValueHash(mixed $incomingValueHash): mixed { return $incomingValueHash; } @@ -45,11 +43,9 @@ public function preProcessValueHash($incomingValueHash) * * @see \Ibexa\Rest\Output\FieldTypeSerializer * - * @param mixed $outgoingValueHash - * * @return mixed Post processed hash */ - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): mixed { return $outgoingValueHash; } @@ -66,11 +62,9 @@ public function postProcessValueHash($outgoingValueHash) * * @see \Ibexa\Rest\Input\FieldTypeParser * - * @param mixed $incomingSettingsHash - * - * @return mixed Pre processed hash + * @return mixed Preprocessed hash */ - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { return $incomingSettingsHash; } @@ -87,11 +81,9 @@ public function preProcessFieldSettingsHash($incomingSettingsHash) * * @see \Ibexa\Rest\Output\FieldTypeSerializer * - * @param mixed $outgoingSettingsHash - * * @return mixed Post processed hash */ - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { return $outgoingSettingsHash; } @@ -108,11 +100,9 @@ public function postProcessFieldSettingsHash($outgoingSettingsHash) * * @see \Ibexa\Rest\Input\FieldTypeParser * - * @param mixed $incomingValidatorConfigurationHash - * - * @return mixed Pre processed hash + * @return mixed Preprocessed hash */ - public function preProcessValidatorConfigurationHash($incomingValidatorConfigurationHash) + public function preProcessValidatorConfigurationHash(mixed $incomingValidatorConfigurationHash): mixed { return $incomingValidatorConfigurationHash; } @@ -129,11 +119,9 @@ public function preProcessValidatorConfigurationHash($incomingValidatorConfigura * * @see \Ibexa\Rest\Output\FieldTypeSerializer * - * @param mixed $outgoingValidatorConfigurationHash - * * @return mixed Post processed hash */ - public function postProcessValidatorConfigurationHash($outgoingValidatorConfigurationHash) + public function postProcessValidatorConfigurationHash(mixed $outgoingValidatorConfigurationHash): mixed { return $outgoingValidatorConfigurationHash; } diff --git a/src/contracts/Input/Handler.php b/src/contracts/Input/Handler.php index e2ebadc7b..7ddf5d52b 100644 --- a/src/contracts/Input/Handler.php +++ b/src/contracts/Input/Handler.php @@ -14,10 +14,6 @@ abstract class Handler { /** * Converts the given string to an array structure. - * - * @param string $string - * - * @return array */ - abstract public function convert($string); + abstract public function convert(string $string): array|string|int|bool|float|null; } diff --git a/src/contracts/Input/Parser/Query/Criterion/BaseCriterionProcessor.php b/src/contracts/Input/Parser/Query/Criterion/BaseCriterionProcessor.php index 37f18237e..d6090b09c 100644 --- a/src/contracts/Input/Parser/Query/Criterion/BaseCriterionProcessor.php +++ b/src/contracts/Input/Parser/Query/Criterion/BaseCriterionProcessor.php @@ -18,8 +18,8 @@ */ abstract class BaseCriterionProcessor implements CriterionProcessorInterface { - private const CRITERION_SUFFIX = 'Criterion'; - private const LOGICAL_OPERATOR_CRITERION_MAP = [ + private const string CRITERION_SUFFIX = 'Criterion'; + private const array LOGICAL_OPERATOR_CRITERION_MAP = [ 'AND' => 'LogicalAnd', 'OR' => 'LogicalOr', 'NOT' => 'LogicalNot', diff --git a/src/contracts/Input/ParsingDispatcher.php b/src/contracts/Input/ParsingDispatcher.php index 6955b863a..c9655ca82 100644 --- a/src/contracts/Input/ParsingDispatcher.php +++ b/src/contracts/Input/ParsingDispatcher.php @@ -51,9 +51,6 @@ public function __construct(EventDispatcherInterface $eventDispatcher, array $pa /** * Adds another parser for the given content type. - * - * @param string $mediaType - * @param \Ibexa\Contracts\Rest\Input\Parser $parser */ public function addParser(string $mediaType, Parser $parser): void { @@ -96,7 +93,7 @@ public function parse(array $data, string $mediaType) /** * Parses the given $data according to $mediaType. */ - protected function internalParse(array $data, string $mediaType) + protected function internalParse(array $data, string $mediaType): mixed { list($mediaType, $version) = $this->parseMediaTypeVersion($mediaType); diff --git a/src/contracts/Output/Exceptions/AbstractExceptionVisitor.php b/src/contracts/Output/Exceptions/AbstractExceptionVisitor.php index 282f5ea15..79515b81e 100644 --- a/src/contracts/Output/Exceptions/AbstractExceptionVisitor.php +++ b/src/contracts/Output/Exceptions/AbstractExceptionVisitor.php @@ -7,6 +7,7 @@ namespace Ibexa\Contracts\Rest\Output\Exceptions; +use Exception; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; use Ibexa\Contracts\Rest\Output\Visitor; @@ -22,7 +23,7 @@ abstract class AbstractExceptionVisitor extends ValueObjectVisitor * * @var array */ - protected static $httpStatusCodes = [ + protected static array $httpStatusCodes = [ 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', @@ -62,20 +63,16 @@ abstract class AbstractExceptionVisitor extends ValueObjectVisitor /** * Returns HTTP status code. - * - * @return int */ - protected function getStatus() + protected function getStatus(): int { return 500; } /** * @param \Exception $data - * - * @return void */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ErrorMessage'); @@ -105,7 +102,7 @@ public function visit(Visitor $visitor, Generator $generator, $data): void $generator->endObjectElement('ErrorMessage'); } - protected function generateErrorCode(Generator $generator, Visitor $visitor, \Exception $e): int + protected function generateErrorCode(Generator $generator, Visitor $visitor, Exception $e): int { $statusCode = $this->getStatus(); $visitor->setStatus($statusCode); @@ -115,12 +112,12 @@ protected function generateErrorCode(Generator $generator, Visitor $visitor, \Ex return $statusCode; } - protected function getErrorMessage(\Exception $data, int $statusCode): string + protected function getErrorMessage(Exception $data, int $statusCode): string { return static::$httpStatusCodes[$statusCode] ?? static::$httpStatusCodes[500]; } - protected function getErrorDescription(\Exception $data, int $statusCode): string + protected function getErrorDescription(Exception $data, int $statusCode): string { $translator = $this->getTranslator(); if ($statusCode < 500 || $this->canDisplayExceptionMessage()) { diff --git a/src/contracts/Output/Exceptions/InvalidTypeException.php b/src/contracts/Output/Exceptions/InvalidTypeException.php index b884fb702..eaaa3410a 100644 --- a/src/contracts/Output/Exceptions/InvalidTypeException.php +++ b/src/contracts/Output/Exceptions/InvalidTypeException.php @@ -16,10 +16,8 @@ class InvalidTypeException extends RuntimeException { /** * Construct from invalid data. - * - * @param mixed $data */ - public function __construct($data) + public function __construct(mixed $data) { parent::__construct( 'You must provide a ValueObject for visiting, "' . gettype($data) . '" provided.' diff --git a/src/contracts/Output/Exceptions/NoVisitorFoundException.php b/src/contracts/Output/Exceptions/NoVisitorFoundException.php index ff5e4fffe..98b255fc1 100644 --- a/src/contracts/Output/Exceptions/NoVisitorFoundException.php +++ b/src/contracts/Output/Exceptions/NoVisitorFoundException.php @@ -16,8 +16,6 @@ class NoVisitorFoundException extends RuntimeException { /** * Construct from tested classes. - * - * @param array $classes */ public function __construct(array $classes) { diff --git a/src/contracts/Output/Exceptions/OutputGeneratorException.php b/src/contracts/Output/Exceptions/OutputGeneratorException.php index e651bf6f7..c6d5bb128 100644 --- a/src/contracts/Output/Exceptions/OutputGeneratorException.php +++ b/src/contracts/Output/Exceptions/OutputGeneratorException.php @@ -15,11 +15,9 @@ class OutputGeneratorException extends RuntimeException { /** - * Construct from error message. - * - * @param string $message + * Construct from an error message. */ - public function __construct($message) + public function __construct(string $message) { parent::__construct( 'Output visiting failed: ' . $message diff --git a/src/contracts/Output/Generator.php b/src/contracts/Output/Generator.php index 11e6ad4a8..0a79987b2 100644 --- a/src/contracts/Output/Generator.php +++ b/src/contracts/Output/Generator.php @@ -427,7 +427,7 @@ protected function checkEnd(string $type, mixed $data): void /** * Serializes a boolean value. */ - abstract public function serializeBool(mixed $boolValue): bool|string; + abstract public function serializeBool(bool|string|null $boolValue): bool|string; abstract protected function getData(): Data\DataObjectInterface; diff --git a/src/contracts/Output/ValueObjectVisitor.php b/src/contracts/Output/ValueObjectVisitor.php index 91c2e8547..cfa0e2cf5 100644 --- a/src/contracts/Output/ValueObjectVisitor.php +++ b/src/contracts/Output/ValueObjectVisitor.php @@ -19,28 +19,15 @@ abstract class ValueObjectVisitor { protected UriParserInterface $uriParser; - /** - * @var \Symfony\Component\Routing\RouterInterface - */ - protected $router; + protected RouterInterface $router; - /** - * @var \Symfony\Component\Routing\RouterInterface - */ - protected $templateRouter; + protected RouterInterface $templateRouter; /** * Visit struct returned by controllers. - * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param mixed $data */ - abstract public function visit(Visitor $visitor, Generator $generator, $data); + abstract public function visit(Visitor $visitor, Generator $generator, mixed $data); - /** - * @param \Symfony\Component\Routing\RouterInterface $router - */ public function setRouter(RouterInterface $router): void { $this->router = $router; @@ -58,45 +45,32 @@ public function setUriParser(UriParserInterface $uriParser): void /** * Returns a string representation for the given $boolValue. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param bool $boolValue - * - * @return mixed */ - protected function serializeBool(Generator $generator, $boolValue) + protected function serializeBool(Generator $generator, ?bool $boolValue): string|bool { return $generator->serializeBool($boolValue); } /** * Visits the given list of $names. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param array $names */ - protected function visitNamesList(Generator $generator, array $names) + protected function visitNamesList(Generator $generator, array $names): void { $this->visitTranslatedList($generator, $names, 'names'); } /** * Visits the given list of $descriptions. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param array $descriptions */ - protected function visitDescriptionsList(Generator $generator, array $descriptions) + protected function visitDescriptionsList(Generator $generator, array $descriptions): void { $this->visitTranslatedList($generator, $descriptions, 'descriptions'); } /** * Visits a list of translated elements. - * - * @param array $translatedElements */ - protected function visitTranslatedList(Generator $generator, array $translatedElements, string $listName) + protected function visitTranslatedList(Generator $generator, array $translatedElements, string $listName): void { $generator->startHashElement($listName); $generator->startList('value'); @@ -110,11 +84,8 @@ protected function visitTranslatedList(Generator $generator, array $translatedEl /** * Visits a limitation. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation */ - protected function visitLimitation(Generator $generator, Limitation $limitation) + protected function visitLimitation(Generator $generator, Limitation $limitation): void { $generator->startHashElement('limitation'); @@ -139,12 +110,8 @@ protected function visitLimitation(Generator $generator, Limitation $limitation) /** * Serializes the given $sortField to a string representation. - * - * @param int $sortField - * - * @return string */ - protected function serializeSortField($sortField) + protected function serializeSortField(int $sortField): string { switch ($sortField) { case Location::SORT_FIELD_PATH: @@ -176,12 +143,8 @@ protected function serializeSortField($sortField) /** * Serializes the given $sortOrder to a string representation. - * - * @param int $sortOrder - * - * @return string */ - protected function serializeSortOrder($sortOrder) + protected function serializeSortOrder(int $sortOrder): string { switch ($sortOrder) { case Location::SORT_ORDER_ASC: diff --git a/src/contracts/Output/Visitor.php b/src/contracts/Output/Visitor.php index e4d1ebce6..277197938 100644 --- a/src/contracts/Output/Visitor.php +++ b/src/contracts/Output/Visitor.php @@ -64,8 +64,6 @@ public function setHeader(string $name, mixed $value): void * Sets the given status code in the corresponding header. * * Note that headers are generally not overwritten! - * - * @param int $statusCode */ public function setStatus(int $statusCode): void { diff --git a/src/lib/FieldTypeProcessor/AuthorProcessor.php b/src/lib/FieldTypeProcessor/AuthorProcessor.php index 7f37d3464..f10c047fc 100644 --- a/src/lib/FieldTypeProcessor/AuthorProcessor.php +++ b/src/lib/FieldTypeProcessor/AuthorProcessor.php @@ -12,37 +12,25 @@ class AuthorProcessor extends FieldTypeProcessor { - /** - * {@inheritdoc} - */ - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { if (isset($incomingSettingsHash['defaultAuthor'])) { - switch ($incomingSettingsHash['defaultAuthor']) { - case 'DEFAULT_CURRENT_USER': - $incomingSettingsHash['defaultAuthor'] = Type::DEFAULT_CURRENT_USER; - break; - default: - $incomingSettingsHash['defaultAuthor'] = Type::DEFAULT_VALUE_EMPTY; - } + $incomingSettingsHash['defaultAuthor'] = match ($incomingSettingsHash['defaultAuthor']) { + 'DEFAULT_CURRENT_USER' => Type::DEFAULT_CURRENT_USER, + default => Type::DEFAULT_VALUE_EMPTY, + }; } return $incomingSettingsHash; } - /** - * {@inheritdoc} - */ - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { if (isset($outgoingSettingsHash['defaultAuthor'])) { - switch ($outgoingSettingsHash['defaultAuthor']) { - case Type::DEFAULT_CURRENT_USER: - $outgoingSettingsHash['defaultAuthor'] = 'DEFAULT_CURRENT_USER'; - break; - default: - $outgoingSettingsHash['defaultAuthor'] = 'DEFAULT_VALUE_EMPTY'; - } + $outgoingSettingsHash['defaultAuthor'] = match ($outgoingSettingsHash['defaultAuthor']) { + Type::DEFAULT_CURRENT_USER => 'DEFAULT_CURRENT_USER', + default => 'DEFAULT_VALUE_EMPTY', + }; } return $outgoingSettingsHash; diff --git a/src/lib/FieldTypeProcessor/BaseRelationProcessor.php b/src/lib/FieldTypeProcessor/BaseRelationProcessor.php index 4b075a556..b9d864917 100644 --- a/src/lib/FieldTypeProcessor/BaseRelationProcessor.php +++ b/src/lib/FieldTypeProcessor/BaseRelationProcessor.php @@ -20,46 +20,27 @@ abstract class BaseRelationProcessor extends FieldTypeProcessor private ?LocationService $locationService = null; - /** - * @param \Symfony\Component\Routing\RouterInterface $router - */ public function setRouter(RouterInterface $router): void { $this->router = $router; } - /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - */ public function setLocationService(LocationService $locationService): void { $this->locationService = $locationService; } - /** - * @return bool - */ - public function canMapContentHref() + public function canMapContentHref(): bool { return isset($this->router); } - /** - * @param int $contentId - * - * @return string - */ - public function mapToContentHref($contentId) + public function mapToContentHref(int $contentId): ?string { return $this->router?->generate('ibexa.rest.load_content', ['contentId' => $contentId]) ?? ''; } - /** - * @param int $locationId - * - * @return string - */ - public function mapToLocationHref(int $locationId) + public function mapToLocationHref(int $locationId): ?string { try { $location = $this->locationService?->loadLocation($locationId); @@ -76,7 +57,7 @@ public function mapToLocationHref(int $locationId) ]) ?? ''; } - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { if (isset($incomingSettingsHash['selectionMethod'])) { switch ($incomingSettingsHash['selectionMethod']) { @@ -91,7 +72,7 @@ public function preProcessFieldSettingsHash($incomingSettingsHash) return $incomingSettingsHash; } - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { if (isset($outgoingSettingsHash['selectionMethod'])) { switch ($outgoingSettingsHash['selectionMethod']) { diff --git a/src/lib/FieldTypeProcessor/BinaryInputProcessor.php b/src/lib/FieldTypeProcessor/BinaryInputProcessor.php index cd084fe11..55401ce53 100644 --- a/src/lib/FieldTypeProcessor/BinaryInputProcessor.php +++ b/src/lib/FieldTypeProcessor/BinaryInputProcessor.php @@ -11,23 +11,14 @@ abstract class BinaryInputProcessor extends FieldTypeProcessor { - /** - * @var string - */ - protected $temporaryDirectory; - - /** - * @param string $temporaryDirectory - */ - public function __construct($temporaryDirectory) + protected string $temporaryDirectory; + + public function __construct(string $temporaryDirectory) { $this->temporaryDirectory = $temporaryDirectory; } - /** - * {@inheritdoc} - */ - public function preProcessValueHash($incomingValueHash) + public function preProcessValueHash(mixed $incomingValueHash): mixed { if (isset($incomingValueHash['data'])) { $tempFile = tempnam($this->temporaryDirectory, 'eZ_REST_BinaryFile'); diff --git a/src/lib/FieldTypeProcessor/BinaryProcessor.php b/src/lib/FieldTypeProcessor/BinaryProcessor.php index ac9cb9958..edf317252 100644 --- a/src/lib/FieldTypeProcessor/BinaryProcessor.php +++ b/src/lib/FieldTypeProcessor/BinaryProcessor.php @@ -10,28 +10,19 @@ class BinaryProcessor extends BinaryInputProcessor { /** - * Host prefix for uris, without a leading /. + * Host prefix for uris, without a leading '/'. * * @todo Refactor such transformation with a service that receives the request and has the host - * - * @var string */ - protected $hostPrefix; + protected string $hostPrefix; - /** - * @param string $temporaryDirectory - * @param string $hostPrefix - */ - public function __construct($temporaryDirectory, $hostPrefix) + public function __construct(string $temporaryDirectory, string $hostPrefix) { parent::__construct($temporaryDirectory); $this->hostPrefix = $hostPrefix; } - /** - * {@inheritdoc} - */ - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): mixed { if (!is_array($outgoingValueHash)) { return $outgoingValueHash; @@ -49,10 +40,8 @@ public function postProcessValueHash($outgoingValueHash) * Generates a URL for $path. * * @param string $path absolute url - * - * @return string */ - protected function generateUrl($path) + protected function generateUrl(string $path): string { $url = $path; if ($this->hostPrefix) { diff --git a/src/lib/FieldTypeProcessor/DateAndTimeProcessor.php b/src/lib/FieldTypeProcessor/DateAndTimeProcessor.php index 5c64a4ee3..6b027cf55 100644 --- a/src/lib/FieldTypeProcessor/DateAndTimeProcessor.php +++ b/src/lib/FieldTypeProcessor/DateAndTimeProcessor.php @@ -12,10 +12,7 @@ class DateAndTimeProcessor extends FieldTypeProcessor { - /** - * {@inheritdoc} - */ - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { if (isset($incomingSettingsHash['defaultType'])) { switch ($incomingSettingsHash['defaultType']) { @@ -36,7 +33,7 @@ public function preProcessFieldSettingsHash($incomingSettingsHash) /** * {@inheritdoc} */ - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { if (isset($outgoingSettingsHash['defaultType'])) { switch ($outgoingSettingsHash['defaultType']) { diff --git a/src/lib/FieldTypeProcessor/DateProcessor.php b/src/lib/FieldTypeProcessor/DateProcessor.php index cd3e846e3..c7f123b01 100644 --- a/src/lib/FieldTypeProcessor/DateProcessor.php +++ b/src/lib/FieldTypeProcessor/DateProcessor.php @@ -12,10 +12,7 @@ class DateProcessor extends FieldTypeProcessor { - /** - * {@inheritdoc} - */ - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { if (isset($incomingSettingsHash['defaultType'])) { switch ($incomingSettingsHash['defaultType']) { @@ -30,10 +27,7 @@ public function preProcessFieldSettingsHash($incomingSettingsHash) return $incomingSettingsHash; } - /** - * {@inheritdoc} - */ - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { if (isset($outgoingSettingsHash['defaultType'])) { switch ($outgoingSettingsHash['defaultType']) { diff --git a/src/lib/FieldTypeProcessor/FloatProcessor.php b/src/lib/FieldTypeProcessor/FloatProcessor.php index 0c9da5363..6e3b4fcce 100644 --- a/src/lib/FieldTypeProcessor/FloatProcessor.php +++ b/src/lib/FieldTypeProcessor/FloatProcessor.php @@ -11,10 +11,7 @@ class FloatProcessor extends FieldTypeProcessor { - /** - * {@inheritdoc} - */ - public function preProcessValueHash($incomingValueHash) + public function preProcessValueHash(mixed $incomingValueHash): mixed { if (is_numeric($incomingValueHash)) { $incomingValueHash = (float)$incomingValueHash; diff --git a/src/lib/FieldTypeProcessor/ImageAssetFieldTypeProcessor.php b/src/lib/FieldTypeProcessor/ImageAssetFieldTypeProcessor.php index 181707a2e..1c6e8dcd0 100644 --- a/src/lib/FieldTypeProcessor/ImageAssetFieldTypeProcessor.php +++ b/src/lib/FieldTypeProcessor/ImageAssetFieldTypeProcessor.php @@ -37,7 +37,7 @@ public function __construct( $this->configMappings = $configMappings; } - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): mixed { if (!\is_array($outgoingValueHash)) { return $outgoingValueHash; diff --git a/src/lib/FieldTypeProcessor/ImageProcessor.php b/src/lib/FieldTypeProcessor/ImageProcessor.php index baac98298..a6d8baf3f 100644 --- a/src/lib/FieldTypeProcessor/ImageProcessor.php +++ b/src/lib/FieldTypeProcessor/ImageProcessor.php @@ -13,10 +13,8 @@ class ImageProcessor extends BinaryInputProcessor { /** * Template for image URLs. - * - * @var string */ - protected $urlTemplate; + protected string $urlTemplate; /** * Array of variations identifiers. @@ -32,18 +30,16 @@ class ImageProcessor extends BinaryInputProcessor protected RouterInterface $router; /** - * @param string $temporaryDirectory - * @param \Symfony\Component\Routing\RouterInterface $router * @param array $variations array of variations identifiers */ - public function __construct($temporaryDirectory, RouterInterface $router, array $variations) + public function __construct(string $temporaryDirectory, RouterInterface $router, array $variations) { parent::__construct($temporaryDirectory); $this->router = $router; $this->variations = $variations; } - public function preProcessValueHash($incomingValueHash) + public function preProcessValueHash(mixed $incomingValueHash): mixed { if (is_array($incomingValueHash) && array_key_exists('variations', $incomingValueHash)) { unset($incomingValueHash['variations']); @@ -55,7 +51,7 @@ public function preProcessValueHash($incomingValueHash) /** * {@inheritdoc} */ - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): mixed { if (!is_array($outgoingValueHash)) { return $outgoingValueHash; @@ -79,13 +75,8 @@ public function postProcessValueHash($outgoingValueHash) /** * Generates a URL for $path in $variation. - * - * @param string $path - * @param string $variation - * - * @return string */ - protected function generateUrl($path, $variation): string + protected function generateUrl(string $path, string $variation): string { $fieldId = ''; $versionNo = ''; diff --git a/src/lib/FieldTypeProcessor/MediaProcessor.php b/src/lib/FieldTypeProcessor/MediaProcessor.php index fb15f604a..141af2319 100644 --- a/src/lib/FieldTypeProcessor/MediaProcessor.php +++ b/src/lib/FieldTypeProcessor/MediaProcessor.php @@ -11,10 +11,7 @@ class MediaProcessor extends BinaryInputProcessor { - /** - * {@inheritdoc} - */ - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { if (isset($incomingSettingsHash['mediaType'])) { switch ($incomingSettingsHash['mediaType']) { @@ -44,10 +41,7 @@ public function preProcessFieldSettingsHash($incomingSettingsHash) return $incomingSettingsHash; } - /** - * {@inheritdoc} - */ - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { if (isset($outgoingSettingsHash['mediaType'])) { switch ($outgoingSettingsHash['mediaType']) { diff --git a/src/lib/FieldTypeProcessor/RelationListProcessor.php b/src/lib/FieldTypeProcessor/RelationListProcessor.php index b214f6260..8f593eaf6 100644 --- a/src/lib/FieldTypeProcessor/RelationListProcessor.php +++ b/src/lib/FieldTypeProcessor/RelationListProcessor.php @@ -12,12 +12,8 @@ class RelationListProcessor extends BaseRelationProcessor /** * In addition to the list of destinationContentIds, adds a destinationContentHrefs * array, with matching content uris. - * - * @param array $outgoingValueHash - * - * @return array */ - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): array { if ( !isset($outgoingValueHash['destinationContentIds']) || @@ -28,7 +24,7 @@ public function postProcessValueHash($outgoingValueHash) } $outgoingValueHash['destinationContentHrefs'] = array_map( - function ($contentId) { + function ($contentId): ?string { return $this->mapToContentHref($contentId); }, $outgoingValueHash['destinationContentIds'] @@ -37,7 +33,7 @@ function ($contentId) { return $outgoingValueHash; } - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { $outgoingSettingsHash = parent::postProcessFieldSettingsHash($outgoingSettingsHash); diff --git a/src/lib/FieldTypeProcessor/RelationProcessor.php b/src/lib/FieldTypeProcessor/RelationProcessor.php index 69715174a..84fa4cda4 100644 --- a/src/lib/FieldTypeProcessor/RelationProcessor.php +++ b/src/lib/FieldTypeProcessor/RelationProcessor.php @@ -11,12 +11,8 @@ class RelationProcessor extends BaseRelationProcessor { /** * In addition to the destinationContentId, adds a destinationContentHref entry. - * - * @param array $outgoingValueHash - * - * @return array */ - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): mixed { if (!isset($outgoingValueHash['destinationContentId']) || !$this->canMapContentHref()) { return $outgoingValueHash; @@ -29,7 +25,7 @@ public function postProcessValueHash($outgoingValueHash) return $outgoingValueHash; } - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { $outgoingSettingsHash = parent::postProcessFieldSettingsHash($outgoingSettingsHash); diff --git a/src/lib/FieldTypeProcessor/StringProcessor.php b/src/lib/FieldTypeProcessor/StringProcessor.php index 90790d56b..9ff020eb3 100644 --- a/src/lib/FieldTypeProcessor/StringProcessor.php +++ b/src/lib/FieldTypeProcessor/StringProcessor.php @@ -11,10 +11,7 @@ class StringProcessor extends FieldTypeProcessor { - /** - * {@inheritdoc} - */ - public function preProcessValueHash($incomingValueHash): string + public function preProcessValueHash(mixed $incomingValueHash): string { return (string) $incomingValueHash; } diff --git a/src/lib/FieldTypeProcessor/TimeProcessor.php b/src/lib/FieldTypeProcessor/TimeProcessor.php index 7fabd6271..df6d78bf8 100644 --- a/src/lib/FieldTypeProcessor/TimeProcessor.php +++ b/src/lib/FieldTypeProcessor/TimeProcessor.php @@ -12,10 +12,7 @@ class TimeProcessor extends FieldTypeProcessor { - /** - * {@inheritdoc} - */ - public function preProcessFieldSettingsHash($incomingSettingsHash) + public function preProcessFieldSettingsHash(mixed $incomingSettingsHash): mixed { if (isset($incomingSettingsHash['defaultType'])) { switch ($incomingSettingsHash['defaultType']) { @@ -30,10 +27,7 @@ public function preProcessFieldSettingsHash($incomingSettingsHash) return $incomingSettingsHash; } - /** - * {@inheritdoc} - */ - public function postProcessFieldSettingsHash($outgoingSettingsHash) + public function postProcessFieldSettingsHash(mixed $outgoingSettingsHash): mixed { if (isset($outgoingSettingsHash['defaultType'])) { switch ($outgoingSettingsHash['defaultType']) { diff --git a/src/lib/FieldTypeProcessor/UserProcessor.php b/src/lib/FieldTypeProcessor/UserProcessor.php index 25cd0dd76..4c4033ac3 100644 --- a/src/lib/FieldTypeProcessor/UserProcessor.php +++ b/src/lib/FieldTypeProcessor/UserProcessor.php @@ -11,7 +11,7 @@ class UserProcessor extends FieldTypeProcessor { - public function preProcessValueHash($incomingValueHash) + public function preProcessValueHash(mixed $incomingValueHash): mixed { // For BC with usage in Platform UI 1.x if (isset($incomingValueHash['password'])) { @@ -22,7 +22,7 @@ public function preProcessValueHash($incomingValueHash) return $incomingValueHash; } - public function postProcessValueHash($outgoingValueHash) + public function postProcessValueHash(mixed $outgoingValueHash): mixed { unset($outgoingValueHash['passwordHash'], $outgoingValueHash['passwordHashType']); diff --git a/src/lib/FieldTypeProcessorRegistry.php b/src/lib/FieldTypeProcessorRegistry.php index 62e852667..77b366e17 100644 --- a/src/lib/FieldTypeProcessorRegistry.php +++ b/src/lib/FieldTypeProcessorRegistry.php @@ -33,23 +33,16 @@ public function __construct(array $processors = []) /** * Registers $processor for $fieldTypeIdentifier. - * - * @param string $fieldTypeIdentifier - * @param \Ibexa\Contracts\Rest\FieldTypeProcessor $processor */ - public function registerProcessor($fieldTypeIdentifier, FieldTypeProcessor $processor): void + public function registerProcessor(string $fieldTypeIdentifier, FieldTypeProcessor $processor): void { $this->processors[$fieldTypeIdentifier] = $processor; } /** * Returns if a processor is registered for $fieldTypeIdentifier. - * - * @param string $fieldTypeIdentifier - * - * @return bool */ - public function hasProcessor($fieldTypeIdentifier): bool + public function hasProcessor(string $fieldTypeIdentifier): bool { return isset($this->processors[$fieldTypeIdentifier]); } @@ -57,13 +50,9 @@ public function hasProcessor($fieldTypeIdentifier): bool /** * Returns the processor for $fieldTypeIdentifier. * - * @param string $fieldTypeIdentifier - * * @throws \RuntimeException if not processor is registered for $fieldTypeIdentifier - * - * @return \Ibexa\Contracts\Rest\FieldTypeProcessor */ - public function getProcessor($fieldTypeIdentifier) + public function getProcessor(string $fieldTypeIdentifier): FieldTypeProcessor { if (!$this->hasProcessor($fieldTypeIdentifier)) { throw new \RuntimeException( diff --git a/src/lib/Input/Dispatcher.php b/src/lib/Input/Dispatcher.php index 9104a9c8b..acc1d2eeb 100644 --- a/src/lib/Input/Dispatcher.php +++ b/src/lib/Input/Dispatcher.php @@ -31,14 +31,13 @@ class Dispatcher * * @var \Ibexa\Contracts\Rest\Input\Handler[] */ - protected $handlers = []; + protected array $handlers = []; protected ParsingDispatcher $parsingDispatcher; /** * Construct from optional parsers array. * - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher * @param \Ibexa\Contracts\Rest\Input\Handler[] $handlers */ public function __construct(ParsingDispatcher $parsingDispatcher, array $handlers = []) @@ -51,23 +50,16 @@ public function __construct(ParsingDispatcher $parsingDispatcher, array $handler /** * Adds another handler for the given content type. - * - * @param string $type - * @param \Ibexa\Contracts\Rest\Input\Handler $handler */ - public function addHandler($type, Handler $handler): void + public function addHandler(string $type, Handler $handler): void { $this->handlers[$type] = $handler; } /** * Parse provided request. - * - * @param \Ibexa\Rest\Message $message - * - * @return mixed */ - public function parse(Message $message) + public function parse(Message $message): mixed { if (!isset($message->headers['Content-Type'])) { throw new Exceptions\Parser('Missing Content-Type header in message.'); @@ -99,7 +91,7 @@ public function parse(Message $message) $rawArray = $this->handlers[$format]->convert($message->body); // Only 1 XML root node - $rootNodeArray = reset($rawArray) ?: []; + $rootNodeArray = is_array($rawArray) ? reset($rawArray) : []; // @todo: This needs to be refactored in order to make the called URL // available to parsers in the server in a sane way diff --git a/src/lib/Input/FieldTypeParser.php b/src/lib/Input/FieldTypeParser.php index c07b0be6c..83247060f 100644 --- a/src/lib/Input/FieldTypeParser.php +++ b/src/lib/Input/FieldTypeParser.php @@ -22,12 +22,6 @@ class FieldTypeParser protected FieldTypeProcessorRegistry $fieldTypeProcessorRegistry; - /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\FieldTypeService $fieldTypeService - * @param \Ibexa\Rest\FieldTypeProcessorRegistry $fieldTypeProcessorRegistry - */ public function __construct( ContentService $contentService, ContentTypeService $contentTypeService, @@ -73,11 +67,6 @@ public function parseValue(string $fieldTypeIdentifier, mixed $value): mixed /** * Parses the given $settingsHash using the FieldType identified by * $fieldTypeIdentifier. - * - * @param string $fieldTypeIdentifier - * @param mixed $settingsHash - * - * @return mixed */ public function parseFieldSettings(string $fieldTypeIdentifier, mixed $settingsHash): mixed { @@ -95,12 +84,9 @@ public function parseFieldSettings(string $fieldTypeIdentifier, mixed $settingsH * Parses the given $configurationHash using the FieldType identified by * $fieldTypeIdentifier. * - * @param string $fieldTypeIdentifier - * @param mixed $configurationHash - * - * @return mixed + * @param array $configurationHash */ - public function parseValidatorConfiguration($fieldTypeIdentifier, $configurationHash) + public function parseValidatorConfiguration(string $fieldTypeIdentifier, array $configurationHash): mixed { if ($this->fieldTypeProcessorRegistry->hasProcessor($fieldTypeIdentifier)) { $fieldTypeProcessor = $this->fieldTypeProcessorRegistry->getProcessor($fieldTypeIdentifier); diff --git a/src/lib/Input/Handler/Json.php b/src/lib/Input/Handler/Json.php index 768464dc8..d148a582a 100644 --- a/src/lib/Input/Handler/Json.php +++ b/src/lib/Input/Handler/Json.php @@ -18,13 +18,9 @@ class Json extends Handler /** * Converts the given string to an array structure. * - * @throw Ibexa\Contracts\Rest\Exceptions\Parser - * - * @param string $string - * - * @return array + * @throws \Ibexa\Contracts\Rest\Exceptions\Parser */ - public function convert($string) + public function convert(string $string): array { $json = json_decode($string, true); if (JSON_ERROR_NONE !== ($jsonErrorCode = json_last_error())) { @@ -39,10 +35,6 @@ public function convert($string) /** * Returns the error message associated with the $jsonErrorCode. - * - * @param $jsonErrorCode - * - * @return string */ private function jsonDecodeErrorMessage(int $jsonErrorCode): string { diff --git a/src/lib/Input/Handler/Xml.php b/src/lib/Input/Handler/Xml.php index 50d082dfc..63a1f6fb4 100644 --- a/src/lib/Input/Handler/Xml.php +++ b/src/lib/Input/Handler/Xml.php @@ -7,6 +7,9 @@ namespace Ibexa\Rest\Input\Handler; +use DOMElement; +use DOMNode; +use DOMNodeList; use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Contracts\Rest\Input\Handler; @@ -20,10 +23,8 @@ class Xml extends Handler * * The key defines the item in which a list is formed. A list is then * formed for every value in the value array. - * - * @var array */ - protected $forceList = [ + protected array $forceList = [ 'ContentList' => [ 'Content', ], @@ -71,7 +72,10 @@ class Xml extends Handler ], ]; - protected $fieldTypeHashElements = [ + /** + * @var list + */ + protected array $fieldTypeHashElements = [ 'fieldValue', 'defaultValue', 'fieldSettings', @@ -80,12 +84,8 @@ class Xml extends Handler /** * Converts the given string to an array structure. - * - * @param string $string - * - * @return array */ - public function convert($string) + public function convert(string $string): array|string|int|bool|float|null { $oldXmlErrorHandling = libxml_use_internal_errors(true); libxml_clear_errors(); @@ -118,24 +118,20 @@ public function convert($string) /** * Converts DOM nodes to array structures. - * - * @param \DOMNode $node - * - * @return array */ - protected function convertDom(\DOMNode $node) + protected function convertDom(DOMNode $node): array|string|int|bool|float|null { $isArray = false; $current = []; $text = ''; - if ($node instanceof \DOMElement && $node->hasAttributes()) { + if ($node instanceof DOMElement && $node->hasAttributes()) { foreach ($node->attributes as $name => $attribute) { $current["_{$name}"] = $attribute->value; } } - $parentTagName = $node instanceof \DOMElement ? $node->tagName : false; + $parentTagName = $node instanceof DOMElement ? $node->tagName : false; foreach ($node->childNodes as $childNode) { switch ($childNode->nodeType) { case XML_ELEMENT_NODE: @@ -188,12 +184,7 @@ protected function convertDom(\DOMNode $node) return $current; } - /** - * @param \DOMElement $domElement - * - * @return array|string|null - */ - protected function parseFieldTypeHash(\DOMElement $domElement) + protected function parseFieldTypeHash(DOMElement $domElement): array|string|int|bool|float|null { $result = $this->parseFieldTypeValues($domElement->childNodes); @@ -207,12 +198,8 @@ protected function parseFieldTypeHash(\DOMElement $domElement) /** * Parses a node list of elements. - * - * @param \DOMNodeList $valueNodes - * - * @return array|string */ - protected function parseFieldTypeValues(\DOMNodeList $valueNodes) + protected function parseFieldTypeValues(DOMNodeList $valueNodes): array|string|int|bool|float { $resultValues = []; $resultString = ''; @@ -257,12 +244,8 @@ protected function parseFieldTypeValues(\DOMNodeList $valueNodes) /** * Attempts to cast the given $stringValue into a sensible scalar type. - * - * @param string $stringValue - * - * @return mixed */ - protected function castScalarValue($stringValue) + protected function castScalarValue(string $stringValue): string|int|bool|float { switch (true) { case ctype_digit($stringValue): diff --git a/src/lib/Input/Parser/ContentObjectStates.php b/src/lib/Input/Parser/ContentObjectStates.php index a0c5c0847..1d49d046e 100644 --- a/src/lib/Input/Parser/ContentObjectStates.php +++ b/src/lib/Input/Parser/ContentObjectStates.php @@ -21,9 +21,6 @@ class ContentObjectStates extends BaseParser /** * Parse input structure. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @return \Ibexa\Rest\Values\RestObjectState[] */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): array diff --git a/src/lib/Input/ParserTools.php b/src/lib/Input/ParserTools.php index 5773769b2..f56c650c7 100644 --- a/src/lib/Input/ParserTools.php +++ b/src/lib/Input/ParserTools.php @@ -34,8 +34,6 @@ class ParserTools { /** * Parses the given $objectElement, if it contains embedded data. - * - * @param array $objectElement */ public function parseObjectElement(array $objectElement, ParsingDispatcher $parsingDispatcher): string { @@ -52,8 +50,6 @@ public function parseObjectElement(array $objectElement, ParsingDispatcher $pars /** * Returns if the given $objectElement has embedded object data or is only * a reference. - * - * @param array $objectElement */ public function isEmbeddedObject(array $objectElement): bool { @@ -69,18 +65,12 @@ public function isEmbeddedObject(array $objectElement): bool /** * Parses a translatable list, like names or descriptions. - * - * @param array $listElement - * - * @return array */ public function parseTranslatableList(array $listElement): array { $listItems = []; foreach ($listElement['value'] as $valueRow) { - $listItems[$valueRow['_languageCode']] = isset($valueRow['#text']) ? - $valueRow['#text'] : - ''; + $listItems[$valueRow['_languageCode']] = $valueRow['#text'] ?? ''; } return $listItems; @@ -171,8 +161,6 @@ public function parseDefaultSortOrder(string $defaultSortOrderString): int /** * Parses the input structure to Limitation object. - * - * @param array $limitation */ public function parseLimitation(array $limitation): Limitation { diff --git a/src/lib/Message.php b/src/lib/Message.php index 674d9c441..9181558ed 100644 --- a/src/lib/Message.php +++ b/src/lib/Message.php @@ -13,34 +13,15 @@ class Message { /** - * Response headers. - * - * @var array + * @var array */ - public $headers; + public array $headers; - /** - * Response body. - * - * @var string - */ - public $body; + public string $body; - /** - * HTTP status code. - * - * @var int - */ - public $statusCode; + public int $statusCode; - /** - * Construct from headers and body. - * - * @param array $headers - * @param string $body - * @param int $statusCode - */ - public function __construct(array $headers = [], $body = '', $statusCode = 200) + public function __construct(array $headers = [], string $body = '', int $statusCode = 200) { $this->headers = $headers; $this->body = $body; diff --git a/src/lib/Output/FieldTypeSerializer.php b/src/lib/Output/FieldTypeSerializer.php index abb7e8a11..adfbe124c 100644 --- a/src/lib/Output/FieldTypeSerializer.php +++ b/src/lib/Output/FieldTypeSerializer.php @@ -18,17 +18,10 @@ */ class FieldTypeSerializer { - /** - * FieldTypeService. - */ protected FieldTypeService $fieldTypeService; protected FieldTypeProcessorRegistry $fieldTypeProcessorRegistry; - /** - * @param \Ibexa\Contracts\Core\Repository\FieldTypeService $fieldTypeService - * @param \Ibexa\Rest\FieldTypeProcessorRegistry $fieldTypeProcessorRegistry - */ public function __construct(FieldTypeService $fieldTypeService, FieldTypeProcessorRegistry $fieldTypeProcessorRegistry) { $this->fieldTypeService = $fieldTypeService; @@ -52,12 +45,8 @@ public function serializeContentFieldValue(Generator $generator, Field $field): /** * Serializes the $defaultValue for $fieldDefIdentifier through $generator. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param string $fieldTypeIdentifier - * @param mixed $defaultValue */ - public function serializeFieldDefaultValue(Generator $generator, $fieldTypeIdentifier, $defaultValue): void + public function serializeFieldDefaultValue(Generator $generator, string $fieldTypeIdentifier, mixed $defaultValue): void { $this->serializeValue( 'defaultValue', @@ -70,12 +59,8 @@ public function serializeFieldDefaultValue(Generator $generator, $fieldTypeIdent /** * Serializes $settings as fieldSettings for $fieldDefinition using * $generator. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param string $fieldTypeIdentifier - * @param mixed $settings */ - public function serializeFieldSettings(Generator $generator, $fieldTypeIdentifier, $settings): void + public function serializeFieldSettings(Generator $generator, string $fieldTypeIdentifier, mixed $settings): void { $fieldType = $this->fieldTypeService->getFieldType($fieldTypeIdentifier); $hash = $fieldType->fieldSettingsToHash($settings); @@ -90,12 +75,8 @@ public function serializeFieldSettings(Generator $generator, $fieldTypeIdentifie /** * Serializes $validatorConfiguration for $fieldDefinition using $generator. - * - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param string $fieldTypeIdentifier - * @param mixed $validatorConfiguration */ - public function serializeValidatorConfiguration(Generator $generator, $fieldTypeIdentifier, $validatorConfiguration): void + public function serializeValidatorConfiguration(Generator $generator, string $fieldTypeIdentifier, mixed $validatorConfiguration): void { $fieldType = $this->fieldTypeService->getFieldType($fieldTypeIdentifier); $hash = $fieldType->validatorConfigurationToHash($validatorConfiguration); @@ -110,10 +91,6 @@ public function serializeValidatorConfiguration(Generator $generator, $fieldType /** * Returns the field type with $fieldTypeIdentifier. - * - * @param string $fieldTypeIdentifier - * - * @return \Ibexa\Contracts\Core\Repository\FieldType */ protected function getFieldType(string $fieldTypeIdentifier): FieldType { @@ -125,13 +102,8 @@ protected function getFieldType(string $fieldTypeIdentifier): FieldType /** * Serializes the given $value for $fieldType with $generator into * $elementName. - * - * @param string $elementName - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param \Ibexa\Contracts\Core\Repository\FieldType $fieldType - * @param mixed $value */ - protected function serializeValue($elementName, Generator $generator, FieldType $fieldType, $value) + protected function serializeValue(string $elementName, Generator $generator, FieldType $fieldType, mixed $value): void { $hash = $fieldType->toHash($value); @@ -146,12 +118,8 @@ protected function serializeValue($elementName, Generator $generator, FieldType /** * Serializes the given $hash with $generator into $elementName. - * - * @param string $elementName - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param mixed $hash */ - protected function serializeHash(string $elementName, Generator $generator, $hash) + protected function serializeHash(string $elementName, Generator $generator, mixed $hash): void { $generator->generateFieldTypeHash($elementName, $hash); } diff --git a/src/lib/Output/Generator/Json.php b/src/lib/Output/Generator/Json.php index 7383b0bc2..19917a177 100644 --- a/src/lib/Output/Generator/Json.php +++ b/src/lib/Output/Generator/Json.php @@ -85,7 +85,7 @@ public function getMediaType(string $name): string } #[\Override] - public function serializeBool(mixed $boolValue): bool + public function serializeBool(bool|string|null $boolValue): bool { return (bool)$boolValue; } diff --git a/src/lib/Output/Generator/Xml.php b/src/lib/Output/Generator/Xml.php index 3ad2dfd59..cb9c64e9f 100644 --- a/src/lib/Output/Generator/Xml.php +++ b/src/lib/Output/Generator/Xml.php @@ -58,7 +58,7 @@ public function startAttribute(string $name, mixed $value): void } #[\Override] - public function serializeBool(mixed $boolValue): string + public function serializeBool(bool|string|null $boolValue): string { return $boolValue ? 'true' : 'false'; } diff --git a/src/lib/Output/ValueObjectVisitor/ContentObjectStates.php b/src/lib/Output/ValueObjectVisitor/ContentObjectStates.php index 2d4877d45..6df817afc 100644 --- a/src/lib/Output/ValueObjectVisitor/ContentObjectStates.php +++ b/src/lib/Output/ValueObjectVisitor/ContentObjectStates.php @@ -19,11 +19,9 @@ class ContentObjectStates extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Values\ContentObjectStates $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentObjectStates'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentObjectStates')); diff --git a/src/lib/Security/AuthorizationHeaderRESTRequestMatcher.php b/src/lib/Security/AuthorizationHeaderRESTRequestMatcher.php index d37b8915c..5323a05c7 100644 --- a/src/lib/Security/AuthorizationHeaderRESTRequestMatcher.php +++ b/src/lib/Security/AuthorizationHeaderRESTRequestMatcher.php @@ -21,7 +21,7 @@ final class AuthorizationHeaderRESTRequestMatcher implements RequestMatcherInter private const string DEFAULT_HEADER_NAME = 'Authorization'; public function __construct( - private ?string $headerName = null, + private readonly ?string $headerName = null, ) { } diff --git a/src/lib/Server/Controller/BinaryContent.php b/src/lib/Server/Controller/BinaryContent.php index c0bb531fa..3ee9db8c5 100644 --- a/src/lib/Server/Controller/BinaryContent.php +++ b/src/lib/Server/Controller/BinaryContent.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\InvalidVariationException; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use Ibexa\Contracts\Core\Variation\Values\Variation; use Ibexa\Contracts\Core\Variation\VariationHandler; use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Core\FieldType\Image\Value as ImageValue; @@ -37,17 +38,16 @@ public function __construct( * Returns data about the image variation $variationIdentifier of image field $fieldId. * Will generate the alias if it hasn't been generated yet. * - * @param mixed $imageId A custom ID that identifies the image field. + * @param string $imageId A custom ID that identifies the image field. * Until v6.9, the format is {contentId}-{fieldId}. * since v6.9, the format is {contentId}-{fieldId}-{versionNumber}. * If the version number isn't specified, the default one is used. - * @param string $variationIdentifier * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException - * - * @return \Ibexa\Contracts\Core\Variation\Values\Variation + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function getImageVariation($imageId, $variationIdentifier) + public function getImageVariation(string $imageId, string $variationIdentifier): Variation|CachedValue { [$contentId, $fieldId, $versionNumber] = $this->parseImageId($imageId); $content = $this->repository->getContentService()->loadContent($contentId, null, $versionNumber); @@ -105,7 +105,7 @@ public function getImageVariation($imageId, $variationIdentifier) * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException If the imageId format is invalid */ - private function parseImageId($imageId): array + private function parseImageId(string $imageId): array { $idArray = explode('-', $imageId); $idArray = array_map('intval', $idArray); diff --git a/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php b/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php index e27219eeb..def87ee97 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php @@ -65,9 +65,6 @@ class BookmarkCreateController extends RestController /** * Bookmark constructor. - * - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService */ public function __construct(BookmarkService $bookmarkService, LocationService $locationService) { diff --git a/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php b/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php index 58bff1494..68d39f048 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php @@ -17,7 +17,6 @@ use Ibexa\Rest\Server\Controller as RestController; use Ibexa\Rest\Server\Values; use Ibexa\Rest\Value as RestValue; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; #[Delete( @@ -59,9 +58,6 @@ class BookmarkDeleteController extends RestController /** * Bookmark constructor. - * - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService */ public function __construct(BookmarkService $bookmarkService, LocationService $locationService) { @@ -72,15 +68,11 @@ public function __construct(BookmarkService $bookmarkService, LocationService $l /** * Deletes a given bookmark. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param int $locationId * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * - * @return \Ibexa\Rest\Value */ - public function deleteBookmark(Request $request, int $locationId): RestValue + public function deleteBookmark(int $locationId): RestValue { $location = $this->locationService->loadLocation($locationId); diff --git a/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php b/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php index 76a7fbfdc..11ef07b15 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php @@ -15,7 +15,6 @@ use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Rest\Server\Controller as RestController; use Ibexa\Rest\Server\Values; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; #[Head( @@ -57,9 +56,6 @@ class BookmarkIsBookmarkedController extends RestController /** * Bookmark constructor. - * - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService */ public function __construct(BookmarkService $bookmarkService, LocationService $locationService) { @@ -68,17 +64,13 @@ public function __construct(BookmarkService $bookmarkService, LocationService $l } /** - * Checks if given location is bookmarked. + * Checks if a given location is bookmarked. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param int $locationId * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * - * @return \Ibexa\Rest\Server\Values\OK */ - public function isBookmarked(Request $request, int $locationId): Values\OK + public function isBookmarked(int $locationId): Values\OK { $location = $this->locationService->loadLocation($locationId); diff --git a/src/lib/Server/Controller/Bookmark/BookmarkListController.php b/src/lib/Server/Controller/Bookmark/BookmarkListController.php index 15caf9ec3..ad73fa2db 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkListController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkListController.php @@ -70,9 +70,6 @@ class BookmarkListController extends RestController /** * Bookmark constructor. - * - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService */ public function __construct(BookmarkService $bookmarkService, LocationService $locationService) { @@ -83,11 +80,7 @@ public function __construct(BookmarkService $bookmarkService, LocationService $l /** * List bookmarked locations. * - * @param \Symfony\Component\HttpFoundation\Request $request - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * - * @return \Ibexa\Rest\Value */ public function loadBookmarks(Request $request): RestValue { diff --git a/src/lib/Server/Controller/Content/ContentCreateController.php b/src/lib/Server/Controller/Content/ContentCreateController.php index af8c7bb31..8865c7276 100644 --- a/src/lib/Server/Controller/Content/ContentCreateController.php +++ b/src/lib/Server/Controller/Content/ContentCreateController.php @@ -118,24 +118,15 @@ public function __construct( * does not have to authenticate with the user which created the content * object in the source server). The user has to publish the content if * it should be visible. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Ibexa\Rest\Server\Values\CreatedContent */ - public function createContent(Request $request) + public function createContent(Request $request): CreatedContent { $contentCreate = $this->parseContentRequest($request); return $this->doCreateContent($request, $contentCreate); } - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return mixed - */ - protected function parseContentRequest(Request $request) + protected function parseContentRequest(Request $request): mixed { return $this->inputDispatcher->parse( new Message( @@ -146,14 +137,9 @@ protected function parseContentRequest(Request $request) } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Rest\Server\Values\RestContentCreateStruct $contentCreate - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * - * @return \Ibexa\Rest\Server\Values\CreatedContent */ protected function doCreateContent(Request $request, RestContentCreateStruct $contentCreate): CreatedContent { diff --git a/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php b/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php index e1a8b764e..0d71a5b9c 100644 --- a/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php @@ -75,12 +75,6 @@ class ContentDraftTranslationDeleteController extends RestController /** * Remove the given Translation from the given Version Draft. * - * @param int $contentId - * @param int $versionNumber - * @param string $languageCode - * - * @return \Ibexa\Rest\Server\Values\NoContent - * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException */ public function deleteTranslationFromDraft(int $contentId, ?int $versionNumber, string $languageCode): NoContent diff --git a/src/lib/Server/Controller/Content/ContentRedirectController.php b/src/lib/Server/Controller/Content/ContentRedirectController.php index aac33296b..43f579249 100644 --- a/src/lib/Server/Controller/Content/ContentRedirectController.php +++ b/src/lib/Server/Controller/Content/ContentRedirectController.php @@ -58,11 +58,9 @@ class ContentRedirectController extends RestController { /** - * Loads a content info by remote ID. + * Loads a content info by a remote ID. * * @throws \Ibexa\Rest\Server\Exceptions\BadRequestException - * - * @return \Ibexa\Rest\Server\Values\TemporaryRedirect */ public function redirectContent(Request $request): TemporaryRedirect { diff --git a/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php b/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php index 589aa315b..731608e42 100644 --- a/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php @@ -65,11 +65,6 @@ class ContentTranslationDeleteController extends RestController * * If any non-published Version contains only the Translation to be deleted, that entire Version will be deleted * - * @param int $contentId - * @param string $languageCode - * - * @return \Ibexa\Rest\Server\Values\NoContent - * * @throws \Exception */ public function deleteContentTranslation(int $contentId, string $languageCode): NoContent diff --git a/src/lib/Server/Controller/ContentType.php b/src/lib/Server/Controller/ContentType.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php index 851d667b9..467d64964 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php @@ -155,10 +155,6 @@ public function updateContentTypeGroup(int $contentTypeGroupId, Request $request /** * Converts the provided ContentTypeGroupCreateStruct to ContentTypeGroupUpdateStruct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupCreateStruct $createStruct - * - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupUpdateStruct */ private function mapToGroupUpdateStruct(ContentTypeGroupCreateStruct $createStruct): ContentTypeGroupUpdateStruct { diff --git a/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php b/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php index cfbb9a12a..9342f30a7 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php @@ -15,7 +15,7 @@ use Ibexa\Rest\Server\Controller as RestController; use Ibexa\Rest\Server\Exceptions\BadRequestException; use Ibexa\Rest\Server\Exceptions\ForbiddenException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\ContentTypeGroupRefList; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -94,7 +94,7 @@ public function __construct(ContentTypeService $contentTypeService) * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException * @throws \Ibexa\Rest\Server\Exceptions\BadRequestException */ - public function linkContentTypeToGroup(int $contentTypeId, Request $request): \Ibexa\Rest\Server\Values\ContentTypeGroupRefList + public function linkContentTypeToGroup(int $contentTypeId, Request $request): ContentTypeGroupRefList { $contentType = $this->contentTypeService->loadContentType($contentTypeId); @@ -130,7 +130,7 @@ public function linkContentTypeToGroup(int $contentTypeId, Request $request): \I $existingContentTypeGroups[] = $contentTypeGroup; - return new Values\ContentTypeGroupRefList( + return new ContentTypeGroupRefList( $contentType, $existingContentTypeGroups ); diff --git a/src/lib/Server/Controller/ContentType/ContentTypeListController.php b/src/lib/Server/Controller/ContentType/ContentTypeListController.php index af040822d..bf01e189e 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeListController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeListController.php @@ -86,8 +86,6 @@ public function __construct(ContentTypeService $contentTypeService) /** * Returns a list of content types. - * - * @return \Ibexa\Rest\Server\Values\ContentTypeList|\Ibexa\Rest\Server\Values\ContentTypeInfoList */ public function listContentTypes(Request $request): ContentTypeInfoList|ContentTypeList { diff --git a/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php b/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php index f6e325235..20723377b 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php @@ -13,7 +13,8 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Rest\Server\Controller as RestController; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\ContentTypeInfoList; +use Ibexa\Rest\Server\Values\ContentTypeList; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -93,7 +94,7 @@ public function __construct(ContentTypeService $contentTypeService) /** * Returns a list of content types of the group. */ - public function listContentTypesForGroup(int $contentTypeGroupId, Request $request): \Ibexa\Rest\Server\Values\ContentTypeList|\Ibexa\Rest\Server\Values\ContentTypeInfoList + public function listContentTypesForGroup(int $contentTypeGroupId, Request $request): ContentTypeList|ContentTypeInfoList { $contentTypesIterable = $this->contentTypeService->loadContentTypes( $this->contentTypeService->loadContentTypeGroup($contentTypeGroupId, Language::ALL), @@ -105,9 +106,9 @@ public function listContentTypesForGroup(int $contentTypeGroupId, Request $reque } if ($this->getMediaType($request) === 'application/vnd.ibexa.api.contenttypelist') { - return new Values\ContentTypeList($contentTypes, $request->getPathInfo()); + return new ContentTypeList($contentTypes, $request->getPathInfo()); } - return new Values\ContentTypeInfoList($contentTypes, $request->getPathInfo()); + return new ContentTypeInfoList($contentTypes, $request->getPathInfo()); } } diff --git a/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php b/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php index 58eb14719..66544e256 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Rest\Server\Controller as RestController; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RestContentType; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -90,11 +90,11 @@ public function __construct(ContentTypeService $contentTypeService) /** * Loads a content type. */ - public function loadContentType(int $contentTypeId): \Ibexa\Rest\Server\Values\RestContentType + public function loadContentType(int $contentTypeId): RestContentType { $contentType = $this->contentTypeService->loadContentType($contentTypeId, Language::ALL); - return new Values\RestContentType( + return new RestContentType( $contentType, $contentType->getFieldDefinitions()->toArray() ); diff --git a/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php b/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php index 293faea12..fb54162b7 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php @@ -13,7 +13,7 @@ use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Rest\Server\Controller as RestController; use Ibexa\Rest\Server\Exceptions\ForbiddenException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\ContentTypeGroupRefList; use Symfony\Component\HttpFoundation\Response; #[Delete( @@ -95,7 +95,7 @@ public function __construct(ContentTypeService $contentTypeService) * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException */ - public function unlinkContentTypeFromGroup(int $contentTypeId, int $contentTypeGroupId): \Ibexa\Rest\Server\Values\ContentTypeGroupRefList + public function unlinkContentTypeFromGroup(int $contentTypeId, int $contentTypeGroupId): ContentTypeGroupRefList { $contentType = $this->contentTypeService->loadContentType($contentTypeId); $contentTypeGroup = $this->contentTypeService->loadContentTypeGroup($contentTypeGroupId); @@ -124,7 +124,7 @@ public function unlinkContentTypeFromGroup(int $contentTypeId, int $contentTypeG $contentType = $this->contentTypeService->loadContentType($contentTypeId); - return new Values\ContentTypeGroupRefList( + return new ContentTypeGroupRefList( $contentType, $contentType->getContentTypeGroups() ); diff --git a/src/lib/Server/Controller/Location/LocationRedirectController.php b/src/lib/Server/Controller/Location/LocationRedirectController.php index 65c8ea134..85d60a7f3 100644 --- a/src/lib/Server/Controller/Location/LocationRedirectController.php +++ b/src/lib/Server/Controller/Location/LocationRedirectController.php @@ -10,7 +10,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\OpenApi\Model; use Ibexa\Rest\Server\Exceptions\BadRequestException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\TemporaryRedirect; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -65,7 +65,7 @@ class LocationRedirectController extends LocationBaseController * * @throws \Ibexa\Rest\Server\Exceptions\BadRequestException */ - public function redirectLocation(Request $request): \Ibexa\Rest\Server\Values\TemporaryRedirect + public function redirectLocation(Request $request): TemporaryRedirect { if ($request->query->has('id')) { $location = $this->locationService->loadLocation($request->query->getInt('id')); @@ -78,7 +78,7 @@ public function redirectLocation(Request $request): \Ibexa\Rest\Server\Values\Te throw new BadRequestException("At least one of 'id', 'remoteId' or 'urlAlias' parameters is required."); } - return new Values\TemporaryRedirect( + return new TemporaryRedirect( $this->router->generate( 'ibexa.rest.load_location', [ diff --git a/src/lib/Server/Controller/Location/LocationSubtreeCopyController.php b/src/lib/Server/Controller/Location/LocationSubtreeCopyController.php index 0245434cd..be76ce0eb 100644 --- a/src/lib/Server/Controller/Location/LocationSubtreeCopyController.php +++ b/src/lib/Server/Controller/Location/LocationSubtreeCopyController.php @@ -8,7 +8,7 @@ namespace Ibexa\Rest\Server\Controller\Location; use Ibexa\Rest\Message; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\ResourceCreated; use Symfony\Component\HttpFoundation\Request; class LocationSubtreeCopyController extends LocationBaseController @@ -17,7 +17,7 @@ class LocationSubtreeCopyController extends LocationBaseController * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function copy(string $locationPath, Request $request): Values\ResourceCreated + public function copy(string $locationPath, Request $request): ResourceCreated { $locationId = $this->extractLocationIdFromPath($locationPath); $location = $this->locationService->loadLocation($locationId); @@ -31,7 +31,7 @@ public function copy(string $locationPath, Request $request): Values\ResourceCre $newLocation = $this->locationService->copySubtree($location, $destinationLocation); - return new Values\ResourceCreated( + return new ResourceCreated( $this->router->generate( 'ibexa.rest.load_location', [ @@ -44,7 +44,7 @@ public function copy(string $locationPath, Request $request): Values\ResourceCre /** * Copies a subtree to a new destination. */ - public function copySubtree(string $locationPath, Request $request): \Ibexa\Rest\Server\Values\ResourceCreated + public function copySubtree(string $locationPath, Request $request): ResourceCreated { $location = $this->locationService->loadLocation( $this->extractLocationIdFromPath($locationPath) @@ -61,7 +61,7 @@ public function copySubtree(string $locationPath, Request $request): \Ibexa\Rest $newLocation = $this->locationService->copySubtree($location, $destinationLocation); - return new Values\ResourceCreated( + return new ResourceCreated( $this->router->generate( 'ibexa.rest.load_location', [ diff --git a/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php b/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php index 03e236d9d..45951a6b3 100644 --- a/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php +++ b/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php @@ -45,14 +45,7 @@ )] class LocationSubtreeDeleteController extends LocationBaseController { - /** - * Deletes a location. - * - * @param string $locationPath - * - * @return \Ibexa\Rest\Server\Values\NoContent - */ - public function deleteSubtree($locationPath): NoContent + public function deleteSubtree(string $locationPath): NoContent { $location = $this->locationService->loadLocation( $this->extractLocationIdFromPath($locationPath) diff --git a/src/lib/Server/Controller/Location/LocationSubtreeMoveController.php b/src/lib/Server/Controller/Location/LocationSubtreeMoveController.php index 43af2595b..09b7eda0e 100644 --- a/src/lib/Server/Controller/Location/LocationSubtreeMoveController.php +++ b/src/lib/Server/Controller/Location/LocationSubtreeMoveController.php @@ -11,7 +11,8 @@ use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Rest\Message; use Ibexa\Rest\Server\Exceptions\BadRequestException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\NoContent; +use Ibexa\Rest\Server\Values\ResourceCreated; use Symfony\Component\HttpFoundation\Request; class LocationSubtreeMoveController extends LocationBaseController @@ -21,7 +22,7 @@ class LocationSubtreeMoveController extends LocationBaseController * * @throws \Ibexa\Rest\Server\Exceptions\BadRequestException if the Destination header cannot be parsed as location or trash */ - public function moveSubtree(string $locationPath, Request $request): \Ibexa\Rest\Server\Values\ResourceCreated|\Ibexa\Rest\Server\Values\NoContent + public function moveSubtree(string $locationPath, Request $request): ResourceCreated|NoContent { $locationToMove = $this->locationService->loadLocation( $this->extractLocationIdFromPath($locationPath) @@ -41,7 +42,7 @@ public function moveSubtree(string $locationPath, Request $request): \Ibexa\Rest // Reload the location to get the new position is subtree $locationToMove = $this->locationService->loadLocation($locationToMove->id); - return new Values\ResourceCreated( + return new ResourceCreated( $this->router->generate( 'ibexa.rest.load_location', [ @@ -60,7 +61,7 @@ public function moveSubtree(string $locationPath, Request $request): \Ibexa\Rest $trashItem = $this->trashService->trash($locationToMove); if (isset($trashItem)) { - return new Values\ResourceCreated( + return new ResourceCreated( $this->router->generate( 'ibexa.rest.load_trash_item', ['trashItemId' => $trashItem->id] @@ -68,7 +69,7 @@ public function moveSubtree(string $locationPath, Request $request): \Ibexa\Rest ); } else { // Only a location has been trashed and not the object - return new Values\NoContent(); + return new NoContent(); } } catch (Exceptions\InvalidArgumentException $e) { // If that fails, the Destination header is not formatted right @@ -83,7 +84,7 @@ public function moveSubtree(string $locationPath, Request $request): \Ibexa\Rest * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function moveLocation(Request $request, string $locationPath): Values\ResourceCreated + public function moveLocation(Request $request, string $locationPath): ResourceCreated { $destinationLocation = $this->inputDispatcher->parse( new Message( @@ -101,7 +102,7 @@ public function moveLocation(Request $request, string $locationPath): Values\Res // Reload the location to get a new subtree position $locationToMove = $this->locationService->loadLocation($locationToMove->id); - return new Values\ResourceCreated( + return new ResourceCreated( $this->router->generate( 'ibexa.rest.load_location', [ diff --git a/src/lib/Server/Controller/Location/LocationSwapController.php b/src/lib/Server/Controller/Location/LocationSwapController.php index 0587ec73a..c2019dfae 100644 --- a/src/lib/Server/Controller/Location/LocationSwapController.php +++ b/src/lib/Server/Controller/Location/LocationSwapController.php @@ -8,7 +8,7 @@ namespace Ibexa\Rest\Server\Controller\Location; use Ibexa\Rest\Message; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\NoContent; use Symfony\Component\HttpFoundation\Request; class LocationSwapController extends LocationBaseController @@ -16,7 +16,7 @@ class LocationSwapController extends LocationBaseController /** * Swaps a location with another one. */ - public function swapLocation(string $locationPath, Request $request): \Ibexa\Rest\Server\Values\NoContent + public function swapLocation(string $locationPath, Request $request): NoContent { $locationId = $this->extractLocationIdFromPath($locationPath); $location = $this->locationService->loadLocation($locationId); @@ -32,14 +32,14 @@ public function swapLocation(string $locationPath, Request $request): \Ibexa\Res $this->locationService->swapLocation($location, $destinationLocation); - return new Values\NoContent(); + return new NoContent(); } /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function swap(Request $request, string $locationPath): Values\NoContent + public function swap(Request $request, string $locationPath): NoContent { $locationId = $this->extractLocationIdFromPath($locationPath); $location = $this->locationService->loadLocation($locationId); @@ -53,6 +53,6 @@ public function swap(Request $request, string $locationPath): Values\NoContent $this->locationService->swapLocation($location, $destinationLocation); - return new Values\NoContent(); + return new NoContent(); } } diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php index a314c695d..df5bf4c8e 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php @@ -16,7 +16,7 @@ use Ibexa\Rest\Message; use Ibexa\Rest\Server\Controller as RestController; use Ibexa\Rest\Server\Exceptions\ForbiddenException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\CreatedObjectState; use Ibexa\Rest\Values\RestObjectState; use JMS\TranslationBundle\Annotation\Ignore; use Symfony\Component\HttpFoundation\Request; @@ -122,7 +122,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException */ - public function createObjectState(int $objectStateGroupId, Request $request): \Ibexa\Rest\Server\Values\CreatedObjectState + public function createObjectState(int $objectStateGroupId, Request $request): CreatedObjectState { $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId); @@ -140,7 +140,7 @@ public function createObjectState(int $objectStateGroupId, Request $request): \I throw new ForbiddenException(/** @Ignore */ $e->getMessage()); } - return new Values\CreatedObjectState( + return new CreatedObjectState( [ 'objectState' => new RestObjectState( $createdObjectState, diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php index 962ecd6d1..71d638157 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php @@ -112,8 +112,6 @@ public function __construct(ObjectStateService $objectStateService, ContentServi * Creates a new object state group. * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException - * - * @return \Ibexa\Rest\Server\Values\CreatedObjectStateGroup */ public function createObjectStateGroup(Request $request): CreatedObjectStateGroup { diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php index b5de243ab..2d0a21389 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php @@ -84,8 +84,6 @@ public function __construct(ObjectStateService $objectStateService, ContentServi /** * Returns a list of all object state groups. - * - * @return \Ibexa\Rest\Server\Values\ObjectStateGroupList */ public function loadObjectStateGroups(): ObjectStateGroupList { diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php index c87104f09..5f8bd351c 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup; use Ibexa\Rest\Server\Controller as RestController; use Symfony\Component\HttpFoundation\Response; @@ -93,7 +94,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi /** * Loads an object state group. */ - public function loadObjectStateGroup(int $objectStateGroupId): \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup + public function loadObjectStateGroup(int $objectStateGroupId): ObjectStateGroup { return $this->objectStateService->loadObjectStateGroup($objectStateGroupId, Language::ALL); } diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateListController.php b/src/lib/Server/Controller/ObjectState/ObjectStateListController.php index 01e42cea4..69938e9c6 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateListController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateListController.php @@ -14,7 +14,7 @@ use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Rest\Server\Controller as RestController; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\ObjectStateList; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -93,7 +93,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi /** * Returns a list of all object states of the given group. */ - public function loadObjectStates(int $objectStateGroupId): \Ibexa\Rest\Server\Values\ObjectStateList + public function loadObjectStates(int $objectStateGroupId): ObjectStateList { $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId); @@ -103,7 +103,7 @@ public function loadObjectStates(int $objectStateGroupId): \Ibexa\Rest\Server\Va $objectStates[] = $objectState; } - return new Values\ObjectStateList( + return new ObjectStateList( $objectStates, $objectStateGroup->id ); diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php b/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php index 6ed6a241b..169af848c 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php @@ -102,7 +102,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi /** * Loads an object state. */ - public function loadObjectState(int $objectStateGroupId, int $objectStateId): \Ibexa\Rest\Values\RestObjectState + public function loadObjectState(int $objectStateGroupId, int $objectStateId): RestObjectState { return new RestObjectState( $this->objectStateService->loadObjectState($objectStateId, Language::ALL), diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php index 1d8aea7cb..3e985a6ea 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php @@ -141,7 +141,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException */ - public function updateObjectState(int $objectStateGroupId, int $objectStateId, Request $request): \Ibexa\Rest\Values\RestObjectState + public function updateObjectState(int $objectStateGroupId, int $objectStateId, Request $request): RestObjectState { $updateStruct = $this->inputDispatcher->parse( new Message( diff --git a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php index 831a7bb70..4cc2ab36e 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php @@ -92,7 +92,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi /** * Returns the object states of content. */ - public function getObjectStatesForContent(int $contentId): \Ibexa\Rest\Values\ContentObjectStates + public function getObjectStatesForContent(int $contentId): ContentObjectStates { $groups = $this->objectStateService->loadObjectStateGroups(); $contentInfo = $this->contentService->loadContentInfo($contentId); diff --git a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php index d9981b57f..3666e8dca 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php @@ -133,7 +133,7 @@ public function __construct(ObjectStateService $objectStateService, ContentServi * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException */ - public function setObjectStatesForContent(int $contentId, Request $request): \Ibexa\Rest\Values\ContentObjectStates + public function setObjectStatesForContent(int $contentId, Request $request): ContentObjectStates { $newObjectStates = $this->inputDispatcher->parse( new Message( diff --git a/src/lib/Server/Controller/Options.php b/src/lib/Server/Controller/Options.php index d5e4ba190..c15350aa7 100644 --- a/src/lib/Server/Controller/Options.php +++ b/src/lib/Server/Controller/Options.php @@ -17,12 +17,8 @@ class Options extends RestController { /** * Lists the verbs available for a resource. - * - * @param $allowedMethods string comma separated list of supported methods. Depends on the matched OPTIONS route. - * - * @return Values\Options */ - public function getRouteOptions($allowedMethods): Values\Options + public function getRouteOptions(string $allowedMethods): Values\Options { return new Values\Options(explode(',', $allowedMethods)); } diff --git a/src/lib/Server/Controller/Role/RoleAssignToUserController.php b/src/lib/Server/Controller/Role/RoleAssignToUserController.php index 5ef0bc300..67d04ea4f 100644 --- a/src/lib/Server/Controller/Role/RoleAssignToUserController.php +++ b/src/lib/Server/Controller/Role/RoleAssignToUserController.php @@ -13,7 +13,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\LimitationValidationException; use Ibexa\Rest\Message; use Ibexa\Rest\Server\Exceptions\BadRequestException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RoleAssignmentList; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -101,7 +101,7 @@ class RoleAssignToUserController extends RoleBaseController /** * Assigns role to user. */ - public function assignRoleToUser(int $userId, Request $request): \Ibexa\Rest\Server\Values\RoleAssignmentList + public function assignRoleToUser(int $userId, Request $request): RoleAssignmentList { $roleAssignment = $this->inputDispatcher->parse( new Message( @@ -125,6 +125,6 @@ public function assignRoleToUser(int $userId, Request $request): \Ibexa\Rest\Ser $roleAssignments[] = $roleAssignment; } - return new Values\RoleAssignmentList($roleAssignments, $user->id); + return new RoleAssignmentList($roleAssignments, $user->id); } } diff --git a/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php b/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php index 3835e8d8f..da43393e7 100644 --- a/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php +++ b/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php @@ -13,7 +13,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\LimitationValidationException; use Ibexa\Rest\Message; use Ibexa\Rest\Server\Exceptions\BadRequestException; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RoleAssignmentList; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -101,7 +101,7 @@ class RoleAssignToUserGroupController extends RoleBaseController /** * Assigns role to user group. */ - public function assignRoleToUserGroup(string $groupPath, Request $request): \Ibexa\Rest\Server\Values\RoleAssignmentList + public function assignRoleToUserGroup(string $groupPath, Request $request): RoleAssignmentList { $roleAssignment = $this->inputDispatcher->parse( new Message( @@ -128,6 +128,6 @@ public function assignRoleToUserGroup(string $groupPath, Request $request): \Ibe $roleAssignments[] = $roleAssignment; } - return new Values\RoleAssignmentList($roleAssignments, $groupPath, true); + return new RoleAssignmentList($roleAssignments, $groupPath, true); } } diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php index 2da862897..4fc803ef1 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php @@ -10,7 +10,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RoleAssignmentList; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -69,7 +69,7 @@ class RoleAssignmentForUserGroupListController extends RoleBaseController /** * Loads role assignments for user group. */ - public function loadRoleAssignmentsForUserGroup(string $groupPath): \Ibexa\Rest\Server\Values\RoleAssignmentList + public function loadRoleAssignmentsForUserGroup(string $groupPath): RoleAssignmentList { $groupLocationParts = explode('/', $groupPath); $groupLocation = $this->locationService->loadLocation((int)array_pop($groupLocationParts)); @@ -81,6 +81,6 @@ public function loadRoleAssignmentsForUserGroup(string $groupPath): \Ibexa\Rest\ $roleAssignments[] = $roleAssignment; } - return new Values\RoleAssignmentList($roleAssignments, $groupPath, true); + return new RoleAssignmentList($roleAssignments, $groupPath, true); } } diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php index e1d15b823..d396b25a0 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php @@ -11,7 +11,7 @@ use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; use Ibexa\Contracts\Rest\Exceptions; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RestUserGroupRoleAssignment; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -82,7 +82,7 @@ class RoleAssignmentForUserGroupLoadByIdController extends RoleBaseController * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException */ - public function loadRoleAssignmentForUserGroup(string $groupPath, int $roleId, Request $request): \Ibexa\Rest\Server\Values\RestUserGroupRoleAssignment + public function loadRoleAssignmentForUserGroup(string $groupPath, int $roleId, Request $request): RestUserGroupRoleAssignment { $groupLocationParts = explode('/', $groupPath); $groupLocation = $this->locationService->loadLocation((int)array_pop($groupLocationParts)); @@ -91,7 +91,7 @@ public function loadRoleAssignmentForUserGroup(string $groupPath, int $roleId, R $roleAssignments = $this->roleService->getRoleAssignmentsForUserGroup($userGroup); foreach ($roleAssignments as $roleAssignment) { if ($roleAssignment->getRole()->id == $roleId) { - return new Values\RestUserGroupRoleAssignment($roleAssignment, $groupPath); + return new RestUserGroupRoleAssignment($roleAssignment, $groupPath); } } diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php index d0d2ea6ce..41ec462e4 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php @@ -10,7 +10,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RoleAssignmentList; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -69,7 +69,7 @@ class RoleAssignmentForUserListController extends RoleBaseController /** * Loads role assignments for user. */ - public function loadRoleAssignmentsForUser(int $userId): \Ibexa\Rest\Server\Values\RoleAssignmentList + public function loadRoleAssignmentsForUser(int $userId): RoleAssignmentList { $user = $this->userService->loadUser($userId); @@ -79,6 +79,6 @@ public function loadRoleAssignmentsForUser(int $userId): \Ibexa\Rest\Server\Valu $roleAssignments[] = $roleAssignment; } - return new Values\RoleAssignmentList($roleAssignments, $user->id); + return new RoleAssignmentList($roleAssignments, $user->id); } } diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php index feb6bf5cf..f47a97264 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php @@ -11,7 +11,7 @@ use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; use Ibexa\Contracts\Rest\Exceptions; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\RestUserRoleAssignment; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -82,7 +82,7 @@ class RoleAssignmentForUserLoadByIdController extends RoleBaseController * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException */ - public function loadRoleAssignmentForUser(int $userId, int $roleId, Request $request): \Ibexa\Rest\Server\Values\RestUserRoleAssignment + public function loadRoleAssignmentForUser(int $userId, int $roleId, Request $request): RestUserRoleAssignment { $user = $this->userService->loadUser($userId); $roleAssignments = $this->roleService->getRoleAssignmentsForUser($user); @@ -91,7 +91,7 @@ public function loadRoleAssignmentForUser(int $userId, int $roleId, Request $req if ($roleAssignment->getRole()->id == $roleId) { assert($roleAssignment instanceof \Ibexa\Contracts\Core\Repository\Values\User\UserRoleAssignment); - return new Values\RestUserRoleAssignment($roleAssignment, $userId); + return new RestUserRoleAssignment($roleAssignment, $userId); } } diff --git a/src/lib/Server/Controller/Role/RoleBaseController.php b/src/lib/Server/Controller/Role/RoleBaseController.php index 1036303a4..585ef5d63 100644 --- a/src/lib/Server/Controller/Role/RoleBaseController.php +++ b/src/lib/Server/Controller/Role/RoleBaseController.php @@ -62,10 +62,6 @@ protected function getLastAddedPolicy(Role $role): Policy * Maps a RoleCreateStruct to a RoleUpdateStruct. * * Needed since both structs are encoded into the same media type on input. - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleCreateStruct $createStruct - * - * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct */ protected function mapToUpdateStruct(RoleCreateStruct $createStruct): RoleUpdateStruct { diff --git a/src/lib/Server/Controller/Role/RoleCreateController.php b/src/lib/Server/Controller/Role/RoleCreateController.php index ba2c47e29..fdfd5a650 100644 --- a/src/lib/Server/Controller/Role/RoleCreateController.php +++ b/src/lib/Server/Controller/Role/RoleCreateController.php @@ -98,11 +98,9 @@ class RoleCreateController extends RoleBaseController { /** - * Create new role. + * Creates a new role. * * Defaults to publishing the role, but you can create a draft instead by setting the POST parameter publish=false - * - * @return \Ibexa\Rest\Server\Values\CreatedRole */ public function createRole(Request $request): CreatedRole { diff --git a/src/lib/Server/Controller/Role/RoleDeleteController.php b/src/lib/Server/Controller/Role/RoleDeleteController.php index 1c354df33..3982a0a17 100644 --- a/src/lib/Server/Controller/Role/RoleDeleteController.php +++ b/src/lib/Server/Controller/Role/RoleDeleteController.php @@ -10,7 +10,7 @@ use ApiPlatform\Metadata\Delete; use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\NoContent; use Symfony\Component\HttpFoundation\Response; #[Delete( @@ -47,12 +47,12 @@ class RoleDeleteController extends RoleBaseController /** * Delete a role by ID. */ - public function deleteRole(int $roleId): \Ibexa\Rest\Server\Values\NoContent + public function deleteRole(int $roleId): NoContent { $this->roleService->deleteRole( $this->roleService->loadRole($roleId) ); - return new Values\NoContent(); + return new NoContent(); } } diff --git a/src/lib/Server/Controller/Role/RoleDraftCreateController.php b/src/lib/Server/Controller/Role/RoleDraftCreateController.php index fcffbb057..74227da30 100644 --- a/src/lib/Server/Controller/Role/RoleDraftCreateController.php +++ b/src/lib/Server/Controller/Role/RoleDraftCreateController.php @@ -17,7 +17,6 @@ use Ibexa\Rest\Server\Exceptions\BadRequestException; use Ibexa\Rest\Server\Values; use JMS\TranslationBundle\Annotation\Ignore; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; #[Post( @@ -88,15 +87,12 @@ class RoleDraftCreateController extends RoleBaseController /** * Creates a new RoleDraft for an existing Role. * - * @since 6.2 - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException if the Role already has a Role Draft that will need to be removed first, - * or if the authenticated user is not allowed to create a role - * @throws \Ibexa\Rest\Server\Exceptions\BadRequestException if a policy limitation in the $roleCreateStruct is not valid - * - * @return \Ibexa\Rest\Server\Values\CreatedRole + * @throws \Ibexa\Core\Base\Exceptions\ForbiddenException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function createRoleDraft(int $roleId, Request $request): Values\CreatedRole + public function createRoleDraft(int $roleId): Values\CreatedRole { try { $roleDraft = $this->roleService->createRoleDraft( diff --git a/src/lib/Server/Controller/Role/RoleDraftDeleteController.php b/src/lib/Server/Controller/Role/RoleDraftDeleteController.php index 40911f01e..da81bd2e6 100644 --- a/src/lib/Server/Controller/Role/RoleDraftDeleteController.php +++ b/src/lib/Server/Controller/Role/RoleDraftDeleteController.php @@ -10,7 +10,7 @@ use ApiPlatform\Metadata\Delete; use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\NoContent; use Symfony\Component\HttpFoundation\Response; #[Delete( @@ -49,12 +49,12 @@ class RoleDraftDeleteController extends RoleBaseController * * @since 6.2 */ - public function deleteRoleDraft(int $roleId): \Ibexa\Rest\Server\Values\NoContent + public function deleteRoleDraft(int $roleId): NoContent { $this->roleService->deleteRoleDraft( $this->roleService->loadRoleDraft($roleId) ); - return new Values\NoContent(); + return new NoContent(); } } diff --git a/src/lib/Server/Controller/Role/RoleLoadByIdController.php b/src/lib/Server/Controller/Role/RoleLoadByIdController.php index afd0965de..a691b5cfc 100644 --- a/src/lib/Server/Controller/Role/RoleLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RoleLoadByIdController.php @@ -9,6 +9,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\OpenApi\Model; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -79,7 +80,7 @@ class RoleLoadByIdController extends RoleBaseController /** * Loads role. */ - public function loadRole(int $roleId): \Ibexa\Contracts\Core\Repository\Values\User\Role + public function loadRole(int $roleId): Role { return $this->roleService->loadRole($roleId); } diff --git a/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php b/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php index 384950ac2..30694411d 100644 --- a/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php +++ b/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php @@ -62,8 +62,6 @@ class RolePoliciesForUserListController extends RoleBaseController { /** * Search all policies which are applied to a given user. - * - * @return \Ibexa\Rest\Server\Values\PolicyList */ public function listPoliciesForUser(Request $request): PolicyList { diff --git a/src/lib/Server/Controller/Role/RolePolicyCreateController.php b/src/lib/Server/Controller/Role/RolePolicyCreateController.php index 185ec5eec..d3a609bed 100644 --- a/src/lib/Server/Controller/Role/RolePolicyCreateController.php +++ b/src/lib/Server/Controller/Role/RolePolicyCreateController.php @@ -105,8 +105,6 @@ class RolePolicyCreateController extends RoleBaseController * Adds a policy to role. * * @param int $roleId ID of a role draft - * - * @return \Ibexa\Rest\Server\Values\CreatedPolicy */ public function addPolicy(int $roleId, Request $request): CreatedPolicy { diff --git a/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php b/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php index 5c0dd10e3..b71dad108 100644 --- a/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php +++ b/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php @@ -10,7 +10,7 @@ use ApiPlatform\Metadata\Delete; use ApiPlatform\OpenApi\Factory\OpenApiFactory; use ApiPlatform\OpenApi\Model; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\NoContent; use Symfony\Component\HttpFoundation\Response; #[Delete( @@ -47,7 +47,7 @@ class RolePolicyDeleteAllFromRoleController extends RoleBaseController /** * Deletes all policies from a role. */ - public function deletePolicies(int $roleId): \Ibexa\Rest\Server\Values\NoContent + public function deletePolicies(int $roleId): NoContent { $loadedRole = $this->roleService->loadRole($roleId); $roleDraft = $this->roleService->createRoleDraft($loadedRole); @@ -57,6 +57,6 @@ public function deletePolicies(int $roleId): \Ibexa\Rest\Server\Values\NoContent } $this->roleService->publishRoleDraft($roleDraft); - return new Values\NoContent(); + return new NoContent(); } } diff --git a/src/lib/Server/Controller/Role/RolePolicyDeleteController.php b/src/lib/Server/Controller/Role/RolePolicyDeleteController.php index e9c59bc84..6f4be4d58 100644 --- a/src/lib/Server/Controller/Role/RolePolicyDeleteController.php +++ b/src/lib/Server/Controller/Role/RolePolicyDeleteController.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft; use Ibexa\Contracts\Rest\Exceptions; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\NoContent; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -54,7 +54,7 @@ class RolePolicyDeleteController extends RoleBaseController * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException */ - public function deletePolicy(int $roleId, int $policyId, Request $request): \Ibexa\Rest\Server\Values\NoContent + public function deletePolicy(int $roleId, int $policyId, Request $request): NoContent { try { // First try to treat $roleId as a role draft ID. @@ -69,7 +69,7 @@ public function deletePolicy(int $roleId, int $policyId, Request $request): \Ibe if ($policy !== null && $policy instanceof PolicyDraft) { $this->roleService->removePolicyByRoleDraft($roleDraft, $policy); - return new Values\NoContent(); + return new NoContent(); } } catch (NotFoundException $e) { // Then try to treat $roleId as a role ID. @@ -88,7 +88,7 @@ public function deletePolicy(int $roleId, int $policyId, Request $request): \Ibe $this->roleService->removePolicyByRoleDraft($roleDraft, $policy); $this->roleService->publishRoleDraft($roleDraft); - return new Values\NoContent(); + return new NoContent(); } } diff --git a/src/lib/Server/Controller/Role/RolePolicyListController.php b/src/lib/Server/Controller/Role/RolePolicyListController.php index c5e54639c..ba56bad25 100644 --- a/src/lib/Server/Controller/Role/RolePolicyListController.php +++ b/src/lib/Server/Controller/Role/RolePolicyListController.php @@ -9,7 +9,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\OpenApi\Model; -use Ibexa\Rest\Server\Values; +use Ibexa\Rest\Server\Values\PolicyList; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -71,7 +71,7 @@ class RolePolicyListController extends RoleBaseController /** * Loads the policies for the role. */ - public function loadPolicies(int $roleId, Request $request): \Ibexa\Rest\Server\Values\PolicyList + public function loadPolicies(int $roleId, Request $request): PolicyList { $loadedRole = $this->roleService->loadRole($roleId); $policiesIterable = $loadedRole->getPolicies(); @@ -80,6 +80,6 @@ public function loadPolicies(int $roleId, Request $request): \Ibexa\Rest\Server\ $policies[] = $policy; } - return new Values\PolicyList($policies, $request->getPathInfo()); + return new PolicyList($policies, $request->getPathInfo()); } } diff --git a/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php b/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php index 7541492e7..b1f4bd7fa 100644 --- a/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php @@ -9,6 +9,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\OpenApi\Model; +use Ibexa\Contracts\Core\Repository\Values\User\Policy; use Ibexa\Contracts\Rest\Exceptions; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -78,16 +79,11 @@ class RolePolicyLoadByIdController extends RoleBaseController { /** - * Loads a policy. - * - * @param $roleId - * @param $policyId - * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException - * - * @return \Ibexa\Contracts\Core\Repository\Values\User\Policy + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function loadPolicy(int $roleId, int $policyId, Request $request) + public function loadPolicy(int $roleId, int $policyId, Request $request): Policy { $loadedRole = $this->roleService->loadRole($roleId); foreach ($loadedRole->getPolicies() as $policy) { diff --git a/src/lib/Server/Controller/Role/RolePolicyUpdateController.php b/src/lib/Server/Controller/Role/RolePolicyUpdateController.php index 2fd31ca07..05ef62cd5 100644 --- a/src/lib/Server/Controller/Role/RolePolicyUpdateController.php +++ b/src/lib/Server/Controller/Role/RolePolicyUpdateController.php @@ -12,6 +12,7 @@ use ApiPlatform\OpenApi\Model; use Ibexa\Contracts\Core\Repository\Exceptions\LimitationValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Values\User\Policy; use Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft; use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Rest\Message; @@ -119,7 +120,7 @@ class RolePolicyUpdateController extends RoleBaseController * * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException */ - public function updatePolicy(int $roleId, int $policyId, Request $request): \Ibexa\Contracts\Core\Repository\Values\User\Policy + public function updatePolicy(int $roleId, int $policyId, Request $request): Policy { $updateStruct = $this->inputDispatcher->parse( new Message( diff --git a/src/lib/Server/Controller/Root.php b/src/lib/Server/Controller/Root.php index 6aa64d0fb..419fde1cc 100644 --- a/src/lib/Server/Controller/Root.php +++ b/src/lib/Server/Controller/Root.php @@ -11,6 +11,8 @@ use ApiPlatform\OpenApi\Model; use Ibexa\Contracts\Rest\Exceptions\NotFoundException; use Ibexa\Rest\Server\Controller as RestController; +use Ibexa\Rest\Server\Service\RootResourceBuilderInterface; +use Ibexa\Rest\Values\Root as RestRoot; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -57,22 +59,17 @@ */ class Root extends RestController { - /** - * @var \Ibexa\Rest\Server\Service\RootResourceBuilderInterface - */ - private $rootResourceBuilder; + private RootResourceBuilderInterface $rootResourceBuilder; - public function __construct($rootResourceBuilder) + public function __construct(RootResourceBuilderInterface $rootResourceBuilder) { $this->rootResourceBuilder = $rootResourceBuilder; } /** * List the root resources of the Ibexa installation. - * - * @return \Ibexa\Rest\Values\Root */ - public function loadRootResource() + public function loadRootResource(): RestRoot { return $this->rootResourceBuilder->buildRootResource(); } diff --git a/src/lib/Server/Controller/Section/SectionCreateController.php b/src/lib/Server/Controller/Section/SectionCreateController.php index c844c4b04..47150bea1 100644 --- a/src/lib/Server/Controller/Section/SectionCreateController.php +++ b/src/lib/Server/Controller/Section/SectionCreateController.php @@ -97,8 +97,6 @@ public function __construct(SectionService $sectionService) * Create new section. * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException - * - * @return \Ibexa\Rest\Server\Values\CreatedSection */ public function createSection(Request $request): CreatedSection { diff --git a/src/lib/Server/Controller/Section/SectionUpdateController.php b/src/lib/Server/Controller/Section/SectionUpdateController.php index 836727444..23aa20b9e 100644 --- a/src/lib/Server/Controller/Section/SectionUpdateController.php +++ b/src/lib/Server/Controller/Section/SectionUpdateController.php @@ -153,10 +153,6 @@ public function updateSection(int $sectionId, Request $request): Section * Maps a SectionCreateStruct to a SectionUpdateStruct. * * Needed since both structs are encoded into the same media type on input. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\SectionCreateStruct $createStruct - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\SectionUpdateStruct */ protected function mapToUpdateStruct(SectionCreateStruct $createStruct): SectionUpdateStruct { diff --git a/src/lib/Server/Controller/Services.php b/src/lib/Server/Controller/Services.php index 1aa44857a..b8063a1e7 100644 --- a/src/lib/Server/Controller/Services.php +++ b/src/lib/Server/Controller/Services.php @@ -11,6 +11,7 @@ use ApiPlatform\OpenApi\Model; use Ibexa\Rest\Server\Controller as RestController; use Ibexa\Rest\Server\Values\CountryList; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\Response; #[Get( @@ -51,21 +52,17 @@ ], ), )] -/** - * Services controller. - */ class Services extends RestController { - protected array $countriesInfo; - - public function __construct(array $countriesInfo) - { - $this->countriesInfo = $countriesInfo; - } - /** - * Loads Country List. + * @param array $countriesInfo */ + public function __construct( + #[Autowire(param: 'ibexa.field_type.country.data')] + private readonly array $countriesInfo + ) { + } + public function loadCountryList(): CountryList { return new CountryList($this->countriesInfo); diff --git a/src/lib/Server/Controller/Session/SessionBaseController.php b/src/lib/Server/Controller/Session/SessionBaseController.php index 36d0e11a7..7bd31fc84 100644 --- a/src/lib/Server/Controller/Session/SessionBaseController.php +++ b/src/lib/Server/Controller/Session/SessionBaseController.php @@ -44,7 +44,7 @@ protected function hasStoredCsrfToken(): bool protected function checkCsrfToken(Request $request): void { if (!$request->headers->has('X-CSRF-Token')) { - throw $this->createInvalidCsrfTokenException($request); + throw $this->createInvalidCsrfTokenException(); } $csrfToken = new CsrfToken( @@ -53,7 +53,7 @@ protected function checkCsrfToken(Request $request): void ); if (!$this->csrfTokenManager->isTokenValid($csrfToken)) { - throw $this->createInvalidCsrfTokenException($request); + throw $this->createInvalidCsrfTokenException(); } } @@ -62,7 +62,7 @@ protected function getCsrfToken(): string return $this->csrfTokenManager->getToken($this->csrfTokenIntention)->getValue(); } - protected function createInvalidCsrfTokenException(Request $request): UnauthorizedException + protected function createInvalidCsrfTokenException(): UnauthorizedException { return new UnauthorizedException('Missing or invalid CSRF token'); } diff --git a/src/lib/Server/Controller/Session/SessionCheckController.php b/src/lib/Server/Controller/Session/SessionCheckController.php index 7bcdc0266..786e9661e 100644 --- a/src/lib/Server/Controller/Session/SessionCheckController.php +++ b/src/lib/Server/Controller/Session/SessionCheckController.php @@ -71,9 +71,6 @@ */ final class SessionCheckController extends SessionBaseController { - /** - * @return \Ibexa\Rest\Server\Values\UserSession|\Symfony\Component\HttpFoundation\Response - */ public function checkSessionAction(Request $request): Response|UserSession { $session = $request->getSession(); diff --git a/src/lib/Server/Controller/Trash/TrashEmptyController.php b/src/lib/Server/Controller/Trash/TrashEmptyController.php index 2585df465..a328c0f43 100644 --- a/src/lib/Server/Controller/Trash/TrashEmptyController.php +++ b/src/lib/Server/Controller/Trash/TrashEmptyController.php @@ -45,11 +45,6 @@ public function __construct( ) { } - /** - * Empties the trash. - * - * @return \Ibexa\Rest\Server\Values\NoContent - */ public function emptyTrash(): NoContent { $this->trashService->emptyTrash(); diff --git a/src/lib/Server/Controller/Trash/TrashItemListController.php b/src/lib/Server/Controller/Trash/TrashItemListController.php index ddd6b54b5..e651f5c3a 100644 --- a/src/lib/Server/Controller/Trash/TrashItemListController.php +++ b/src/lib/Server/Controller/Trash/TrashItemListController.php @@ -73,8 +73,6 @@ public function __construct( /** * Returns a list of all trash items. - * - * @return \Ibexa\Rest\Server\Values\Trash */ public function loadTrashItems(Request $request): Trash { diff --git a/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php b/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php index 62c73e665..aa59079b7 100644 --- a/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php +++ b/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php @@ -108,8 +108,6 @@ public function __construct( * Creates a new URL alias. * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException - * - * @return \Ibexa\Rest\Server\Values\CreatedURLAlias */ public function createURLAlias(Request $request): CreatedURLAlias { diff --git a/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php b/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php index 673f7199c..d0f475112 100644 --- a/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php +++ b/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php @@ -103,11 +103,7 @@ public function __construct( } /** - * Creates a new URL wildcard. - * * @throws \Ibexa\Rest\Server\Exceptions\ForbiddenException - * - * @return \Ibexa\Rest\Server\Values\CreatedURLWildcard */ public function createURLWildcard(Request $request): CreatedURLWildcard { diff --git a/src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php b/src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php index a76403624..2763620c8 100644 --- a/src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php +++ b/src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php @@ -31,5 +31,5 @@ final public function parse(array $data, ParsingDispatcher $parsingDispatcher): ); } - abstract protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, $value); + abstract protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, ?string $value); } diff --git a/src/lib/Server/Input/Parser/Aggregation/Range/DateTimeRangeParser.php b/src/lib/Server/Input/Parser/Aggregation/Range/DateTimeRangeParser.php index 74e0aace9..680ca2843 100644 --- a/src/lib/Server/Input/Parser/Aggregation/Range/DateTimeRangeParser.php +++ b/src/lib/Server/Input/Parser/Aggregation/Range/DateTimeRangeParser.php @@ -14,7 +14,7 @@ final class DateTimeRangeParser extends AbstractRangeParser { - protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, $value): ?DateTimeInterface + protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, ?string $value): ?DateTimeInterface { if ($value === null) { return null; diff --git a/src/lib/Server/Input/Parser/Aggregation/Range/FloatRangeParser.php b/src/lib/Server/Input/Parser/Aggregation/Range/FloatRangeParser.php index bf9432e6d..f76e7acb1 100644 --- a/src/lib/Server/Input/Parser/Aggregation/Range/FloatRangeParser.php +++ b/src/lib/Server/Input/Parser/Aggregation/Range/FloatRangeParser.php @@ -12,7 +12,7 @@ final class FloatRangeParser extends AbstractRangeParser { - protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, $value): ?float + protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, ?string $value): ?float { if ($value === null) { return null; diff --git a/src/lib/Server/Input/Parser/Aggregation/Range/IntRangeParser.php b/src/lib/Server/Input/Parser/Aggregation/Range/IntRangeParser.php index 9617ae7e9..7bc1567d4 100644 --- a/src/lib/Server/Input/Parser/Aggregation/Range/IntRangeParser.php +++ b/src/lib/Server/Input/Parser/Aggregation/Range/IntRangeParser.php @@ -12,7 +12,7 @@ final class IntRangeParser extends AbstractRangeParser { - protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, $value): ?int + protected function visitRangeValue(ParsingDispatcher $parsingDispatcher, ?string $value): ?int { if ($value === null) { return null; diff --git a/src/lib/Server/Input/Parser/ContentCreate.php b/src/lib/Server/Input/Parser/ContentCreate.php index 0c246982e..762e324ae 100644 --- a/src/lib/Server/Input/Parser/ContentCreate.php +++ b/src/lib/Server/Input/Parser/ContentCreate.php @@ -22,40 +22,16 @@ */ class ContentCreate extends BaseParser { - /** - * Content service. - */ protected ContentService $contentService; - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; - /** - * LocationCreate parser. - */ protected LocationCreate $locationCreateParser; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\FieldTypeParser $fieldTypeParser - * @param \Ibexa\Rest\Server\Input\Parser\LocationCreate $locationCreateParser - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct( ContentService $contentService, ContentTypeService $contentTypeService, diff --git a/src/lib/Server/Input/Parser/ContentTypeCreate.php b/src/lib/Server/Input/Parser/ContentTypeCreate.php index 89e4c2e28..3ff4f6c13 100644 --- a/src/lib/Server/Input/Parser/ContentTypeCreate.php +++ b/src/lib/Server/Input/Parser/ContentTypeCreate.php @@ -20,28 +20,12 @@ */ class ContentTypeCreate extends BaseParser { - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * FieldDefinitionCreate parser. - */ protected FieldDefinitionCreate $fieldDefinitionCreateParser; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Server\Input\Parser\FieldDefinitionCreate $fieldDefinitionCreateParser - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct( ContentTypeService $contentTypeService, FieldDefinitionCreate $fieldDefinitionCreateParser, diff --git a/src/lib/Server/Input/Parser/ContentTypeGroupInput.php b/src/lib/Server/Input/Parser/ContentTypeGroupInput.php index 8304eac52..4ab4d31c5 100644 --- a/src/lib/Server/Input/Parser/ContentTypeGroupInput.php +++ b/src/lib/Server/Input/Parser/ContentTypeGroupInput.php @@ -20,19 +20,10 @@ */ class ContentTypeGroupInput extends BaseParser { - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ContentTypeService $contentTypeService, ParserTools $parserTools) { $this->contentTypeService = $contentTypeService; diff --git a/src/lib/Server/Input/Parser/ContentTypeUpdate.php b/src/lib/Server/Input/Parser/ContentTypeUpdate.php index a7f5d0364..4a9df1bca 100644 --- a/src/lib/Server/Input/Parser/ContentTypeUpdate.php +++ b/src/lib/Server/Input/Parser/ContentTypeUpdate.php @@ -20,22 +20,10 @@ */ class ContentTypeUpdate extends BaseParser { - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ContentTypeService $contentTypeService, ParserTools $parserTools) { $this->contentTypeService = $contentTypeService; diff --git a/src/lib/Server/Input/Parser/ContentUpdate.php b/src/lib/Server/Input/Parser/ContentUpdate.php index 92521d543..bdd115dfa 100644 --- a/src/lib/Server/Input/Parser/ContentUpdate.php +++ b/src/lib/Server/Input/Parser/ContentUpdate.php @@ -24,11 +24,6 @@ class ContentUpdate extends BaseParser * * @todo use url handler instead of hardcoded URL matching * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return \Ibexa\Rest\Values\RestContentMetadataUpdateStruct - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser if $data is invalid */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestContentMetadataUpdateStruct @@ -37,7 +32,7 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestCo if (array_key_exists('Section', $data) && is_array($data['Section']) && isset($data['Section']['_href'])) { try { - $parsedData['sectionId'] = $this->uriParser->getAttributeFromUri($data['Section']['_href'], 'sectionId'); + $parsedData['sectionId'] = (int)$this->uriParser->getAttributeFromUri($data['Section']['_href'], 'sectionId'); } catch (Exceptions\InvalidArgumentException $e) { throw new Exceptions\Parser('Invalid format for the
reference in .'); } diff --git a/src/lib/Server/Input/Parser/Criterion.php b/src/lib/Server/Input/Parser/Criterion.php index 0060b1a14..e7448a66e 100644 --- a/src/lib/Server/Input/Parser/Criterion.php +++ b/src/lib/Server/Input/Parser/Criterion.php @@ -8,6 +8,8 @@ namespace Ibexa\Rest\Server\Input\Parser; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Contracts\Rest\Input\ParsingDispatcher; use Ibexa\Rest\Input\BaseParser; @@ -20,7 +22,7 @@ abstract class Criterion extends BaseParser /** * @var string[] */ - protected static $criterionIdMap = [ + protected static array $criterionIdMap = [ 'AND' => 'LogicalAnd', 'OR' => 'LogicalOr', 'NOT' => 'LogicalNot', @@ -29,16 +31,13 @@ abstract class Criterion extends BaseParser /** * Dispatches parsing of a criterion name + data to its own parser. * - * @param string $criterionName - * @param mixed $criterionData - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion */ - public function dispatchCriterion($criterionName, $criterionData, ParsingDispatcher $parsingDispatcher) - { + public function dispatchCriterion( + string $criterionName, + mixed $criterionData, + ParsingDispatcher $parsingDispatcher + ): CriterionInterface { $mediaType = $this->getCriterionMediaType($criterionName); try { return $parsingDispatcher->parse([$criterionName => $criterionData], $mediaType); @@ -48,9 +47,7 @@ public function dispatchCriterion($criterionName, $criterionData, ParsingDispatc } /** - * Dispatches parsing of a aggregation name + data to its own parser. - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation + * Dispatches parsing of an aggregation name + data to its own parser. */ public function dispatchAggregation( string $aggregationName, @@ -68,22 +65,21 @@ public function dispatchAggregation( /** * Dispatches parsing of a sort clause name + direction to its own parser. * - * @param string $sortClauseName - * @param string $direction - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher + * @param array|string $direction * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion */ - public function dispatchSortClause($sortClauseName, $direction, ParsingDispatcher $parsingDispatcher) - { + public function dispatchSortClause( + string $sortClauseName, + array|string $direction, + ParsingDispatcher $parsingDispatcher + ): SortClause { $mediaType = $this->getSortClauseMediaType($sortClauseName); return $parsingDispatcher->parse([$sortClauseName => $direction], $mediaType); } - protected function getCriterionMediaType($criterionName) + protected function getCriterionMediaType(string $criterionName): string { $criterionName = str_replace('Criterion', '', $criterionName); if (isset(self::$criterionIdMap[$criterionName])) { @@ -93,7 +89,7 @@ protected function getCriterionMediaType($criterionName) return 'application/vnd.ibexa.api.internal.criterion.' . $criterionName; } - protected function getSortClauseMediaType(string $sortClauseName) + protected function getSortClauseMediaType(string $sortClauseName): string { return 'application/vnd.ibexa.api.internal.sortclause.' . $sortClauseName; } diff --git a/src/lib/Server/Input/Parser/Criterion/Ancestor.php b/src/lib/Server/Input/Parser/Criterion/Ancestor.php index c789d8678..1326c3325 100644 --- a/src/lib/Server/Input/Parser/Criterion/Ancestor.php +++ b/src/lib/Server/Input/Parser/Criterion/Ancestor.php @@ -20,12 +20,7 @@ class Ancestor extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Ancestor */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): AncestorCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/ContentId.php b/src/lib/Server/Input/Parser/Criterion/ContentId.php index 0baf2b2c0..43762d4a5 100644 --- a/src/lib/Server/Input/Parser/Criterion/ContentId.php +++ b/src/lib/Server/Input/Parser/Criterion/ContentId.php @@ -20,12 +20,7 @@ class ContentId extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ContentIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/ContentName.php b/src/lib/Server/Input/Parser/Criterion/ContentName.php index 69fd6eff5..d12dfc473 100644 --- a/src/lib/Server/Input/Parser/Criterion/ContentName.php +++ b/src/lib/Server/Input/Parser/Criterion/ContentName.php @@ -17,7 +17,7 @@ final class ContentName extends BaseParser { - public const CONTENT_NAME_CRITERION = 'ContentNameCriterion'; + public const string CONTENT_NAME_CRITERION = 'ContentNameCriterion'; private ValidatorInterface $validator; diff --git a/src/lib/Server/Input/Parser/Criterion/ContentRemoteId.php b/src/lib/Server/Input/Parser/Criterion/ContentRemoteId.php index 90a42a1b9..e4818faed 100644 --- a/src/lib/Server/Input/Parser/Criterion/ContentRemoteId.php +++ b/src/lib/Server/Input/Parser/Criterion/ContentRemoteId.php @@ -21,12 +21,7 @@ class ContentRemoteId extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\RemoteId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RemoteId { diff --git a/src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php b/src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php index 1755e7aae..b14c589f6 100644 --- a/src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php +++ b/src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php @@ -20,12 +20,7 @@ class ContentTypeGroupId extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeGroupId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ContentTypeGroupIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/ContentTypeId.php b/src/lib/Server/Input/Parser/Criterion/ContentTypeId.php index 52ff71885..4ff9455fa 100644 --- a/src/lib/Server/Input/Parser/Criterion/ContentTypeId.php +++ b/src/lib/Server/Input/Parser/Criterion/ContentTypeId.php @@ -20,12 +20,7 @@ class ContentTypeId extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ContentTypeIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/ContentTypeIdentifier.php b/src/lib/Server/Input/Parser/Criterion/ContentTypeIdentifier.php index 2ddb9e873..cb47c38f5 100644 --- a/src/lib/Server/Input/Parser/Criterion/ContentTypeIdentifier.php +++ b/src/lib/Server/Input/Parser/Criterion/ContentTypeIdentifier.php @@ -19,9 +19,6 @@ */ class ContentTypeIdentifier extends BaseParser { - /** - * Content type service. - */ protected ContentTypeService $contentTypeService; public function __construct(ContentTypeService $contentTypeService) @@ -32,12 +29,7 @@ public function __construct(ContentTypeService $contentTypeService) /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ContentTypeId { diff --git a/src/lib/Server/Input/Parser/Criterion/DateMetadata.php b/src/lib/Server/Input/Parser/Criterion/DateMetadata.php index c5d92938a..315f727e4 100644 --- a/src/lib/Server/Input/Parser/Criterion/DateMetadata.php +++ b/src/lib/Server/Input/Parser/Criterion/DateMetadata.php @@ -18,7 +18,7 @@ */ class DateMetadata extends BaseParser { - private const OPERATORS = [ + private const array OPERATORS = [ 'IN' => Operator::IN, 'EQ' => Operator::EQ, 'GT' => Operator::GT, diff --git a/src/lib/Server/Input/Parser/Criterion/Field.php b/src/lib/Server/Input/Parser/Criterion/Field.php index df6f1324e..4725c52bb 100644 --- a/src/lib/Server/Input/Parser/Criterion/Field.php +++ b/src/lib/Server/Input/Parser/Criterion/Field.php @@ -18,7 +18,7 @@ */ class Field extends BaseParser { - public const OPERATORS = [ + public const array OPERATORS = [ 'IN' => Operator::IN, 'EQ' => Operator::EQ, 'GT' => Operator::GT, @@ -33,12 +33,7 @@ class Field extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Field */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldCriterion { @@ -61,17 +56,13 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldC } /** - * Get operator for the given literal name. + * Get an operator for the given literal name. * * For the full list of supported operators: * * @see \Ibexa\Rest\Server\Input\Parser\Criterion\Field::OPERATORS - * - * @param string $operatorName operator literal operator name - * - * @return string */ - private function getOperator($operatorName): string + private function getOperator(string $operatorName): string { $operatorName = strtoupper($operatorName); if (!isset(self::OPERATORS[$operatorName])) { diff --git a/src/lib/Server/Input/Parser/Criterion/FullText.php b/src/lib/Server/Input/Parser/Criterion/FullText.php index 47ec0c06d..bd62ac375 100644 --- a/src/lib/Server/Input/Parser/Criterion/FullText.php +++ b/src/lib/Server/Input/Parser/Criterion/FullText.php @@ -20,12 +20,7 @@ class FullText extends BaseParser /** * Parses input structure to a FullText criterion. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\FullText */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): FullTextCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/Image.php b/src/lib/Server/Input/Parser/Criterion/Image.php index 4dce3fc3d..cc8238660 100644 --- a/src/lib/Server/Input/Parser/Criterion/Image.php +++ b/src/lib/Server/Input/Parser/Criterion/Image.php @@ -17,9 +17,9 @@ final class Image extends BaseParser { - public const IMAGE_CRITERION = 'ImageCriterion'; - public const FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; - public const MIME_TYPES_KEY = 'mimeTypes'; + public const string IMAGE_CRITERION = 'ImageCriterion'; + public const string FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; + public const string MIME_TYPES_KEY = 'mimeTypes'; private ValidatorInterface $validator; @@ -31,8 +31,6 @@ public function __construct(ValidatorInterface $validator) /** * @param array $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Image - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException */ diff --git a/src/lib/Server/Input/Parser/Criterion/ImageDimensions.php b/src/lib/Server/Input/Parser/Criterion/ImageDimensions.php index 5de165e63..a17761dd8 100644 --- a/src/lib/Server/Input/Parser/Criterion/ImageDimensions.php +++ b/src/lib/Server/Input/Parser/Criterion/ImageDimensions.php @@ -17,10 +17,10 @@ final class ImageDimensions extends BaseParser { - public const IMAGE_DIMENSIONS_CRITERION = 'ImageDimensionsCriterion'; - public const FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; - public const WIDTH_KEY = 'width'; - public const HEIGHT_KEY = 'height'; + public const string IMAGE_DIMENSIONS_CRITERION = 'ImageDimensionsCriterion'; + public const string FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; + public const string WIDTH_KEY = 'width'; + public const string HEIGHT_KEY = 'height'; private ValidatorInterface $validator; diff --git a/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php b/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php index fd3cd7a5d..b4fe9aade 100644 --- a/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php +++ b/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php @@ -17,9 +17,9 @@ final class ImageFileSize extends BaseParser { - public const IMAGE_FILE_SIZE_CRITERION = 'ImageFileSizeCriterion'; - public const FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; - public const SIZE_KEY = 'size'; + public const string IMAGE_FILE_SIZE_CRITERION = 'ImageFileSizeCriterion'; + public const string FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; + public const string SIZE_KEY = 'size'; private ValidatorInterface $validator; diff --git a/src/lib/Server/Input/Parser/Criterion/ImageMimeType.php b/src/lib/Server/Input/Parser/Criterion/ImageMimeType.php index c5ebbb896..53ed3ee77 100644 --- a/src/lib/Server/Input/Parser/Criterion/ImageMimeType.php +++ b/src/lib/Server/Input/Parser/Criterion/ImageMimeType.php @@ -17,9 +17,9 @@ final class ImageMimeType extends BaseParser { - public const IMAGE_MIME_TYPE_CRITERION = 'ImageMimeTypeCriterion'; - public const FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; - public const TYPE_KEY = 'type'; + public const string IMAGE_MIME_TYPE_CRITERION = 'ImageMimeTypeCriterion'; + public const string FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; + public const string TYPE_KEY = 'type'; private ValidatorInterface $validator; diff --git a/src/lib/Server/Input/Parser/Criterion/ImageOrientation.php b/src/lib/Server/Input/Parser/Criterion/ImageOrientation.php index 86f21d59f..6f9a27482 100644 --- a/src/lib/Server/Input/Parser/Criterion/ImageOrientation.php +++ b/src/lib/Server/Input/Parser/Criterion/ImageOrientation.php @@ -17,9 +17,9 @@ final class ImageOrientation extends BaseParser { - public const IMAGE_ORIENTATION_CRITERION = 'ImageOrientationCriterion'; - public const FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; - public const ORIENTATION_KEY = 'orientation'; + public const string IMAGE_ORIENTATION_CRITERION = 'ImageOrientationCriterion'; + public const string FIELD_DEF_IDENTIFIER_KEY = 'fieldDefIdentifier'; + public const string ORIENTATION_KEY = 'orientation'; private ValidatorInterface $validator; diff --git a/src/lib/Server/Input/Parser/Criterion/IsBookmarked.php b/src/lib/Server/Input/Parser/Criterion/IsBookmarked.php index d64e30769..9e6526e81 100644 --- a/src/lib/Server/Input/Parser/Criterion/IsBookmarked.php +++ b/src/lib/Server/Input/Parser/Criterion/IsBookmarked.php @@ -16,7 +16,7 @@ final class IsBookmarked extends BaseParser { - public const IS_BOOKMARKED_CRITERION = 'IsBookmarkedCriterion'; + public const string IS_BOOKMARKED_CRITERION = 'IsBookmarkedCriterion'; private ParserTools $parserTools; diff --git a/src/lib/Server/Input/Parser/Criterion/LanguageCode.php b/src/lib/Server/Input/Parser/Criterion/LanguageCode.php index 5f1f52890..3fb1f34f5 100644 --- a/src/lib/Server/Input/Parser/Criterion/LanguageCode.php +++ b/src/lib/Server/Input/Parser/Criterion/LanguageCode.php @@ -20,12 +20,7 @@ class LanguageCode extends BaseParser /** * Parses input structure to a LanguageCode Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LanguageCodeCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/LocationId.php b/src/lib/Server/Input/Parser/Criterion/LocationId.php index 774ba1658..38a6fbe98 100644 --- a/src/lib/Server/Input/Parser/Criterion/LocationId.php +++ b/src/lib/Server/Input/Parser/Criterion/LocationId.php @@ -20,12 +20,7 @@ class LocationId extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LocationIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/LocationRemoteId.php b/src/lib/Server/Input/Parser/Criterion/LocationRemoteId.php index 7cb3fdab5..1f7b43b60 100644 --- a/src/lib/Server/Input/Parser/Criterion/LocationRemoteId.php +++ b/src/lib/Server/Input/Parser/Criterion/LocationRemoteId.php @@ -20,12 +20,7 @@ class LocationRemoteId extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationRemoteId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LocationRemoteIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/LogicalAnd.php b/src/lib/Server/Input/Parser/Criterion/LogicalAnd.php index 13939309f..25728be80 100644 --- a/src/lib/Server/Input/Parser/Criterion/LogicalAnd.php +++ b/src/lib/Server/Input/Parser/Criterion/LogicalAnd.php @@ -16,14 +16,9 @@ */ class LogicalAnd extends LogicalOperator { - /** - * @var string - */ - public const TAG_NAME = 'AND'; + public const string TAG_NAME = 'AND'; /** - * @param array $data - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LogicalAndCriterion diff --git a/src/lib/Server/Input/Parser/Criterion/LogicalNot.php b/src/lib/Server/Input/Parser/Criterion/LogicalNot.php index a64265f15..cb0956273 100644 --- a/src/lib/Server/Input/Parser/Criterion/LogicalNot.php +++ b/src/lib/Server/Input/Parser/Criterion/LogicalNot.php @@ -20,12 +20,7 @@ class LogicalNot extends CriterionParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalNot */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LogicalNotCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/LogicalOperator.php b/src/lib/Server/Input/Parser/Criterion/LogicalOperator.php index abbc1795b..d70893e1b 100644 --- a/src/lib/Server/Input/Parser/Criterion/LogicalOperator.php +++ b/src/lib/Server/Input/Parser/Criterion/LogicalOperator.php @@ -14,11 +14,6 @@ */ abstract class LogicalOperator extends Criterion { - /** - * @param array $criteriaByType - * - * @return array - */ protected function getFlattenedCriteriaData(array $criteriaByType): array { $criteria = []; @@ -40,10 +35,6 @@ protected function getFlattenedCriteriaData(array $criteriaByType): array /** * Checks if the given $value is zero based. - * - * @param array $value - * - * @return bool */ protected function isZeroBasedArray(array $value): bool { diff --git a/src/lib/Server/Input/Parser/Criterion/LogicalOr.php b/src/lib/Server/Input/Parser/Criterion/LogicalOr.php index 60fb7e83e..626d47d26 100644 --- a/src/lib/Server/Input/Parser/Criterion/LogicalOr.php +++ b/src/lib/Server/Input/Parser/Criterion/LogicalOr.php @@ -16,14 +16,9 @@ */ class LogicalOr extends LogicalOperator { - /** - * @var string - */ - public const TAG_NAME = 'OR'; + public const string TAG_NAME = 'OR'; /** - * @param array $data - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LogicalOrCriterion diff --git a/src/lib/Server/Input/Parser/Criterion/ObjectStateId.php b/src/lib/Server/Input/Parser/Criterion/ObjectStateId.php index 53b7b9e17..29a7e07f8 100644 --- a/src/lib/Server/Input/Parser/Criterion/ObjectStateId.php +++ b/src/lib/Server/Input/Parser/Criterion/ObjectStateId.php @@ -20,12 +20,7 @@ class ObjectStateId extends BaseParser /** * Parses input structure to a ObjectStateId Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ObjectStateId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ObjectStateIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/ParentLocationId.php b/src/lib/Server/Input/Parser/Criterion/ParentLocationId.php index e58313ee1..257044910 100644 --- a/src/lib/Server/Input/Parser/Criterion/ParentLocationId.php +++ b/src/lib/Server/Input/Parser/Criterion/ParentLocationId.php @@ -20,12 +20,7 @@ class ParentLocationId extends BaseParser /** * Parses input structure to a ParentLocationId Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ParentLocationIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/ParentLocationRemoteId.php b/src/lib/Server/Input/Parser/Criterion/ParentLocationRemoteId.php index 20b2f9826..4618c2181 100644 --- a/src/lib/Server/Input/Parser/Criterion/ParentLocationRemoteId.php +++ b/src/lib/Server/Input/Parser/Criterion/ParentLocationRemoteId.php @@ -19,9 +19,6 @@ */ class ParentLocationRemoteId extends BaseParser { - /** - * Location service. - */ protected LocationService $locationService; public function __construct(LocationService $locationService) @@ -32,12 +29,7 @@ public function __construct(LocationService $locationService) /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ParentLocationId { diff --git a/src/lib/Server/Input/Parser/Criterion/SectionId.php b/src/lib/Server/Input/Parser/Criterion/SectionId.php index cffd62c99..e32700650 100644 --- a/src/lib/Server/Input/Parser/Criterion/SectionId.php +++ b/src/lib/Server/Input/Parser/Criterion/SectionId.php @@ -20,12 +20,7 @@ class SectionId extends BaseParser /** * Parses input structure to a SectionId Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\SectionId */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): SectionIdCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/Subtree.php b/src/lib/Server/Input/Parser/Criterion/Subtree.php index dab90f52f..04bdcd721 100644 --- a/src/lib/Server/Input/Parser/Criterion/Subtree.php +++ b/src/lib/Server/Input/Parser/Criterion/Subtree.php @@ -20,12 +20,7 @@ class Subtree extends BaseParser /** * Parses input structure to a Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Subtree */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): SubtreeCriterion { diff --git a/src/lib/Server/Input/Parser/Criterion/Visibility.php b/src/lib/Server/Input/Parser/Criterion/Visibility.php index 12bb2d009..f59016b99 100644 --- a/src/lib/Server/Input/Parser/Criterion/Visibility.php +++ b/src/lib/Server/Input/Parser/Criterion/Visibility.php @@ -20,12 +20,7 @@ class Visibility extends BaseParser /** * Parses input structure to a Visibility Criterion object. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Visibility */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): VisibilityCriterion { diff --git a/src/lib/Server/Input/Parser/FieldDefinitionCreate.php b/src/lib/Server/Input/Parser/FieldDefinitionCreate.php index 50743c878..5d3c5b831 100644 --- a/src/lib/Server/Input/Parser/FieldDefinitionCreate.php +++ b/src/lib/Server/Input/Parser/FieldDefinitionCreate.php @@ -21,28 +21,12 @@ */ class FieldDefinitionCreate extends BaseParser { - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\FieldTypeParser $fieldTypeParser - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ContentTypeService $contentTypeService, FieldTypeParser $fieldTypeParser, ParserTools $parserTools) { $this->contentTypeService = $contentTypeService; diff --git a/src/lib/Server/Input/Parser/FieldDefinitionUpdate.php b/src/lib/Server/Input/Parser/FieldDefinitionUpdate.php index b4ed3b329..10cd10012 100644 --- a/src/lib/Server/Input/Parser/FieldDefinitionUpdate.php +++ b/src/lib/Server/Input/Parser/FieldDefinitionUpdate.php @@ -8,6 +8,7 @@ namespace Ibexa\Rest\Server\Input\Parser; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct; use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Contracts\Rest\Input\ParsingDispatcher; @@ -20,27 +21,12 @@ */ class FieldDefinitionUpdate extends BaseParser { - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ContentTypeService $contentTypeService, FieldTypeParser $fieldTypeParser, ParserTools $parserTools) { $this->contentTypeService = $contentTypeService; @@ -141,12 +127,8 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldD * @see \Ibexa\Rest\Server\Controller\ContentType::updateFieldDefinition * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * - * @param array $data - * - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition */ - protected function getFieldDefinition(array $data) + protected function getFieldDefinition(array $data): FieldDefinition { $contentTypeId = $this->uriParser->getAttributeFromUri($data['__url'], 'contentTypeId'); $fieldDefinitionId = $this->uriParser->getAttributeFromUri($data['__url'], 'fieldDefinitionId'); diff --git a/src/lib/Server/Input/Parser/Limitation/PathStringRouteBasedLimitationParser.php b/src/lib/Server/Input/Parser/Limitation/PathStringRouteBasedLimitationParser.php index d7a31c903..75e62ce63 100644 --- a/src/lib/Server/Input/Parser/Limitation/PathStringRouteBasedLimitationParser.php +++ b/src/lib/Server/Input/Parser/Limitation/PathStringRouteBasedLimitationParser.php @@ -27,7 +27,7 @@ class PathStringRouteBasedLimitationParser extends RouteBasedLimitationParser * * @param array{_href: string} $limitationValue */ - protected function parseIdFromHref($limitationValue): string + protected function parseIdFromHref(array $limitationValue): string { if (substr($limitationValue['_href'], -1) !== '/') { throw new Exceptions\Parser("The '_href' attribute must end with a slash."); diff --git a/src/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParser.php b/src/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParser.php index 5329604ce..d00e19cfb 100644 --- a/src/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParser.php +++ b/src/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParser.php @@ -26,26 +26,16 @@ class RouteBasedLimitationParser extends BaseParser /** * Name of the route parameter. * Example: "sectionId". - * - * @var string */ - private $limitationRouteParameterName; + private string $limitationRouteParameterName; /** * Value object class built by the Parser. * Example: "Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation". - * - * @var string */ - private $limitationClass; + private string $limitationClass; - /** - * LimitationParser constructor. - * - * @param string $limitationRouteParameterName - * @param string $limitationClass - */ - public function __construct($limitationRouteParameterName, $limitationClass) + public function __construct(string $limitationRouteParameterName, string $limitationClass) { $this->limitationRouteParameterName = $limitationRouteParameterName; $this->limitationClass = $limitationClass; @@ -74,10 +64,7 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): Limita return $limitationObject; } - /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation - */ - protected function buildLimitation() + protected function buildLimitation(): Limitation { return new $this->limitationClass(); } diff --git a/src/lib/Server/Input/Parser/LocationCreate.php b/src/lib/Server/Input/Parser/LocationCreate.php index 8dadb2c87..017f213a4 100644 --- a/src/lib/Server/Input/Parser/LocationCreate.php +++ b/src/lib/Server/Input/Parser/LocationCreate.php @@ -19,22 +19,10 @@ */ class LocationCreate extends BaseParser { - /** - * Location service. - */ protected LocationService $locationService; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(LocationService $locationService, ParserTools $parserTools) { $this->locationService = $locationService; diff --git a/src/lib/Server/Input/Parser/LocationUpdate.php b/src/lib/Server/Input/Parser/LocationUpdate.php index 85e1d9e1b..664474f17 100644 --- a/src/lib/Server/Input/Parser/LocationUpdate.php +++ b/src/lib/Server/Input/Parser/LocationUpdate.php @@ -18,22 +18,10 @@ */ class LocationUpdate extends BaseParser { - /** - * Location service. - */ protected LocationService $locationService; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(LocationService $locationService, ParserTools $parserTools) { $this->locationService = $locationService; @@ -42,11 +30,6 @@ public function __construct(LocationService $locationService, ParserTools $parse /** * Parse input structure. - * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return \Ibexa\Rest\Server\Values\RestLocationUpdateStruct */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestLocationUpdateStruct { diff --git a/src/lib/Server/Input/Parser/ObjectStateCreate.php b/src/lib/Server/Input/Parser/ObjectStateCreate.php index 58fed1464..e1863902b 100644 --- a/src/lib/Server/Input/Parser/ObjectStateCreate.php +++ b/src/lib/Server/Input/Parser/ObjectStateCreate.php @@ -19,19 +19,10 @@ */ class ObjectStateCreate extends BaseParser { - /** - * Object state service. - */ protected ObjectStateService $objectStateService; protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ObjectStateService $objectStateService, ParserTools $parserTools) { $this->objectStateService = $objectStateService; diff --git a/src/lib/Server/Input/Parser/ObjectStateGroupCreate.php b/src/lib/Server/Input/Parser/ObjectStateGroupCreate.php index bfe9b1dd5..c82b0bba8 100644 --- a/src/lib/Server/Input/Parser/ObjectStateGroupCreate.php +++ b/src/lib/Server/Input/Parser/ObjectStateGroupCreate.php @@ -19,19 +19,10 @@ */ class ObjectStateGroupCreate extends BaseParser { - /** - * Object state service. - */ protected ObjectStateService $objectStateService; protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ObjectStateService $objectStateService, ParserTools $parserTools) { $this->objectStateService = $objectStateService; diff --git a/src/lib/Server/Input/Parser/ObjectStateGroupUpdate.php b/src/lib/Server/Input/Parser/ObjectStateGroupUpdate.php index a0ff37bd9..2df3a67f8 100644 --- a/src/lib/Server/Input/Parser/ObjectStateGroupUpdate.php +++ b/src/lib/Server/Input/Parser/ObjectStateGroupUpdate.php @@ -19,19 +19,10 @@ */ class ObjectStateGroupUpdate extends BaseParser { - /** - * Object state service. - */ protected ObjectStateService $objectStateService; protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ObjectStateService $objectStateService, ParserTools $parserTools) { $this->objectStateService = $objectStateService; diff --git a/src/lib/Server/Input/Parser/ObjectStateUpdate.php b/src/lib/Server/Input/Parser/ObjectStateUpdate.php index 73cb2f291..24efab681 100644 --- a/src/lib/Server/Input/Parser/ObjectStateUpdate.php +++ b/src/lib/Server/Input/Parser/ObjectStateUpdate.php @@ -19,19 +19,10 @@ */ class ObjectStateUpdate extends BaseParser { - /** - * Object state service. - */ protected ObjectStateService $objectStateService; protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ObjectStateService $objectStateService, ParserTools $parserTools) { $this->objectStateService = $objectStateService; diff --git a/src/lib/Server/Input/Parser/PolicyUpdate.php b/src/lib/Server/Input/Parser/PolicyUpdate.php index ff642c312..9bd4952cd 100644 --- a/src/lib/Server/Input/Parser/PolicyUpdate.php +++ b/src/lib/Server/Input/Parser/PolicyUpdate.php @@ -19,22 +19,10 @@ */ class PolicyUpdate extends BaseParser { - /** - * Role service. - */ protected RoleService $roleService; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(RoleService $roleService, ParserTools $parserTools) { $this->roleService = $roleService; diff --git a/src/lib/Server/Input/Parser/Query.php b/src/lib/Server/Input/Parser/Query.php index 5863070b1..e5b6af7b6 100644 --- a/src/lib/Server/Input/Parser/Query.php +++ b/src/lib/Server/Input/Parser/Query.php @@ -70,9 +70,6 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): Conten */ abstract protected function buildQuery(): ContentQuery; - /** - * @param array $criteriaArray - */ private function processCriteriaArray(array $criteriaArray, ParsingDispatcher $parsingDispatcher): ?CriterionInterface { if (count($criteriaArray) === 0) { @@ -89,11 +86,6 @@ private function processCriteriaArray(array $criteriaArray, ParsingDispatcher $p /** * Handles SortClause data. - * - * @param array $sortClausesArray - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return array */ private function processSortClauses(array $sortClausesArray, ParsingDispatcher $parsingDispatcher): array { diff --git a/src/lib/Server/Input/Parser/RoleAssignInput.php b/src/lib/Server/Input/Parser/RoleAssignInput.php index ca96cf601..2906f7a1f 100644 --- a/src/lib/Server/Input/Parser/RoleAssignInput.php +++ b/src/lib/Server/Input/Parser/RoleAssignInput.php @@ -23,11 +23,6 @@ class RoleAssignInput extends BaseParser */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ParserTools $parserTools) { $this->parserTools = $parserTools; @@ -35,11 +30,6 @@ public function __construct(ParserTools $parserTools) /** * Parse input structure. - * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return \Ibexa\Rest\Server\Values\RoleAssignment */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RoleAssignment { @@ -52,7 +42,7 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RoleAs } try { - $roleId = $this->uriParser->getAttributeFromUri($data['Role']['_href'], 'roleId'); + $roleId = (int)$this->uriParser->getAttributeFromUri($data['Role']['_href'], 'roleId'); } catch (Exceptions\InvalidArgumentException $e) { throw new Exceptions\Parser('Invalid format for reference in .'); } diff --git a/src/lib/Server/Input/Parser/RoleInput.php b/src/lib/Server/Input/Parser/RoleInput.php index 776c2a3f5..c5dddb03f 100644 --- a/src/lib/Server/Input/Parser/RoleInput.php +++ b/src/lib/Server/Input/Parser/RoleInput.php @@ -18,19 +18,10 @@ */ class RoleInput extends BaseParser { - /** - * Role service. - */ protected RoleService $roleService; protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(RoleService $roleService, ParserTools $parserTools) { $this->roleService = $roleService; @@ -49,8 +40,6 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RoleCr $roleIdentifier = $data['identifier']; } - $roleCreateStruct = $this->roleService->newRoleCreateStruct($roleIdentifier); - - return $roleCreateStruct; + return $this->roleService->newRoleCreateStruct($roleIdentifier); } } diff --git a/src/lib/Server/Input/Parser/SectionInput.php b/src/lib/Server/Input/Parser/SectionInput.php index f43272f76..28454c266 100644 --- a/src/lib/Server/Input/Parser/SectionInput.php +++ b/src/lib/Server/Input/Parser/SectionInput.php @@ -18,16 +18,8 @@ */ class SectionInput extends BaseParser { - /** - * Section service. - */ protected SectionService $sectionService; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService - */ public function __construct(SectionService $sectionService) { $this->sectionService = $sectionService; diff --git a/src/lib/Server/Input/Parser/SessionInput.php b/src/lib/Server/Input/Parser/SessionInput.php index 032d5077f..1948bdbd5 100644 --- a/src/lib/Server/Input/Parser/SessionInput.php +++ b/src/lib/Server/Input/Parser/SessionInput.php @@ -19,11 +19,6 @@ class SessionInput extends BaseParser { /** * Parse input structure. - * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return \Ibexa\Rest\Server\Values\SessionInput */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): SessionInputValue { diff --git a/src/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClass.php b/src/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClass.php index e4d671f83..2f3f075c0 100644 --- a/src/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClass.php +++ b/src/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClass.php @@ -17,26 +17,16 @@ class DataKeyValueObjectClass extends BaseParser /** * Data key, corresponding to the $valueObjectClass class. * Example: 'DatePublished'. - * - * @var string */ - protected $dataKey; + protected string $dataKey; /** * Value object class, corresponding to the $dataKey. * Example: 'Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\DatePublished'. - * - * @var string */ - protected $valueObjectClass; + protected string $valueObjectClass; - /** - * DataKeyValueObjectClass constructor. - * - * @param string $dataKey - * @param string $valueObjectClass - */ - public function __construct($dataKey, $valueObjectClass) + public function __construct(string $dataKey, string $valueObjectClass) { $this->dataKey = $dataKey; $this->valueObjectClass = $valueObjectClass; diff --git a/src/lib/Server/Input/Parser/SortClause/Field.php b/src/lib/Server/Input/Parser/SortClause/Field.php index 486034ee4..fa110dfc6 100644 --- a/src/lib/Server/Input/Parser/SortClause/Field.php +++ b/src/lib/Server/Input/Parser/SortClause/Field.php @@ -17,11 +17,6 @@ class Field extends BaseParser { /** * Parse input structure for Field sort clause. - * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Field */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldSortClause { @@ -65,10 +60,6 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldS /** * Normalize passed Field Sort Clause data by making both xml and json parameters to have same names (by dropping * xml "_" prefix and changing "#text" xml attribute to "direction"). - * - * @param array $data - * - * @return array */ private function normalizeData(array $data): array { diff --git a/src/lib/Server/Input/Parser/URLAliasCreate.php b/src/lib/Server/Input/Parser/URLAliasCreate.php index 41db02991..84f28ad75 100644 --- a/src/lib/Server/Input/Parser/URLAliasCreate.php +++ b/src/lib/Server/Input/Parser/URLAliasCreate.php @@ -17,16 +17,8 @@ */ class URLAliasCreate extends BaseParser { - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ParserTools $parserTools) { $this->parserTools = $parserTools; @@ -34,11 +26,6 @@ public function __construct(ParserTools $parserTools) /** * Parse input structure. - * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return array */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): array { diff --git a/src/lib/Server/Input/Parser/URLWildcardCreate.php b/src/lib/Server/Input/Parser/URLWildcardCreate.php index fa4f93dbd..94690880d 100644 --- a/src/lib/Server/Input/Parser/URLWildcardCreate.php +++ b/src/lib/Server/Input/Parser/URLWildcardCreate.php @@ -17,16 +17,8 @@ */ class URLWildcardCreate extends BaseParser { - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ public function __construct(ParserTools $parserTools) { $this->parserTools = $parserTools; @@ -34,8 +26,6 @@ public function __construct(ParserTools $parserTools) /** * Parse input structure. - * - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): array { diff --git a/src/lib/Server/Input/Parser/UserCreate.php b/src/lib/Server/Input/Parser/UserCreate.php index 6eeda13ff..13c2ec726 100644 --- a/src/lib/Server/Input/Parser/UserCreate.php +++ b/src/lib/Server/Input/Parser/UserCreate.php @@ -21,36 +21,20 @@ */ class UserCreate extends BaseParser { - /** - * User service. - */ protected UserService $userService; - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; - /** - * Parser tools. - */ protected ParserTools $parserTools; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\FieldTypeParser $fieldTypeParser - * @param \Ibexa\Rest\Input\ParserTools $parserTools - */ - public function __construct(UserService $userService, ContentTypeService $contentTypeService, FieldTypeParser $fieldTypeParser, ParserTools $parserTools) - { + public function __construct( + UserService $userService, + ContentTypeService $contentTypeService, + FieldTypeParser $fieldTypeParser, + ParserTools $parserTools, + ) { $this->userService = $userService; $this->contentTypeService = $contentTypeService; $this->fieldTypeParser = $fieldTypeParser; diff --git a/src/lib/Server/Input/Parser/UserGroupCreate.php b/src/lib/Server/Input/Parser/UserGroupCreate.php index e9b6c9637..06d2efc89 100644 --- a/src/lib/Server/Input/Parser/UserGroupCreate.php +++ b/src/lib/Server/Input/Parser/UserGroupCreate.php @@ -20,30 +20,17 @@ */ class UserGroupCreate extends BaseParser { - /** - * User service. - */ protected UserService $userService; - /** - * ContentType service. - */ protected ContentTypeService $contentTypeService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Rest\Input\FieldTypeParser $fieldTypeParser - */ - public function __construct(UserService $userService, ContentTypeService $contentTypeService, FieldTypeParser $fieldTypeParser) - { + public function __construct( + UserService $userService, + ContentTypeService $contentTypeService, + FieldTypeParser $fieldTypeParser + ) { $this->userService = $userService; $this->contentTypeService = $contentTypeService; $this->fieldTypeParser = $fieldTypeParser; diff --git a/src/lib/Server/Input/Parser/UserGroupUpdate.php b/src/lib/Server/Input/Parser/UserGroupUpdate.php index 94d1bc89d..16f107311 100644 --- a/src/lib/Server/Input/Parser/UserGroupUpdate.php +++ b/src/lib/Server/Input/Parser/UserGroupUpdate.php @@ -21,36 +21,20 @@ */ class UserGroupUpdate extends BaseParser { - /** - * User service. - */ protected UserService $userService; - /** - * Content service. - */ protected ContentService $contentService; - /** - * Location service. - */ protected LocationService $locationService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Rest\Input\FieldTypeParser $fieldTypeParser - */ - public function __construct(UserService $userService, ContentService $contentService, LocationService $locationService, FieldTypeParser $fieldTypeParser) - { + public function __construct( + UserService $userService, + ContentService $contentService, + LocationService $locationService, + FieldTypeParser $fieldTypeParser, + ) { $this->userService = $userService; $this->contentService = $contentService; $this->locationService = $locationService; @@ -59,11 +43,6 @@ public function __construct(UserService $userService, ContentService $contentSer /** * Parse input structure. - * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * - * @return \Ibexa\Rest\Server\Values\RestUserGroupUpdateStruct */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestUserGroupUpdateStruct { @@ -78,7 +57,7 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestUs throw new Exceptions\Parser("Missing '_href' attribute for the Section element in UserGroupUpdate."); } - $parsedData['sectionId'] = $this->uriParser->getAttributeFromUri($data['Section']['_href'], 'sectionId'); + $parsedData['sectionId'] = (int)$this->uriParser->getAttributeFromUri($data['Section']['_href'], 'sectionId'); } if (array_key_exists('remoteId', $data)) { diff --git a/src/lib/Server/Input/Parser/UserUpdate.php b/src/lib/Server/Input/Parser/UserUpdate.php index 4d569e93c..8fb6d571b 100644 --- a/src/lib/Server/Input/Parser/UserUpdate.php +++ b/src/lib/Server/Input/Parser/UserUpdate.php @@ -37,11 +37,6 @@ public function __construct(UserService $userService, ContentService $contentSer $this->parserTools = $parserTools; } - /** - * @param array $data - * - * @return \Ibexa\Rest\Server\Values\RestUserUpdateStruct - */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestUserUpdateStruct { $parsedData = []; @@ -69,7 +64,7 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestUs throw new Exceptions\Parser("Missing '_href' attribute for the Section element in UserUpdate."); } - $parsedData['sectionId'] = $this->uriParser->getAttributeFromUri($data['Section']['_href'], 'sectionId'); + $parsedData['sectionId'] = (int)$this->uriParser->getAttributeFromUri($data['Section']['_href'], 'sectionId'); } if (array_key_exists('remoteId', $data)) { diff --git a/src/lib/Server/Input/Parser/VersionUpdate.php b/src/lib/Server/Input/Parser/VersionUpdate.php index b26ca9e9a..64a1aa4d1 100644 --- a/src/lib/Server/Input/Parser/VersionUpdate.php +++ b/src/lib/Server/Input/Parser/VersionUpdate.php @@ -18,14 +18,8 @@ */ class VersionUpdate extends BaseParser { - /** - * Content service. - */ protected ContentService $contentService; - /** - * FieldType parser. - */ protected FieldTypeParser $fieldTypeParser; public function __construct(ContentService $contentService, FieldTypeParser $fieldTypeParser) @@ -35,8 +29,6 @@ public function __construct(ContentService $contentService, FieldTypeParser $fie } /** - * @param array $data - * * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): mixed diff --git a/src/lib/Server/Input/Parser/ViewInput.php b/src/lib/Server/Input/Parser/ViewInput.php index e0d4fd6cf..049662157 100644 --- a/src/lib/Server/Input/Parser/ViewInput.php +++ b/src/lib/Server/Input/Parser/ViewInput.php @@ -20,12 +20,7 @@ class ViewInput extends BaseParser /** * Parses input structure to a RestViewInput struct. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Rest\Server\Values\RestViewInput */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestViewInput { diff --git a/src/lib/Server/Input/Parser/ViewInputOneDotOne.php b/src/lib/Server/Input/Parser/ViewInputOneDotOne.php index 621e3053a..c73c53a61 100644 --- a/src/lib/Server/Input/Parser/ViewInputOneDotOne.php +++ b/src/lib/Server/Input/Parser/ViewInputOneDotOne.php @@ -20,12 +20,7 @@ class ViewInputOneDotOne extends CriterionParser /** * Parses input structure to a RestViewInput struct. * - * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher - * * @throws \Ibexa\Contracts\Rest\Exceptions\Parser - * - * @return \Ibexa\Rest\Server\Values\RestViewInput */ public function parse(array $data, ParsingDispatcher $parsingDispatcher): RestViewInput { diff --git a/src/lib/Server/Output/ValueObjectVisitor/AbstractPolicy.php b/src/lib/Server/Output/ValueObjectVisitor/AbstractPolicy.php new file mode 100644 index 000000000..4d35ae370 --- /dev/null +++ b/src/lib/Server/Output/ValueObjectVisitor/AbstractPolicy.php @@ -0,0 +1,56 @@ +startAttribute( + 'href', + $this->router->generate('ibexa.rest.load_policy', ['roleId' => $data->roleId, 'policyId' => $data->id]) + ); + $generator->endAttribute('href'); + + $generator->startValueElement('id', $data->id); + $generator->endValueElement('id'); + + if ($data instanceof PolicyDraft) { + $generator->startValueElement('originalId', $data->originalId); + $generator->endValueElement('originalId'); + } + + $generator->startValueElement('module', $data->module); + $generator->endValueElement('module'); + + $generator->startValueElement('function', $data->function); + $generator->endValueElement('function'); + + $limitations = $data->getLimitations(); + if (!empty($limitations)) { + $generator->startHashElement('limitations'); + $generator->startList('limitation'); + + foreach ($limitations as $limitation) { + $this->visitLimitation($generator, $limitation); + } + + $generator->endList('limitation'); + $generator->endHashElement('limitations'); + } + } +} diff --git a/src/lib/Server/Output/ValueObjectVisitor/Author.php b/src/lib/Server/Output/ValueObjectVisitor/Author.php index 48db2d0d3..3532961b4 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Author.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Author.php @@ -15,9 +15,9 @@ final class Author extends ValueObjectVisitor { /** - * @var \Ibexa\Core\FieldType\Author\Author + * @param \Ibexa\Core\FieldType\Author\Author $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Author'); $generator->valueElement('name', $data->name); diff --git a/src/lib/Server/Output/ValueObjectVisitor/BadRequestException.php b/src/lib/Server/Output/ValueObjectVisitor/BadRequestException.php index a26167052..44ea4873f 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/BadRequestException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/BadRequestException.php @@ -14,8 +14,6 @@ class BadRequestException extends Exception { /** * Returns HTTP status code. - * - * @return int */ protected function getStatus(): int { diff --git a/src/lib/Server/Output/ValueObjectVisitor/BadStateException.php b/src/lib/Server/Output/ValueObjectVisitor/BadStateException.php index 3a5e43a88..b41946e77 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/BadStateException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/BadStateException.php @@ -14,8 +14,6 @@ class BadStateException extends Exception { /** * Returns HTTP status code. - * - * @return int */ protected function getStatus(): int { diff --git a/src/lib/Server/Output/ValueObjectVisitor/BookmarkList.php b/src/lib/Server/Output/ValueObjectVisitor/BookmarkList.php index fb18fb446..8de739d4d 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/BookmarkList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/BookmarkList.php @@ -16,9 +16,9 @@ class BookmarkList extends ValueObjectVisitor { /** - * {@inheritdoc} + * @param \Ibexa\Rest\Server\Values\BookmarkList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('BookmarkList'); $visitor->setHeader('Content-Type', $generator->getMediaType('BookmarkList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/CachedValue.php b/src/lib/Server/Output/ValueObjectVisitor/CachedValue.php index 517527b9c..384fa7308 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CachedValue.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CachedValue.php @@ -28,11 +28,9 @@ public function __construct(ConfigResolverInterface $configResolver) } /** - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CachedValue $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->visitValueObject($data->value); @@ -57,7 +55,7 @@ public function visit(Visitor $visitor, Generator $generator, $data): void } } - public function getParameter($parameterName, $defaultValue = null) + public function getParameter(string $parameterName, mixed $defaultValue = null) { if ($this->configResolver->hasParameter($parameterName)) { return $this->configResolver->getParameter($parameterName); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Conflict.php b/src/lib/Server/Output/ValueObjectVisitor/Conflict.php index 5c7433612..b766bfcdf 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Conflict.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Conflict.php @@ -16,7 +16,7 @@ */ class Conflict extends ValueObjectVisitor { - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(409); } diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentFieldValidationException.php b/src/lib/Server/Output/ValueObjectVisitor/ContentFieldValidationException.php index ff8a70ad5..c26b93328 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentFieldValidationException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentFieldValidationException.php @@ -20,11 +20,9 @@ class ContentFieldValidationException extends BadRequestException /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Exceptions\ContentFieldValidationException $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ErrorMessage'); @@ -91,10 +89,8 @@ public function visit(Visitor $visitor, Generator $generator, $data): void * Convert a Translation object to a string, detecting singular/plural as needed. * * @param \Ibexa\Contracts\Core\Repository\Values\Translation $translation The Translation object - * - * @return string */ - private function translationToString(Translation $translation) + private function translationToString(Translation $translation): string { $values = $translation->values; if ($translation instanceof Translation\Plural) { diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentList.php b/src/lib/Server/Output/ValueObjectVisitor/ContentList.php index 256c5a86f..7760c04db 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentList.php @@ -19,11 +19,9 @@ class ContentList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ContentList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentType.php b/src/lib/Server/Output/ValueObjectVisitor/ContentType.php index 93327a4c2..aa0628a7f 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentType.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentType.php @@ -19,7 +19,7 @@ final class ContentType extends ValueObjectVisitor implements DelegateValueObjec /** * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->visitValueObject( new RestContentType( diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroup.php b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroup.php index 33bebcf69..469948874 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroup.php @@ -20,18 +20,16 @@ class ContentTypeGroup extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentTypeGroup'); $this->visitContentTypeGroupAttributes($visitor, $generator, $data); $generator->endObjectElement('ContentTypeGroup'); } - protected function visitContentTypeGroupAttributes(Visitor $visitor, Generator $generator, ContentTypeGroupValue $data) + protected function visitContentTypeGroupAttributes(Visitor $visitor, Generator $generator, ContentTypeGroupValue $data): void { $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeGroup')); $visitor->setHeader('Accept-Patch', $generator->getMediaType('ContentTypeGroupInput')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupList.php b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupList.php index d2e73f47f..9d2820451 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupList.php @@ -19,11 +19,9 @@ class ContentTypeGroupList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ContentTypeGroupList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentTypeGroupList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeGroupList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupRefList.php b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupRefList.php index eba280a8c..7505418b1 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupRefList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeGroupRefList.php @@ -19,11 +19,9 @@ class ContentTypeGroupRefList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ContentTypeGroupRefList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentTypeGroupRefList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeGroupRefList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoList.php b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoList.php index a0f5e6715..173f91117 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoList.php @@ -20,11 +20,9 @@ class ContentTypeInfoList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ContentTypeInfoList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentTypeInfoList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeInfoList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeList.php b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeList.php index c86681246..a19b0bcca 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ContentTypeList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ContentTypeList.php @@ -20,11 +20,9 @@ class ContentTypeList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ContentTypeList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ContentTypeList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/CountryList.php b/src/lib/Server/Output/ValueObjectVisitor/CountryList.php index b3fa3e085..e9c49a9ee 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CountryList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CountryList.php @@ -19,11 +19,9 @@ class CountryList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CountryList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('CountryList'); $visitor->setHeader('Content-Type', $generator->getMediaType('CountryList')); @@ -31,7 +29,7 @@ public function visit(Visitor $visitor, Generator $generator, $data): void $generator->startList('Country'); - foreach ($data->countries as $country) { + foreach ($data->getCountries() as $country) { $generator->startObjectElement('Country', 'Country'); $generator->startAttribute('id', $country['Alpha2']); diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedContent.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedContent.php index be7472fbf..e2ca32a24 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedContent.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedContent.php @@ -18,11 +18,9 @@ class CreatedContent extends RestContent /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedContent $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->content); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedContentType.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedContentType.php index a568dd604..fdb63c426 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedContentType.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedContentType.php @@ -20,11 +20,9 @@ class CreatedContentType extends RestContentType /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedContentType $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $restContentType = $data->contentType; diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedContentTypeGroup.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedContentTypeGroup.php index f762a4619..20b8c50f1 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedContentTypeGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedContentTypeGroup.php @@ -20,11 +20,9 @@ class CreatedContentTypeGroup extends ContentTypeGroup /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedContentTypeGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->contentTypeGroup); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php index 46acaefd0..22ff6ae9e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php @@ -20,11 +20,9 @@ class CreatedFieldDefinition extends RestFieldDefinition /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedFieldDefinition $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $restFieldDefinition = $data->fieldDefinition; diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedLocation.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedLocation.php index 8efea31d1..ddb58ccba 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedLocation.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedLocation.php @@ -20,11 +20,9 @@ class CreatedLocation extends RestLocation /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedLocation $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->restLocation); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectState.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectState.php index 4d1db4389..1c1dd552e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectState.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectState.php @@ -20,11 +20,9 @@ class CreatedObjectState extends RestObjectState /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedObjectState $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->objectState); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectStateGroup.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectStateGroup.php index 65d3476c4..3559e0e4e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectStateGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedObjectStateGroup.php @@ -20,11 +20,9 @@ class CreatedObjectStateGroup extends ObjectStateGroup /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedObjectStateGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->objectStateGroup); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedPolicy.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedPolicy.php index 79636e5a4..e2c240d22 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedPolicy.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedPolicy.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Output\ValueObjectVisitor; +use Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\Visitor; @@ -15,18 +16,26 @@ * * @todo coverage add unit test */ -class CreatedPolicy extends Policy +class CreatedPolicy extends AbstractPolicy { /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedPolicy $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { - parent::visit($visitor, $generator, $data->policy); + $generator->startObjectElement('Policy'); + $visitor->setHeader( + 'Content-Type', + $generator->getMediaType( + $data->policy instanceof PolicyDraft ? 'PolicyDraft' : 'Policy' + ), + ); + $visitor->setHeader('Accept-Patch', $generator->getMediaType('PolicyUpdate')); + $this->visitPolicyAttributes($generator, $data->policy); + $generator->endObjectElement('Policy'); + $visitor->setHeader( 'Location', $this->router->generate( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedRelation.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedRelation.php index 0785d51e8..1bce1f3b8 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedRelation.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedRelation.php @@ -20,11 +20,9 @@ class CreatedRelation extends RestRelation /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedRelation $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->relation); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php index 97163d4b3..3dad808f3 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedRole.php @@ -20,18 +20,16 @@ class CreatedRole extends Role /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedRole $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { - parent::visit($visitor, $generator, $data->role); + parent::visit($visitor, $generator, $data->role->innerRole); $visitor->setHeader( 'Location', $this->router->generate( 'ibexa.rest.load_role', - ['roleId' => $data->role->id] + ['roleId' => $data->role->innerRole->id] ) ); $visitor->setStatus(201); diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedSection.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedSection.php index 68a1a0dd6..a24b7fa97 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedSection.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedSection.php @@ -20,11 +20,9 @@ class CreatedSection extends Section /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedSection $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->section); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedURLAlias.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedURLAlias.php index cda5296e8..88d7108d8 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedURLAlias.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedURLAlias.php @@ -20,11 +20,9 @@ class CreatedURLAlias extends URLAlias /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedURLAlias $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->urlAlias); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedURLWildcard.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedURLWildcard.php index 4ca1ae641..cf2888b07 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedURLWildcard.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedURLWildcard.php @@ -20,11 +20,9 @@ class CreatedURLWildcard extends URLWildcard /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedURLWildcard $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->urlWildcard); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedUser.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedUser.php index f91675465..af82dbe52 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedUser.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedUser.php @@ -20,11 +20,9 @@ class CreatedUser extends RestUser /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedUser $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->user); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedUserGroup.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedUserGroup.php index b3e14f391..f129c0d08 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedUserGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedUserGroup.php @@ -20,11 +20,9 @@ class CreatedUserGroup extends RestUserGroup /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedUserGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->userGroup); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedVersion.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedVersion.php index 3d1cd2d89..951d161e1 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedVersion.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedVersion.php @@ -20,11 +20,9 @@ class CreatedVersion extends Version /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\CreatedVersion $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data->version); $visitor->setHeader( diff --git a/src/lib/Server/Output/ValueObjectVisitor/DeletedUserSession.php b/src/lib/Server/Output/ValueObjectVisitor/DeletedUserSession.php index d162fc235..34a6e4bc2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/DeletedUserSession.php +++ b/src/lib/Server/Output/ValueObjectVisitor/DeletedUserSession.php @@ -15,11 +15,9 @@ class DeletedUserSession extends NoContent /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\DeletedUserSession $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { parent::visit($visitor, $generator, $data); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Exception.php b/src/lib/Server/Output/ValueObjectVisitor/Exception.php index 0d234540d..6fe13e8b7 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Exception.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Exception.php @@ -24,13 +24,10 @@ class Exception extends AbstractExceptionVisitor /** * Construct from debug flag. - * - * @param bool $debug - * @param \Symfony\Contracts\Translation\TranslatorInterface|null $translator */ - public function __construct($debug = false, ?TranslatorInterface $translator = null) + public function __construct(bool $debug = false, ?TranslatorInterface $translator = null) { - $this->debug = (bool)$debug; + $this->debug = $debug; $this->translator = $translator; } diff --git a/src/lib/Server/Output/ValueObjectVisitor/Field.php b/src/lib/Server/Output/ValueObjectVisitor/Field.php index 22bbf07da..750dd8ac5 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Field.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Field.php @@ -27,7 +27,7 @@ public function __construct(FieldTypeSerializer $fieldTypeSerializer) * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startHashElement('field'); diff --git a/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php b/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php index acd0023a4..41ed9e344 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php @@ -19,11 +19,9 @@ class FieldDefinitionList extends RestContentTypeBase /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\FieldDefinitionList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $fieldDefinitionList = $data; $contentType = $fieldDefinitionList->contentType; diff --git a/src/lib/Server/Output/ValueObjectVisitor/ForbiddenException.php b/src/lib/Server/Output/ValueObjectVisitor/ForbiddenException.php index 33b99d2df..470b44d0e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ForbiddenException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ForbiddenException.php @@ -14,8 +14,6 @@ class ForbiddenException extends Exception { /** * Returns HTTP status code. - * - * @return int */ protected function getStatus(): int { diff --git a/src/lib/Server/Output/ValueObjectVisitor/ImageVariation.php b/src/lib/Server/Output/ValueObjectVisitor/ImageVariation.php index 5ae59040c..6faa72802 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ImageVariation.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ImageVariation.php @@ -17,15 +17,15 @@ class ImageVariation extends ValueObjectVisitor /** * @param \Ibexa\Contracts\Core\Variation\Values\ImageVariation $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setHeader('Content-Type', $generator->getMediaType('ContentImageVariation')); $generator->startObjectElement('ContentImageVariation'); - $this->visitImageVariationAttributes($visitor, $generator, $data); + $this->visitImageVariationAttributes($generator, $data); $generator->endObjectElement('ContentImageVariation'); } - protected function visitImageVariationAttributes(Visitor $visitor, Generator $generator, ImageVariationValue $data) + protected function visitImageVariationAttributes(Generator $generator, ImageVariationValue $data): void { $generator->startAttribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/InvalidArgumentException.php b/src/lib/Server/Output/ValueObjectVisitor/InvalidArgumentException.php index a76b7a7cf..a62c3a83b 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/InvalidArgumentException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/InvalidArgumentException.php @@ -14,8 +14,6 @@ class InvalidArgumentException extends Exception { /** * Returns HTTP status code. - * - * @return int */ protected function getStatus(): int { diff --git a/src/lib/Server/Output/ValueObjectVisitor/Language.php b/src/lib/Server/Output/ValueObjectVisitor/Language.php index dff1dd5e8..a850f76b2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Language.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Language.php @@ -18,15 +18,15 @@ final class Language extends ValueObjectVisitor /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Language'); $visitor->setHeader('Content-Type', $generator->getMediaType('Language')); - $this->visitLanguageAttributes($visitor, $generator, $data); + $this->visitLanguageAttributes($generator, $data); $generator->endObjectElement('Language'); } - private function visitLanguageAttributes(Visitor $visitor, Generator $generator, LanguageValue $language): void + private function visitLanguageAttributes(Generator $generator, LanguageValue $language): void { $generator->attribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/LanguageList.php b/src/lib/Server/Output/ValueObjectVisitor/LanguageList.php index c9c82d4bc..76cfd1c30 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/LanguageList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/LanguageList.php @@ -17,7 +17,7 @@ final class LanguageList extends ValueObjectVisitor /** * @param \Ibexa\Rest\Server\Values\LanguageList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('LanguageList'); $visitor->setHeader('Content-Type', $generator->getMediaType('LanguageList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Location.php b/src/lib/Server/Output/ValueObjectVisitor/Location.php index 4ed61e8a0..3a09efa7c 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Location.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Location.php @@ -29,17 +29,13 @@ public function __construct( /** * Visit struct returned by controllers. - * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ - public function visit(Visitor $visitor, Generator $generator, $location): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Location'); $visitor->setHeader('Content-Type', $generator->getMediaType('Location')); $visitor->setHeader('Accept-Patch', $generator->getMediaType('LocationUpdate')); - $this->visitLocationAttributes($visitor, $generator, $location); + $this->visitLocationAttributes($visitor, $generator, $data); $generator->endObjectElement('Location'); } @@ -51,7 +47,7 @@ protected function visitLocationAttributes( Visitor $visitor, Generator $generator, Content\Location $location - ) { + ): void { $generator->startAttribute( 'href', $this->router->generate( diff --git a/src/lib/Server/Output/ValueObjectVisitor/LocationList.php b/src/lib/Server/Output/ValueObjectVisitor/LocationList.php index 037307480..a4436cc0a 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/LocationList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/LocationList.php @@ -19,11 +19,9 @@ class LocationList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\LocationList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('LocationList'); $visitor->setHeader('Content-Type', $generator->getMediaType('LocationList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/NoContent.php b/src/lib/Server/Output/ValueObjectVisitor/NoContent.php index 9561f85cb..dc8372ee9 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/NoContent.php +++ b/src/lib/Server/Output/ValueObjectVisitor/NoContent.php @@ -19,11 +19,9 @@ class NoContent extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\NoContent $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(204); } diff --git a/src/lib/Server/Output/ValueObjectVisitor/NotFoundException.php b/src/lib/Server/Output/ValueObjectVisitor/NotFoundException.php index a26ec2f91..30ead53a2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/NotFoundException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/NotFoundException.php @@ -14,8 +14,6 @@ class NotFoundException extends Exception { /** * Returns HTTP status code. - * - * @return int */ protected function getStatus(): int { diff --git a/src/lib/Server/Output/ValueObjectVisitor/NotImplementedException.php b/src/lib/Server/Output/ValueObjectVisitor/NotImplementedException.php index bb132ec35..670649f46 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/NotImplementedException.php +++ b/src/lib/Server/Output/ValueObjectVisitor/NotImplementedException.php @@ -14,8 +14,6 @@ class NotImplementedException extends Exception { /** * Returns HTTP status code. - * - * @return int */ protected function getStatus(): int { diff --git a/src/lib/Server/Output/ValueObjectVisitor/OK.php b/src/lib/Server/Output/ValueObjectVisitor/OK.php index c94a02b34..b879280b7 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/OK.php +++ b/src/lib/Server/Output/ValueObjectVisitor/OK.php @@ -13,7 +13,7 @@ class OK extends ValueObjectVisitor { - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(200); } diff --git a/src/lib/Server/Output/ValueObjectVisitor/ObjectState.php b/src/lib/Server/Output/ValueObjectVisitor/ObjectState.php index 4f14c7d5f..be098fced 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ObjectState.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ObjectState.php @@ -19,7 +19,7 @@ final class ObjectState extends ValueObjectVisitor implements DelegateValueObjec /** * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->visitValueObject( new RestObjectState( diff --git a/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroup.php b/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroup.php index d75193dbd..be53ffd18 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroup.php @@ -20,20 +20,18 @@ class ObjectStateGroup extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ObjectStateGroup'); $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateGroup')); $visitor->setHeader('Accept-Patch', $generator->getMediaType('ObjectStateGroupUpdate')); - $this->visitObjectStateGroupAttributes($visitor, $generator, $data); + $this->visitObjectStateGroupAttributes($generator, $data); $generator->endObjectElement('ObjectStateGroup'); } - protected function visitObjectStateGroupAttributes(Visitor $visitor, Generator $generator, ObjectStateGroupValue $data) + protected function visitObjectStateGroupAttributes(Generator $generator, ObjectStateGroupValue $data): void { $generator->startAttribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupList.php b/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupList.php index 87c1009dc..bff794e42 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupList.php @@ -19,11 +19,9 @@ class ObjectStateGroupList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ObjectStateGroupList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ObjectStateGroupList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateGroupList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ObjectStateList.php b/src/lib/Server/Output/ValueObjectVisitor/ObjectStateList.php index 4f7256714..c3d0b0c33 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ObjectStateList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ObjectStateList.php @@ -20,11 +20,9 @@ class ObjectStateList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ObjectStateList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ObjectStateList'); $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Options.php b/src/lib/Server/Output/ValueObjectVisitor/Options.php index 5a30ee757..3ce3bc3a2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Options.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Options.php @@ -18,7 +18,7 @@ */ class Options extends ValueObjectVisitor { - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setHeader('Allow', implode(',', $data->allowedMethods)); $visitor->setHeader('Content-Length', 0); diff --git a/src/lib/Server/Output/ValueObjectVisitor/PermanentRedirect.php b/src/lib/Server/Output/ValueObjectVisitor/PermanentRedirect.php index 2ba6753f1..b60fa016d 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/PermanentRedirect.php +++ b/src/lib/Server/Output/ValueObjectVisitor/PermanentRedirect.php @@ -19,11 +19,9 @@ class PermanentRedirect extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\PermanentRedirect $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(301); $visitor->setHeader('Location', $data->redirectUri); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Policy.php b/src/lib/Server/Output/ValueObjectVisitor/Policy.php index 315ddab23..9f1f42e73 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Policy.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Policy.php @@ -7,66 +7,26 @@ namespace Ibexa\Rest\Server\Output\ValueObjectVisitor; -use Ibexa\Contracts\Core\Repository\Values\User\Policy as PolicyValue; use Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft; use Ibexa\Contracts\Rest\Output\Generator; -use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; use Ibexa\Contracts\Rest\Output\Visitor; /** * Policy value object visitor. */ -class Policy extends ValueObjectVisitor +class Policy extends AbstractPolicy { /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param Policy|\Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft $data + * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Policy'); $visitor->setHeader('Content-Type', $generator->getMediaType($data instanceof PolicyDraft ? 'PolicyDraft' : 'Policy')); $visitor->setHeader('Accept-Patch', $generator->getMediaType('PolicyUpdate')); - $this->visitPolicyAttributes($visitor, $generator, $data); + $this->visitPolicyAttributes($generator, $data); $generator->endObjectElement('Policy'); } - - protected function visitPolicyAttributes(Visitor $visitor, Generator $generator, PolicyValue $data) - { - $generator->startAttribute( - 'href', - $this->router->generate('ibexa.rest.load_policy', ['roleId' => $data->roleId, 'policyId' => $data->id]) - ); - $generator->endAttribute('href'); - - $generator->startValueElement('id', $data->id); - $generator->endValueElement('id'); - - if ($data instanceof PolicyDraft) { - $generator->startValueElement('originalId', $data->originalId); - $generator->endValueElement('originalId'); - } - - $generator->startValueElement('module', $data->module); - $generator->endValueElement('module'); - - $generator->startValueElement('function', $data->function); - $generator->endValueElement('function'); - - $limitations = $data->getLimitations(); - if (!empty($limitations)) { - $generator->startHashElement('limitations'); - $generator->startList('limitation'); - - foreach ($limitations as $limitation) { - $this->visitLimitation($generator, $limitation); - } - - $generator->endList('limitation'); - $generator->endHashElement('limitations'); - } - } } diff --git a/src/lib/Server/Output/ValueObjectVisitor/PolicyList.php b/src/lib/Server/Output/ValueObjectVisitor/PolicyList.php index 1ef859ab8..7b23b74d3 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/PolicyList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/PolicyList.php @@ -19,11 +19,9 @@ class PolicyList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\PolicyList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('PolicyList'); $visitor->setHeader('Content-Type', $generator->getMediaType('PolicyList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php b/src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php index 11ff00a1c..3200a92c2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php +++ b/src/lib/Server/Output/ValueObjectVisitor/PublishedRole.php @@ -20,18 +20,16 @@ class PublishedRole extends Role /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\PublishedRole $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { - parent::visit($visitor, $generator, $data->role); + parent::visit($visitor, $generator, $data->role->innerRole); $visitor->setHeader( 'Location', $this->router->generate( 'ibexa.rest.load_role', - ['roleId' => $data->role->id] + ['roleId' => $data->role->innerRole->id] ) ); $visitor->setStatus(204); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Range.php b/src/lib/Server/Output/ValueObjectVisitor/Range.php index 981d88318..fcdd1548a 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Range.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Range.php @@ -17,7 +17,7 @@ final class Range extends ValueObjectVisitor /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\Range $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Range'); $generator->valueElement('from', $data->getFrom()); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RangeAggregationResult.php b/src/lib/Server/Output/ValueObjectVisitor/RangeAggregationResult.php index fa6a4120b..da137e2fe 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RangeAggregationResult.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RangeAggregationResult.php @@ -19,7 +19,7 @@ final class RangeAggregationResult extends ValueObjectVisitor /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\RangeAggregationResult $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('RangeAggregationResult'); @@ -40,7 +40,7 @@ private function visitEntry(Visitor $visitor, Generator $generator, RangeAggrega { $generator->startObjectElement('RangeAggregationResultEntry'); $this->visitKey($visitor, $generator, $entry->getKey()); - $this->visitCount($visitor, $generator, $entry->getCount()); + $this->visitCount($generator, $entry->getCount()); $generator->endObjectElement('RangeAggregationResultEntry'); } @@ -51,7 +51,7 @@ private function visitKey(Visitor $visitor, Generator $generator, Range $key): v $generator->endHashElement('key'); } - private function visitCount(Visitor $visitor, Generator $generator, int $count): void + private function visitCount(Generator $generator, int $count): void { $generator->valueElement('count', $count); } diff --git a/src/lib/Server/Output/ValueObjectVisitor/RelationList.php b/src/lib/Server/Output/ValueObjectVisitor/RelationList.php index e5ccbb521..ce5ac9b9d 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RelationList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RelationList.php @@ -20,11 +20,9 @@ class RelationList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RelationList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Relations', 'RelationList'); $visitor->setHeader('Content-Type', $generator->getMediaType('RelationList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/ResourceCreated.php b/src/lib/Server/Output/ValueObjectVisitor/ResourceCreated.php index a627a85a7..e7ea49116 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/ResourceCreated.php +++ b/src/lib/Server/Output/ValueObjectVisitor/ResourceCreated.php @@ -19,11 +19,9 @@ class ResourceCreated extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\ResourceCreated $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(201); $visitor->setHeader('Location', $data->redirectUri); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestContent.php b/src/lib/Server/Output/ValueObjectVisitor/RestContent.php index 1debc076b..c5939030b 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestContent.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestContent.php @@ -30,11 +30,9 @@ public function __construct(TranslationHelper $translationHelper) /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestContent $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $restContent = $data; $contentInfo = $restContent->contentInfo; @@ -92,12 +90,12 @@ public function visit(Visitor $visitor, Generator $generator, $data): void ); // Embed current version, if available - if ($currentVersion !== null) { + if ($currentVersion !== null && $contentType !== null) { $visitor->visitValueObject( new VersionValue( $currentVersion, $contentType, - $restContent->relations + $restContent->relations ?? [], ) ); } @@ -111,8 +109,8 @@ public function visit(Visitor $visitor, Generator $generator, $data): void ); $generator->endObjectElement('Section'); - // Main location will not exist if we're visiting the content draft - if ($data->mainLocation !== null) { + // The main location will not exist if we're visiting the content draft + if ($mainLocation !== null) { $generator->startObjectElement('MainLocation', 'Location'); $generator->attribute( 'href', @@ -195,13 +193,9 @@ public function visit(Visitor $visitor, Generator $generator, $data): void /** * Maps the given content $status to a representative string. * - * @param int $status - * * @throws \Ibexa\Core\Base\Exceptions\BadStateException - * - * @return string */ - protected function getStatusString($status): string + protected function getStatusString(int $status): string { switch ($status) { case ContentInfo::STATUS_DRAFT: diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestContentType.php b/src/lib/Server/Output/ValueObjectVisitor/RestContentType.php index a1b1ac576..cdcdca802 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestContentType.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestContentType.php @@ -20,11 +20,9 @@ class RestContentType extends RestContentTypeBase /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestContentType $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $contentType = $data->contentType; diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php b/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php index 51da108f4..7f791462a 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php @@ -18,12 +18,8 @@ abstract class RestContentTypeBase extends ValueObjectVisitor /** * Returns a suffix for the URL type to generate on basis of the given * $contentTypeStatus. - * - * @param int $contentTypeStatus - * - * @return string */ - protected function getUrlTypeSuffix($contentTypeStatus) + protected function getUrlTypeSuffix(int $contentTypeStatus): string { switch ($contentTypeStatus) { case Values\ContentType\ContentType::STATUS_DRAFT: @@ -38,12 +34,8 @@ protected function getUrlTypeSuffix($contentTypeStatus) /** * Serializes the given $contentTypeStatus to a string representation. - * - * @param int $contentTypeStatus - * - * @return string */ - protected function serializeStatus($contentTypeStatus) + protected function serializeStatus(int $contentTypeStatus): string { switch ($contentTypeStatus) { case Values\ContentType\ContentType::STATUS_DEFINED: diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestExecutedView.php b/src/lib/Server/Output/ValueObjectVisitor/RestExecutedView.php index b8ceaf078..96c64afac 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestExecutedView.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestExecutedView.php @@ -32,11 +32,9 @@ public function __construct( /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestExecutedView $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('View'); $visitor->setHeader('Content-Type', $generator->getMediaType('View')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php b/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php index a67db95b4..b9551ed1a 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php @@ -21,9 +21,6 @@ class RestFieldDefinition extends RestContentTypeBase { protected FieldTypeSerializer $fieldTypeSerializer; - /** - * @param \Ibexa\Rest\Output\FieldTypeSerializer $fieldTypeSerializer - */ public function __construct(FieldTypeSerializer $fieldTypeSerializer) { $this->fieldTypeSerializer = $fieldTypeSerializer; @@ -32,11 +29,9 @@ public function __construct(FieldTypeSerializer $fieldTypeSerializer) /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestFieldDefinition $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $restFieldDefinition = $data; $fieldDefinition = $restFieldDefinition->fieldDefinition; diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestLocation.php b/src/lib/Server/Output/ValueObjectVisitor/RestLocation.php index bb91c65d5..e503aed03 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestLocation.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestLocation.php @@ -20,11 +20,9 @@ class RestLocation extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestLocation $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Location'); $visitor->setHeader('Content-Type', $generator->getMediaType('Location')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestObjectState.php b/src/lib/Server/Output/ValueObjectVisitor/RestObjectState.php index f323a8b47..2cc94c55e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestObjectState.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestObjectState.php @@ -19,11 +19,9 @@ class RestObjectState extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Values\RestObjectState $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('ObjectState'); $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectState')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestRelation.php b/src/lib/Server/Output/ValueObjectVisitor/RestRelation.php index dce44ab32..40e969546 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestRelation.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestRelation.php @@ -20,11 +20,9 @@ class RestRelation extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestRelation $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Relation'); $visitor->setHeader('Content-Type', $generator->getMediaType('Relation')); @@ -82,13 +80,9 @@ public function visit(Visitor $visitor, Generator $generator, $data): void /** * Returns $relationType as a readable string. * - * @param int $relationType - * * @throws \Exception - * - * @return string */ - protected function getRelationTypeString($relationType): string + protected function getRelationTypeString(int $relationType): string { $relationTypeList = []; diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestTrashItem.php b/src/lib/Server/Output/ValueObjectVisitor/RestTrashItem.php index 4a7e06be3..801f8a45e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestTrashItem.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestTrashItem.php @@ -20,11 +20,9 @@ class RestTrashItem extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestTrashItem $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('TrashItem'); $visitor->setHeader('Content-Type', $generator->getMediaType('TrashItem')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestUser.php b/src/lib/Server/Output/ValueObjectVisitor/RestUser.php index bf5e24b76..92ad2e682 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestUser.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestUser.php @@ -20,11 +20,9 @@ class RestUser extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestUser $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $contentInfo = $data->contentInfo; diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestUserGroup.php b/src/lib/Server/Output/ValueObjectVisitor/RestUserGroup.php index 612713c5b..d84ba5a03 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestUserGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestUserGroup.php @@ -20,11 +20,9 @@ class RestUserGroup extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestUserGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $contentInfo = $data->contentInfo; $mainLocation = $data->mainLocation; diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestUserGroupRoleAssignment.php b/src/lib/Server/Output/ValueObjectVisitor/RestUserGroupRoleAssignment.php index 9defcb36e..68f215229 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestUserGroupRoleAssignment.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestUserGroupRoleAssignment.php @@ -20,11 +20,9 @@ class RestUserGroupRoleAssignment extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestUserGroupRoleAssignment $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('RoleAssignment'); $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignment')); @@ -37,7 +35,7 @@ public function visit(Visitor $visitor, Generator $generator, $data): void $this->router->generate( 'ibexa.rest.load_role_assignment_for_user_group', [ - 'groupPath' => trim($data->id, '/'), + 'groupPath' => trim((string)$data->id, '/'), 'roleId' => $role->id, ] ) diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestUserRoleAssignment.php b/src/lib/Server/Output/ValueObjectVisitor/RestUserRoleAssignment.php index 99cfa51fd..ee753c629 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestUserRoleAssignment.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestUserRoleAssignment.php @@ -20,11 +20,9 @@ class RestUserRoleAssignment extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RestUserRoleAssignment $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('RoleAssignment'); $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignment')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Role.php b/src/lib/Server/Output/ValueObjectVisitor/Role.php index 5b7d218bb..adcc9148b 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Role.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Role.php @@ -7,10 +7,12 @@ namespace Ibexa\Rest\Server\Output\ValueObjectVisitor; +use Ibexa\Contracts\Core\Repository\Values\User\Role as ApiRole; use Ibexa\Contracts\Core\Repository\Values\User\RoleDraft; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; use Ibexa\Contracts\Rest\Output\Visitor; +use Ibexa\Rest\Server\Values\RestRole; /** * Role value object visitor. @@ -20,20 +22,22 @@ class Role extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator - * @param Role|\Ibexa\Contracts\Core\Repository\Values\User\RoleDraft $data + * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { + $role = $data instanceof RestRole ? $data->innerRole : $data; $generator->startObjectElement('Role'); - $visitor->setHeader('Content-Type', $generator->getMediaType($data instanceof RoleDraft ? 'RoleDraft' : 'Role')); + $visitor->setHeader( + 'Content-Type', + $generator->getMediaType($role instanceof RoleDraft ? 'RoleDraft' : 'Role'), + ); $visitor->setHeader('Accept-Patch', $generator->getMediaType('RoleInput')); - $this->visitRoleAttributes($visitor, $generator, $data); + $this->visitRoleAttributes($generator, $role); $generator->endObjectElement('Role'); } - protected function visitRoleAttributes(Visitor $visitor, Generator $generator, $data) + protected function visitRoleAttributes(Generator $generator, ApiRole $data): void { $generator->startAttribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/RoleAssignmentList.php b/src/lib/Server/Output/ValueObjectVisitor/RoleAssignmentList.php index 48ee92bf5..1b56f6c42 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RoleAssignmentList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RoleAssignmentList.php @@ -20,11 +20,9 @@ class RoleAssignmentList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RoleAssignmentList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('RoleAssignmentList'); $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignmentList')); @@ -40,9 +38,9 @@ public function visit(Visitor $visitor, Generator $generator, $data): void $generator->startList('RoleAssignment'); foreach ($data->roleAssignments as $roleAssignment) { $visitor->visitValueObject( - $data->isGroupAssignment ? - new Values\RestUserGroupRoleAssignment($roleAssignment, $data->id) : - new Values\RestUserRoleAssignment($roleAssignment, $data->id) + $data->isGroupAssignment + ? new Values\RestUserGroupRoleAssignment($roleAssignment, $data->id) + : new Values\RestUserRoleAssignment($roleAssignment, $data->id) ); } $generator->endList('RoleAssignment'); diff --git a/src/lib/Server/Output/ValueObjectVisitor/RoleList.php b/src/lib/Server/Output/ValueObjectVisitor/RoleList.php index b135bed68..2c8535837 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RoleList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RoleList.php @@ -19,11 +19,9 @@ class RoleList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\RoleList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('RoleList'); $visitor->setHeader('Content-Type', $generator->getMediaType('RoleList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Root.php b/src/lib/Server/Output/ValueObjectVisitor/Root.php index e707f5ee5..fdedd8d72 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Root.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Root.php @@ -19,11 +19,9 @@ class Root extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Values\Root $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Root'); $visitor->setHeader('Content-Type', $generator->getMediaType('Root')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Section.php b/src/lib/Server/Output/ValueObjectVisitor/Section.php index ae668ab83..dc4a090be 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Section.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Section.php @@ -20,20 +20,18 @@ class Section extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Section'); $visitor->setHeader('Content-Type', $generator->getMediaType('Section')); $visitor->setHeader('Accept-Patch', $generator->getMediaType('SectionInput')); - $this->visitSectionAttributes($visitor, $generator, $data); + $this->visitSectionAttributes($generator, $data); $generator->endObjectElement('Section'); } - protected function visitSectionAttributes(Visitor $visitor, Generator $generator, SectionValue $data) + protected function visitSectionAttributes(Generator $generator, SectionValue $data): void { $generator->startAttribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/SectionList.php b/src/lib/Server/Output/ValueObjectVisitor/SectionList.php index 943714f50..84f37d37e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/SectionList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/SectionList.php @@ -19,11 +19,9 @@ class SectionList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\SectionList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('SectionList'); $visitor->setHeader('Content-Type', $generator->getMediaType('SectionList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/SeeOther.php b/src/lib/Server/Output/ValueObjectVisitor/SeeOther.php index beb90be0f..41d655a63 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/SeeOther.php +++ b/src/lib/Server/Output/ValueObjectVisitor/SeeOther.php @@ -16,9 +16,14 @@ */ class SeeOther extends ValueObjectVisitor { - public function visit(Visitor $visitor, Generator $generator, $data): void + /** + * Visit struct returned by controllers. + * + * @param \Ibexa\Rest\Server\Values\SeeOther $data + */ + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(303); - $visitor->setHeader('Location', $data->redirectUri); + $visitor->setHeader('Location', $data->getRedirectUri()); } } diff --git a/src/lib/Server/Output/ValueObjectVisitor/StatsAggregationResult.php b/src/lib/Server/Output/ValueObjectVisitor/StatsAggregationResult.php index 59e4fa31a..0f9dd64ca 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/StatsAggregationResult.php +++ b/src/lib/Server/Output/ValueObjectVisitor/StatsAggregationResult.php @@ -17,7 +17,7 @@ final class StatsAggregationResult extends ValueObjectVisitor /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\StatsAggregationResult $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('StatsAggregationResult'); diff --git a/src/lib/Server/Output/ValueObjectVisitor/TemporaryRedirect.php b/src/lib/Server/Output/ValueObjectVisitor/TemporaryRedirect.php index 0c1f11ce9..ef9d14e84 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/TemporaryRedirect.php +++ b/src/lib/Server/Output/ValueObjectVisitor/TemporaryRedirect.php @@ -19,11 +19,9 @@ class TemporaryRedirect extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\TemporaryRedirect $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setStatus(307); $visitor->setHeader('Location', $data->redirectUri); diff --git a/src/lib/Server/Output/ValueObjectVisitor/TermAggregationResult.php b/src/lib/Server/Output/ValueObjectVisitor/TermAggregationResult.php index 670258b67..42d4d51eb 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/TermAggregationResult.php +++ b/src/lib/Server/Output/ValueObjectVisitor/TermAggregationResult.php @@ -18,7 +18,7 @@ final class TermAggregationResult extends ValueObjectVisitor /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\TermAggregationResult $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('TermAggregationResult'); @@ -39,14 +39,11 @@ private function visitEntry(Visitor $visitor, Generator $generator, TermAggregat { $generator->startObjectElement('TermAggregationResultEntry'); $this->visitKey($visitor, $generator, $entry->getKey()); - $this->visitCount($visitor, $generator, $entry->getCount()); + $this->visitCount($generator, $entry->getCount()); $generator->endObjectElement('TermAggregationResultEntry'); } - /** - * @param mixed $key - */ - private function visitKey(Visitor $visitor, Generator $generator, $key): void + private function visitKey(Visitor $visitor, Generator $generator, mixed $key): void { if (is_object($key)) { $generator->startHashElement('key'); @@ -57,7 +54,7 @@ private function visitKey(Visitor $visitor, Generator $generator, $key): void } } - private function visitCount(Visitor $visitor, Generator $generator, int $count): void + private function visitCount(Generator $generator, int $count): void { $generator->valueElement('count', $count); } diff --git a/src/lib/Server/Output/ValueObjectVisitor/Trash.php b/src/lib/Server/Output/ValueObjectVisitor/Trash.php index 7af4e479f..c0f4cc7e2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Trash.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Trash.php @@ -19,11 +19,9 @@ class Trash extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\Trash $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('Trash'); $visitor->setHeader('Content-Type', $generator->getMediaType('Trash')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/URLAlias.php b/src/lib/Server/Output/ValueObjectVisitor/URLAlias.php index 263519ade..de61aef4b 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/URLAlias.php +++ b/src/lib/Server/Output/ValueObjectVisitor/URLAlias.php @@ -20,26 +20,20 @@ class URLAlias extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UrlAlias'); $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAlias')); - $this->visitURLAliasAttributes($visitor, $generator, $data); + $this->visitURLAliasAttributes($generator, $data); $generator->endObjectElement('UrlAlias'); } /** * Serializes the given $urlAliasType to a string representation. - * - * @param int $urlAliasType - * - * @return string */ - protected function serializeType($urlAliasType): string + protected function serializeType(int $urlAliasType): string { switch ($urlAliasType) { case URLAliasValue::LOCATION: @@ -55,7 +49,7 @@ protected function serializeType($urlAliasType): string throw new \RuntimeException("Unknown URL alias type: '{$urlAliasType}'."); } - protected function visitURLAliasAttributes(Visitor $visitor, Generator $generator, URLAliasValue $data) + protected function visitURLAliasAttributes(Generator $generator, URLAliasValue $data): void { $generator->startAttribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/URLAliasList.php b/src/lib/Server/Output/ValueObjectVisitor/URLAliasList.php index 6b41dfc02..52015a197 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/URLAliasList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/URLAliasList.php @@ -19,11 +19,9 @@ class URLAliasList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\URLAliasList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UrlAliasList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAliasList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/URLAliasRefList.php b/src/lib/Server/Output/ValueObjectVisitor/URLAliasRefList.php index ed7e475eb..83536d233 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/URLAliasRefList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/URLAliasRefList.php @@ -19,11 +19,9 @@ class URLAliasRefList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\URLAliasRefList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UrlAliasRefList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAliasRefList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/URLWildcard.php b/src/lib/Server/Output/ValueObjectVisitor/URLWildcard.php index a8bb34828..0f07259f8 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/URLWildcard.php +++ b/src/lib/Server/Output/ValueObjectVisitor/URLWildcard.php @@ -20,19 +20,17 @@ class URLWildcard extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->setHeader('Content-Type', $generator->getMediaType('UrlWildcard')); $generator->startObjectElement('UrlWildcard'); - $this->visitURLWildcardAttributes($visitor, $generator, $data); + $this->visitURLWildcardAttributes($generator, $data); $generator->endObjectElement('UrlWildcard'); } - protected function visitURLWildcardAttributes(Visitor $visitor, Generator $generator, URLWildcardValue $data) + protected function visitURLWildcardAttributes(Generator $generator, URLWildcardValue $data): void { $generator->startAttribute( 'href', diff --git a/src/lib/Server/Output/ValueObjectVisitor/URLWildcardList.php b/src/lib/Server/Output/ValueObjectVisitor/URLWildcardList.php index 9b827df90..51b2800d2 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/URLWildcardList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/URLWildcardList.php @@ -19,11 +19,9 @@ class URLWildcardList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\URLWildcardList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UrlWildcardList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UrlWildcardList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/UserGroup.php b/src/lib/Server/Output/ValueObjectVisitor/UserGroup.php index 08c786115..bba8ba35e 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/UserGroup.php +++ b/src/lib/Server/Output/ValueObjectVisitor/UserGroup.php @@ -25,7 +25,7 @@ public function __construct( /** * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $visitor->visitValueObject( new RestUserGroup( diff --git a/src/lib/Server/Output/ValueObjectVisitor/UserGroupList.php b/src/lib/Server/Output/ValueObjectVisitor/UserGroupList.php index 19db6381a..735392091 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/UserGroupList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/UserGroupList.php @@ -19,11 +19,9 @@ class UserGroupList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\UserGroupList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UserGroupList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UserGroupList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/UserGroupRefList.php b/src/lib/Server/Output/ValueObjectVisitor/UserGroupRefList.php index d31cc380a..0cd4bb115 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/UserGroupRefList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/UserGroupRefList.php @@ -19,11 +19,9 @@ class UserGroupRefList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\UserGroupRefList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UserGroupRefList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UserGroupRefList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/UserList.php b/src/lib/Server/Output/ValueObjectVisitor/UserList.php index 6bbc2ddf2..d3b0a4235 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/UserList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/UserList.php @@ -19,11 +19,9 @@ class UserList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\UserList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UserList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UserList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/UserRefList.php b/src/lib/Server/Output/ValueObjectVisitor/UserRefList.php index a05af6327..ea27ed6b1 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/UserRefList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/UserRefList.php @@ -19,11 +19,9 @@ class UserRefList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\UserRefList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('UserRefList'); $visitor->setHeader('Content-Type', $generator->getMediaType('UserRefList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/UserSession.php b/src/lib/Server/Output/ValueObjectVisitor/UserSession.php index ff3707336..817a8a713 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/UserSession.php +++ b/src/lib/Server/Output/ValueObjectVisitor/UserSession.php @@ -20,11 +20,9 @@ class UserSession extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\UserSession $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $status = $data->created ? 201 : 200; $visitor->setStatus($status); @@ -34,11 +32,11 @@ public function visit(Visitor $visitor, Generator $generator, $data): void $visitor->setHeader('Accept-Patch', false); $generator->startObjectElement('Session'); - $this->visitUserSessionAttributes($visitor, $generator, $data); + $this->visitUserSessionAttributes($generator, $data); $generator->endObjectElement('Session'); } - protected function visitUserSessionAttributes(Visitor $visitor, Generator $generator, UserSessionValue $data) + protected function visitUserSessionAttributes(Generator $generator, UserSessionValue $data): void { $sessionHref = $this->router->generate('ibexa.rest.delete_session', ['sessionId' => $data->sessionId]); diff --git a/src/lib/Server/Output/ValueObjectVisitor/Version.php b/src/lib/Server/Output/ValueObjectVisitor/Version.php index 21d4840c9..ecdce9960 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/Version.php +++ b/src/lib/Server/Output/ValueObjectVisitor/Version.php @@ -22,9 +22,6 @@ class Version extends ValueObjectVisitor { protected FieldTypeSerializer $fieldTypeSerializer; - /** - * @param \Ibexa\Rest\Output\FieldTypeSerializer $fieldTypeSerializer - */ public function __construct(FieldTypeSerializer $fieldTypeSerializer) { $this->fieldTypeSerializer = $fieldTypeSerializer; @@ -33,11 +30,9 @@ public function __construct(FieldTypeSerializer $fieldTypeSerializer) /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\Version $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ $content = $data->content; @@ -48,12 +43,12 @@ public function visit(Visitor $visitor, Generator $generator, $data): void $visitor->setHeader('Accept-Patch', $generator->getMediaType('VersionUpdate')); $this->visitVersionAttributes($visitor, $generator, $data); - $this->visitThumbnail($visitor, $generator, $content->getThumbnail()); + $this->visitThumbnail($generator, $content->getThumbnail()); $generator->endObjectElement('Version'); } - protected function visitVersionAttributes(Visitor $visitor, Generator $generator, VersionValue $data) + protected function visitVersionAttributes(Visitor $visitor, Generator $generator, VersionValue $data): void { $content = $data->content; @@ -93,7 +88,6 @@ protected function visitVersionAttributes(Visitor $visitor, Generator $generator } private function visitThumbnail( - Visitor $visitor, Generator $generator, ?Thumbnail $thumbnail ): void { diff --git a/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php b/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php index 29d817977..e28956485 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php +++ b/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php @@ -23,11 +23,9 @@ class VersionInfo extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startHashElement('VersionInfo'); $this->visitVersionInfoAttributes($visitor, $generator, $data); @@ -36,12 +34,8 @@ public function visit(Visitor $visitor, Generator $generator, $data): void /** * Maps the given version $status to a representative string. - * - * @param int $status - * - * @return string */ - protected function getStatusString($status): string + protected function getStatusString(int $status): string { switch ($status) { case Values\Content\VersionInfo::STATUS_DRAFT: @@ -57,7 +51,7 @@ protected function getStatusString($status): string throw new RuntimeException('Undefined version status: ' . $status); } - protected function visitVersionInfoAttributes(Visitor $visitor, Generator $generator, VersionInfoValue $versionInfo) + protected function visitVersionInfoAttributes(Visitor $visitor, Generator $generator, VersionInfoValue $versionInfo): void { $generator->startValueElement('id', $versionInfo->id); $generator->endValueElement('id'); diff --git a/src/lib/Server/Output/ValueObjectVisitor/VersionList.php b/src/lib/Server/Output/ValueObjectVisitor/VersionList.php index d01b22d28..7c2efb651 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/VersionList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/VersionList.php @@ -19,11 +19,9 @@ class VersionList extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\VersionList $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $generator->startObjectElement('VersionList'); $visitor->setHeader('Content-Type', $generator->getMediaType('VersionList')); diff --git a/src/lib/Server/Output/ValueObjectVisitor/VersionTranslationInfo.php b/src/lib/Server/Output/ValueObjectVisitor/VersionTranslationInfo.php index e28829d78..d6b0666f8 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/VersionTranslationInfo.php +++ b/src/lib/Server/Output/ValueObjectVisitor/VersionTranslationInfo.php @@ -20,11 +20,9 @@ class VersionTranslationInfo extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator * @param \Ibexa\Rest\Server\Values\VersionTranslationInfo $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void + public function visit(Visitor $visitor, Generator $generator, mixed $data): void { $versionInfo = $data->getVersionInfo(); if (empty($versionInfo->languageCodes)) { @@ -32,12 +30,14 @@ public function visit(Visitor $visitor, Generator $generator, $data): void } $generator->startObjectElement('VersionTranslationInfo'); - $this->visitVersionTranslationInfoAttributes($visitor, $generator, $data); + $this->visitVersionTranslationInfoAttributes($generator, $data); $generator->endObjectElement('VersionTranslationInfo'); } - protected function visitVersionTranslationInfoAttributes(Visitor $visitor, Generator $generator, VersionTranslationInfoValue $versionTranslationInfo) - { + protected function visitVersionTranslationInfoAttributes( + Generator $generator, + VersionTranslationInfoValue $versionTranslationInfo + ): void { $versionInfo = $versionTranslationInfo->getVersionInfo(); // single language-independent conditions for deleting Translation diff --git a/src/lib/Server/Service/ExpressionRouterRootResourceBuilder.php b/src/lib/Server/Service/ExpressionRouterRootResourceBuilder.php index b86ab2484..ab26f359d 100644 --- a/src/lib/Server/Service/ExpressionRouterRootResourceBuilder.php +++ b/src/lib/Server/Service/ExpressionRouterRootResourceBuilder.php @@ -50,8 +50,6 @@ public function __construct(RouterInterface $router, RouterInterface $templateRo /** * Build root resource. - * - * @return array|\Ibexa\Rest\Values\Root */ public function buildRootResource(): Root { diff --git a/src/lib/Server/Service/RootResourceBuilderInterface.php b/src/lib/Server/Service/RootResourceBuilderInterface.php index 3e1a7597d..79697e6ab 100644 --- a/src/lib/Server/Service/RootResourceBuilderInterface.php +++ b/src/lib/Server/Service/RootResourceBuilderInterface.php @@ -7,12 +7,9 @@ namespace Ibexa\Rest\Server\Service; +use Ibexa\Rest\Values\Root; + interface RootResourceBuilderInterface { - /** - * Build root resource. - * - * @return array|\Ibexa\Rest\Values\Root - */ - public function buildRootResource(); + public function buildRootResource(): Root; } diff --git a/src/lib/Server/Values/BookmarkList.php b/src/lib/Server/Values/BookmarkList.php index d2aaf4ae0..b21e73762 100644 --- a/src/lib/Server/Values/BookmarkList.php +++ b/src/lib/Server/Values/BookmarkList.php @@ -12,20 +12,16 @@ class BookmarkList extends RestValue { - /** - * @var int - */ - public $totalCount = 0; + public int $totalCount = 0; /** * @var \Ibexa\Rest\Server\Values\RestLocation[] */ - public $items = []; + public array $items = []; /** * BookmarkList constructor. * - * @param int $totalCount * @param \Ibexa\Rest\Server\Values\RestLocation[] $items */ public function __construct(int $totalCount, array $items) diff --git a/src/lib/Server/Values/CachedValue.php b/src/lib/Server/Values/CachedValue.php index 577325da6..ce020970f 100644 --- a/src/lib/Server/Values/CachedValue.php +++ b/src/lib/Server/Values/CachedValue.php @@ -14,32 +14,37 @@ class CachedValue extends RestValue { /** * Actual value object. - * - * @var mixed */ - public $value; + public mixed $value; /** * Associative array of cache tags. * Example: array( 'locationId' => 59 ). * - * @var mixed[] + * @var array */ - public $cacheTags; + public array $cacheTags; /** * @param mixed $value The value that gets cached - * @param array $cacheTags Tags to add to the cache (supported: locationId) + * @param array $cacheTags Tags to add to the cache (supported: locationId) * * @throw InvalidArgumentException If invalid cache tags are provided */ - public function __construct($value, array $cacheTags = []) + public function __construct(mixed $value, array $cacheTags = []) { $this->value = $value; $this->cacheTags = $this->checkCacheTags($cacheTags); } - protected function checkCacheTags($tags) + /** + * @param array $tags + * + * @return array + * + * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException + */ + protected function checkCacheTags(array $tags): array { $invalidTags = array_diff(array_keys($tags), ['locationId']); if (count($invalidTags) > 0) { diff --git a/src/lib/Server/Values/ContentList.php b/src/lib/Server/Values/ContentList.php index b4727ed6c..3e1035682 100644 --- a/src/lib/Server/Values/ContentList.php +++ b/src/lib/Server/Values/ContentList.php @@ -15,24 +15,19 @@ class ContentList extends RestValue { /** - * Contents. - * * @var \Ibexa\Rest\Server\Values\RestContent[] */ - public $contents; + public array $contents; /** * Total items list count. - * - * @var int */ - public $totalCount; + public int $totalCount; /** * Construct. * * @param \Ibexa\Rest\Server\Values\RestContent[] $contents - * @param int $totalCount */ public function __construct(array $contents, int $totalCount) { diff --git a/src/lib/Server/Values/ContentTypeGroupList.php b/src/lib/Server/Values/ContentTypeGroupList.php index bc15168ff..298a3e122 100644 --- a/src/lib/Server/Values/ContentTypeGroupList.php +++ b/src/lib/Server/Values/ContentTypeGroupList.php @@ -19,7 +19,7 @@ class ContentTypeGroupList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] */ - public $contentTypeGroups; + public array $contentTypeGroups; /** * Construct. diff --git a/src/lib/Server/Values/ContentTypeGroupRefList.php b/src/lib/Server/Values/ContentTypeGroupRefList.php index 3c26c19d2..2f51e1370 100644 --- a/src/lib/Server/Values/ContentTypeGroupRefList.php +++ b/src/lib/Server/Values/ContentTypeGroupRefList.php @@ -8,6 +8,7 @@ namespace Ibexa\Rest\Server\Values; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup; use Ibexa\Rest\Value as RestValue; /** @@ -15,24 +16,14 @@ */ class ContentTypeGroupRefList extends RestValue { - /** - * Content type. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ContentType $contentType; /** - * Content type groups of the content type. - * * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] */ - public $contentTypeGroups; + public array $contentTypeGroups; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroups */ public function __construct(ContentType $contentType, array $contentTypeGroups) diff --git a/src/lib/Server/Values/ContentTypeInfoList.php b/src/lib/Server/Values/ContentTypeInfoList.php index f4eb22d4a..fc9e336ab 100644 --- a/src/lib/Server/Values/ContentTypeInfoList.php +++ b/src/lib/Server/Values/ContentTypeInfoList.php @@ -19,22 +19,17 @@ class ContentTypeInfoList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] */ - public $contentTypes; + public array $contentTypes; /** * Path which was used to fetch the list of content types. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] $contentTypes - * @param string $path */ - public function __construct(array $contentTypes, $path) + public function __construct(array $contentTypes, string $path) { $this->contentTypes = $contentTypes; $this->path = $path; diff --git a/src/lib/Server/Values/ContentTypeList.php b/src/lib/Server/Values/ContentTypeList.php index c725d38c3..102b438cc 100644 --- a/src/lib/Server/Values/ContentTypeList.php +++ b/src/lib/Server/Values/ContentTypeList.php @@ -19,22 +19,17 @@ class ContentTypeList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] */ - public $contentTypes; + public array $contentTypes; /** * Path which was used to fetch the list of content types. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] $contentTypes - * @param string $path */ - public function __construct(array $contentTypes, $path) + public function __construct(array $contentTypes, string $path) { $this->contentTypes = $contentTypes; $this->path = $path; diff --git a/src/lib/Server/Values/CountryList.php b/src/lib/Server/Values/CountryList.php index 0274834f6..091880e2d 100644 --- a/src/lib/Server/Values/CountryList.php +++ b/src/lib/Server/Values/CountryList.php @@ -15,15 +15,18 @@ class CountryList extends RestValue { /** - * @var \Ibexa\Core\Repository\Values\ContentType\Countries[] + * @param array $countries */ - public $countries; + public function __construct( + private readonly array $countries + ) { + } /** - * Construct. + * @return array */ - public function __construct(array $countries) + public function getCountries(): array { - $this->countries = $countries; + return $this->countries; } } diff --git a/src/lib/Server/Values/CreatedContent.php b/src/lib/Server/Values/CreatedContent.php index b14104c2a..2b4a210f9 100644 --- a/src/lib/Server/Values/CreatedContent.php +++ b/src/lib/Server/Values/CreatedContent.php @@ -14,10 +14,5 @@ */ class CreatedContent extends ValueObject { - /** - * The created content. - * - * @var \Ibexa\Rest\Server\Values\RestContent - */ - public $content; + public RestContent $content; } diff --git a/src/lib/Server/Values/CreatedContentType.php b/src/lib/Server/Values/CreatedContentType.php index 6ca6c6e59..6a0d00c66 100644 --- a/src/lib/Server/Values/CreatedContentType.php +++ b/src/lib/Server/Values/CreatedContentType.php @@ -14,10 +14,5 @@ */ class CreatedContentType extends ValueObject { - /** - * The created content type. - * - * @var \Ibexa\Rest\Server\Values\RestContentType - */ - public $contentType; + public RestContentType $contentType; } diff --git a/src/lib/Server/Values/CreatedContentTypeGroup.php b/src/lib/Server/Values/CreatedContentTypeGroup.php index d92824ffb..5da3ac102 100644 --- a/src/lib/Server/Values/CreatedContentTypeGroup.php +++ b/src/lib/Server/Values/CreatedContentTypeGroup.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -14,10 +15,5 @@ */ class CreatedContentTypeGroup extends ValueObject { - /** - * The created content type group. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup - */ - public $contentTypeGroup; + public ContentTypeGroup $contentTypeGroup; } diff --git a/src/lib/Server/Values/CreatedFieldDefinition.php b/src/lib/Server/Values/CreatedFieldDefinition.php index 755c77818..95369272a 100644 --- a/src/lib/Server/Values/CreatedFieldDefinition.php +++ b/src/lib/Server/Values/CreatedFieldDefinition.php @@ -14,10 +14,5 @@ */ class CreatedFieldDefinition extends ValueObject { - /** - * The created field definition. - * - * @var \Ibexa\Rest\Server\Values\RestFieldDefinition - */ - public $fieldDefinition; + public RestFieldDefinition $fieldDefinition; } diff --git a/src/lib/Server/Values/CreatedLocation.php b/src/lib/Server/Values/CreatedLocation.php index a65091054..0c6eabae9 100644 --- a/src/lib/Server/Values/CreatedLocation.php +++ b/src/lib/Server/Values/CreatedLocation.php @@ -14,10 +14,5 @@ */ class CreatedLocation extends ValueObject { - /** - * The created location. - * - * @var \Ibexa\Rest\Server\Values\RestLocation - */ - public $restLocation; + public RestLocation $restLocation; } diff --git a/src/lib/Server/Values/CreatedObjectState.php b/src/lib/Server/Values/CreatedObjectState.php index 7d7742a3f..e1cbbed2a 100644 --- a/src/lib/Server/Values/CreatedObjectState.php +++ b/src/lib/Server/Values/CreatedObjectState.php @@ -8,16 +8,12 @@ namespace Ibexa\Rest\Server\Values; use Ibexa\Contracts\Core\Repository\Values\ValueObject; +use Ibexa\Rest\Values\RestObjectState; /** * Struct representing a freshly created object state. */ class CreatedObjectState extends ValueObject { - /** - * The created object state. - * - * @var \Ibexa\Rest\Values\RestObjectState - */ - public $objectState; + public RestObjectState $objectState; } diff --git a/src/lib/Server/Values/CreatedObjectStateGroup.php b/src/lib/Server/Values/CreatedObjectStateGroup.php index 824b2319b..3cd4bf751 100644 --- a/src/lib/Server/Values/CreatedObjectStateGroup.php +++ b/src/lib/Server/Values/CreatedObjectStateGroup.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -14,10 +15,5 @@ */ class CreatedObjectStateGroup extends ValueObject { - /** - * The created object state group. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup - */ - public $objectStateGroup; + public ObjectStateGroup $objectStateGroup; } diff --git a/src/lib/Server/Values/CreatedPolicy.php b/src/lib/Server/Values/CreatedPolicy.php index c5540348c..4a03e7299 100644 --- a/src/lib/Server/Values/CreatedPolicy.php +++ b/src/lib/Server/Values/CreatedPolicy.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\User\Policy; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -16,8 +17,6 @@ class CreatedPolicy extends ValueObject { /** * The created policy. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\Policy */ - public $policy; + public Policy $policy; } diff --git a/src/lib/Server/Values/CreatedRelation.php b/src/lib/Server/Values/CreatedRelation.php index 5898742f2..c7f2ea28a 100644 --- a/src/lib/Server/Values/CreatedRelation.php +++ b/src/lib/Server/Values/CreatedRelation.php @@ -14,10 +14,5 @@ */ class CreatedRelation extends ValueObject { - /** - * The created relation. - * - * @var \Ibexa\Rest\Server\Values\RestRelation - */ - public $relation; + public RestRelation $relation; } diff --git a/src/lib/Server/Values/CreatedRole.php b/src/lib/Server/Values/CreatedRole.php index 7c3b2e3c2..2a4d06f08 100644 --- a/src/lib/Server/Values/CreatedRole.php +++ b/src/lib/Server/Values/CreatedRole.php @@ -14,10 +14,5 @@ */ class CreatedRole extends ValueObject { - /** - * The created role. - * - * @var \Ibexa\Rest\Server\Values\RestRole - */ - public $role; + public RestRole $role; } diff --git a/src/lib/Server/Values/CreatedSection.php b/src/lib/Server/Values/CreatedSection.php index ba5cf06dc..91c1883c5 100644 --- a/src/lib/Server/Values/CreatedSection.php +++ b/src/lib/Server/Values/CreatedSection.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\Content\Section; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -14,10 +15,5 @@ */ class CreatedSection extends ValueObject { - /** - * The created section. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Section - */ - public $section; + public Section $section; } diff --git a/src/lib/Server/Values/CreatedURLAlias.php b/src/lib/Server/Values/CreatedURLAlias.php index 36ce426df..eb115d488 100644 --- a/src/lib/Server/Values/CreatedURLAlias.php +++ b/src/lib/Server/Values/CreatedURLAlias.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -14,10 +15,5 @@ */ class CreatedURLAlias extends ValueObject { - /** - * The created URL alias. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias - */ - public $urlAlias; + public URLAlias $urlAlias; } diff --git a/src/lib/Server/Values/CreatedURLWildcard.php b/src/lib/Server/Values/CreatedURLWildcard.php index bd0b41a71..3752c8246 100644 --- a/src/lib/Server/Values/CreatedURLWildcard.php +++ b/src/lib/Server/Values/CreatedURLWildcard.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -14,10 +15,5 @@ */ class CreatedURLWildcard extends ValueObject { - /** - * The created URL wildcard. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard - */ - public $urlWildcard; + public URLWildcard $urlWildcard; } diff --git a/src/lib/Server/Values/CreatedUser.php b/src/lib/Server/Values/CreatedUser.php index 506e64ff7..4838196cf 100644 --- a/src/lib/Server/Values/CreatedUser.php +++ b/src/lib/Server/Values/CreatedUser.php @@ -14,10 +14,5 @@ */ class CreatedUser extends ValueObject { - /** - * The created user. - * - * @var \Ibexa\Rest\Server\Values\RestUser - */ - public $user; + public RestUser $user; } diff --git a/src/lib/Server/Values/CreatedUserGroup.php b/src/lib/Server/Values/CreatedUserGroup.php index 74017b907..f535ae557 100644 --- a/src/lib/Server/Values/CreatedUserGroup.php +++ b/src/lib/Server/Values/CreatedUserGroup.php @@ -14,10 +14,5 @@ */ class CreatedUserGroup extends ValueObject { - /** - * The created user group. - * - * @var \Ibexa\Rest\Server\Values\RestUserGroup - */ - public $userGroup; + public RestUserGroup $userGroup; } diff --git a/src/lib/Server/Values/CreatedVersion.php b/src/lib/Server/Values/CreatedVersion.php index ef5b9c8fc..08a65411d 100644 --- a/src/lib/Server/Values/CreatedVersion.php +++ b/src/lib/Server/Values/CreatedVersion.php @@ -14,10 +14,5 @@ */ class CreatedVersion extends ValueObject { - /** - * The created version. - * - * @var \Ibexa\Rest\Server\Values\Version - */ - public $version; + public Version $version; } diff --git a/src/lib/Server/Values/FieldDefinitionList.php b/src/lib/Server/Values/FieldDefinitionList.php index f5ef4a7c9..b9ae012d3 100644 --- a/src/lib/Server/Values/FieldDefinitionList.php +++ b/src/lib/Server/Values/FieldDefinitionList.php @@ -17,22 +17,15 @@ class FieldDefinitionList extends RestValue { /** * ContentType the field definitions belong to. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - public $contentType; + public ContentType $contentType; /** - * Field definitions. - * * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] */ - public $fieldDefinitions; + public array $fieldDefinitions; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] $fieldDefinitions */ public function __construct(ContentType $contentType, array $fieldDefinitions) diff --git a/src/lib/Server/Values/LocationList.php b/src/lib/Server/Values/LocationList.php index 050a051b7..d91329fb2 100644 --- a/src/lib/Server/Values/LocationList.php +++ b/src/lib/Server/Values/LocationList.php @@ -19,22 +19,17 @@ class LocationList extends RestValue * * @var \Ibexa\Rest\Server\Values\RestLocation[] */ - public $locations; + public array $locations; /** * Path used to load this list of locations. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Rest\Server\Values\RestLocation[] $locations - * @param string $path */ - public function __construct(array $locations, $path) + public function __construct(array $locations, string $path) { $this->locations = $locations; $this->path = $path; diff --git a/src/lib/Server/Values/ObjectStateGroupList.php b/src/lib/Server/Values/ObjectStateGroupList.php index aa4fe5fbc..b4324d53a 100644 --- a/src/lib/Server/Values/ObjectStateGroupList.php +++ b/src/lib/Server/Values/ObjectStateGroupList.php @@ -19,11 +19,9 @@ class ObjectStateGroupList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[] */ - public $groups; + public array $groups; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[] $groups */ public function __construct(array $groups) diff --git a/src/lib/Server/Values/ObjectStateList.php b/src/lib/Server/Values/ObjectStateList.php index c0051c338..77fafe8a5 100644 --- a/src/lib/Server/Values/ObjectStateList.php +++ b/src/lib/Server/Values/ObjectStateList.php @@ -19,22 +19,17 @@ class ObjectStateList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[] */ - public $states; + public array $states; /** * ID of the group that the states belong to. - * - * @var mixed */ - public $groupId; + public int|string $groupId; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[] $states - * @param mixed $groupId */ - public function __construct(array $states, $groupId) + public function __construct(array $states, int|string $groupId) { $this->states = $states; $this->groupId = $groupId; diff --git a/src/lib/Server/Values/Options.php b/src/lib/Server/Values/Options.php index 5824fb612..8521e3a79 100644 --- a/src/lib/Server/Values/Options.php +++ b/src/lib/Server/Values/Options.php @@ -17,11 +17,14 @@ class Options extends ValueObject /** * The methods allowed my the resource. * - * @var array + * @var array */ - public $allowedMethods; + public array $allowedMethods; - public function __construct($allowedMethods) + /** + * @param array $allowedMethods + */ + public function __construct(array $allowedMethods) { $this->allowedMethods = $allowedMethods; } diff --git a/src/lib/Server/Values/PermanentRedirect.php b/src/lib/Server/Values/PermanentRedirect.php index d4dbc7a64..374027409 100644 --- a/src/lib/Server/Values/PermanentRedirect.php +++ b/src/lib/Server/Values/PermanentRedirect.php @@ -13,17 +13,10 @@ class PermanentRedirect extends RestValue { /** * Redirect URI. - * - * @var string */ - public $redirectUri; + public string $redirectUri; - /** - * Construct. - * - * @param string $redirectUri - */ - public function __construct($redirectUri) + public function __construct(string $redirectUri) { $this->redirectUri = $redirectUri; } diff --git a/src/lib/Server/Values/PolicyList.php b/src/lib/Server/Values/PolicyList.php index 88ecf281e..1acd6ab11 100644 --- a/src/lib/Server/Values/PolicyList.php +++ b/src/lib/Server/Values/PolicyList.php @@ -19,22 +19,19 @@ class PolicyList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\User\Policy[] */ - public $policies; + public array $policies; /** * Path which was used to fetch the list of policies. - * - * @var string */ - public $path; + public string $path; /** * Construct. * * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy[] $policies - * @param string $path */ - public function __construct(array $policies, $path) + public function __construct(array $policies, string $path) { $this->policies = $policies; $this->path = $path; diff --git a/src/lib/Server/Values/PublishedRole.php b/src/lib/Server/Values/PublishedRole.php index 2b48dc162..14f0dc60d 100644 --- a/src/lib/Server/Values/PublishedRole.php +++ b/src/lib/Server/Values/PublishedRole.php @@ -14,10 +14,5 @@ */ class PublishedRole extends ValueObject { - /** - * The published role. - * - * @var \Ibexa\Rest\Server\Values\RestRole - */ - public $role; + public RestRole $role; } diff --git a/src/lib/Server/Values/RelationList.php b/src/lib/Server/Values/RelationList.php index 2f0812bd7..3bcfa7713 100644 --- a/src/lib/Server/Values/RelationList.php +++ b/src/lib/Server/Values/RelationList.php @@ -15,42 +15,29 @@ class RelationList extends RestValue { /** - * Relations. - * * @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public $relations; + public array $relations; /** * Content ID to which this relation belongs to. - * - * @var mixed */ - public $contentId; + public int $contentId; /** * Version number to which this relation belongs to. - * - * @var mixed */ - public $versionNo; + public int $versionNo; /** * Path used to load the list of relations. - * - * @var string */ - public $path; + public ?string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] $relations - * @param mixed $contentId - * @param mixed $versionNo - * @param string $path */ - public function __construct(array $relations, $contentId, $versionNo, $path = null) + public function __construct(array $relations, int $contentId, int $versionNo, ?string $path = null) { $this->relations = $relations; $this->contentId = $contentId; diff --git a/src/lib/Server/Values/RestContent.php b/src/lib/Server/Values/RestContent.php index bd975c83d..e7fd0403d 100644 --- a/src/lib/Server/Values/RestContent.php +++ b/src/lib/Server/Values/RestContent.php @@ -20,55 +20,35 @@ */ class RestContent extends RestValue { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo - */ - public $contentInfo; + public ContentInfo $contentInfo; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location - */ - public $mainLocation; + public ?Location $mainLocation; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content - */ - public $currentVersion; + public ?Content $currentVersion; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ?ContentType $contentType; /** * @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public $relations; + public ?array $relations; /** * Path that was used to load this content. - * - * @var string */ - public $path; + public ?string $path; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $mainLocation - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content|null $currentVersion * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null $contentType Can only be null if $currentVersion is * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[]|null $relations Can only be null if $currentVersion is - * @param string $path */ public function __construct( ContentInfo $contentInfo, - Location $mainLocation = null, - Content $currentVersion = null, - ContentType $contentType = null, - array $relations = null, - $path = null + ?Location $mainLocation = null, + ?Content $currentVersion = null, + ?ContentType $contentType = null, + ?array $relations = null, + ?string $path = null ) { $this->contentInfo = $contentInfo; $this->mainLocation = $mainLocation; diff --git a/src/lib/Server/Values/RestContentType.php b/src/lib/Server/Values/RestContentType.php index c7cc0c7e5..66ed07f16 100644 --- a/src/lib/Server/Values/RestContentType.php +++ b/src/lib/Server/Values/RestContentType.php @@ -17,23 +17,17 @@ */ class RestContentType extends RestValue { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ContentType $contentType; /** * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] */ - public $fieldDefinitions; + public ?array $fieldDefinitions; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] $fieldDefinitions */ - public function __construct(ContentType $contentType, array $fieldDefinitions = null) + public function __construct(ContentType $contentType, ?array $fieldDefinitions = null) { $this->contentType = $contentType; $this->fieldDefinitions = $fieldDefinitions; diff --git a/src/lib/Server/Values/RestExecutedView.php b/src/lib/Server/Values/RestExecutedView.php index 2d39c0614..9b4bc181a 100644 --- a/src/lib/Server/Values/RestExecutedView.php +++ b/src/lib/Server/Values/RestExecutedView.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** @@ -16,15 +17,11 @@ class RestExecutedView extends ValueObject { /** * The search results. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult */ - public $searchResults; + public SearchResult $searchResults; /** * The view identifier. - * - * @var mixed */ - public $identifier; + public string|int $identifier; } diff --git a/src/lib/Server/Values/RestFieldDefinition.php b/src/lib/Server/Values/RestFieldDefinition.php index b33f67481..50380eddf 100644 --- a/src/lib/Server/Values/RestFieldDefinition.php +++ b/src/lib/Server/Values/RestFieldDefinition.php @@ -16,19 +16,9 @@ */ class RestFieldDefinition extends RestValue { - /** - * ContentType the field definitions belong to. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ContentType $contentType; - /** - * Field definition. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition - */ - public $fieldDefinition; + public FieldDefinition $fieldDefinition; /** * Path which is used to fetch the list of field definitions. diff --git a/src/lib/Server/Values/RestLocation.php b/src/lib/Server/Values/RestLocation.php index 2994760d7..22d9e9018 100644 --- a/src/lib/Server/Values/RestLocation.php +++ b/src/lib/Server/Values/RestLocation.php @@ -15,25 +15,14 @@ */ class RestLocation extends RestValue { - /** - * A location. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location - */ - public $location; + public Location $location; /** * Number of children of the location. - * - * @var int */ - public $childCount; + public int $childCount; - /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - * @param int $childCount - */ - public function __construct(Location $location, $childCount) + public function __construct(Location $location, int $childCount) { $this->location = $location; $this->childCount = $childCount; diff --git a/src/lib/Server/Values/RestLocationUpdateStruct.php b/src/lib/Server/Values/RestLocationUpdateStruct.php index 41606f539..e84e10720 100644 --- a/src/lib/Server/Values/RestLocationUpdateStruct.php +++ b/src/lib/Server/Values/RestLocationUpdateStruct.php @@ -15,27 +15,14 @@ */ class RestLocationUpdateStruct extends RestValue { - /** - * Location update struct. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationUpdateStruct - */ - public $locationUpdateStruct; + public LocationUpdateStruct $locationUpdateStruct; /** * If set, the location is hidden ( == true ) or unhidden ( == false ). - * - * @var bool */ - public $hidden; + public ?bool $hidden; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\LocationUpdateStruct $locationUpdateStruct - * @param bool $hidden - */ - public function __construct(LocationUpdateStruct $locationUpdateStruct, $hidden = null) + public function __construct(LocationUpdateStruct $locationUpdateStruct, ?bool $hidden = null) { $this->locationUpdateStruct = $locationUpdateStruct; $this->hidden = $hidden; diff --git a/src/lib/Server/Values/RestRelation.php b/src/lib/Server/Values/RestRelation.php index dd65b2759..5b837575a 100644 --- a/src/lib/Server/Values/RestRelation.php +++ b/src/lib/Server/Values/RestRelation.php @@ -15,33 +15,19 @@ */ class RestRelation extends RestValue { - /** - * A relation. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation - */ - public $relation; + public Relation $relation; /** * Content ID to which this relation belongs to. - * - * @var mixed */ - public $contentId; + public int $contentId; /** * Version number to which this relation belongs to. - * - * @var mixed */ - public $versionNo; + public int $versionNo; - /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation $relation - * @param mixed $contentId - * @param mixed $versionNo - */ - public function __construct(Relation $relation, $contentId, $versionNo) + public function __construct(Relation $relation, int $contentId, int $versionNo) { $this->relation = $relation; $this->contentId = $contentId; diff --git a/src/lib/Server/Values/RestRole.php b/src/lib/Server/Values/RestRole.php index cbf308c88..c2f8425a8 100644 --- a/src/lib/Server/Values/RestRole.php +++ b/src/lib/Server/Values/RestRole.php @@ -8,6 +8,7 @@ namespace Ibexa\Rest\Server\Values; use Ibexa\Contracts\Core\Repository\Values\User\Role; +use Ibexa\Contracts\Core\Repository\Values\User\RoleDraft; use Ibexa\Rest\Value as RestValue; /** @@ -18,49 +19,33 @@ class RestRole extends RestValue /** * Holds internal role object. */ - protected Role $innerRole; + public Role|RoleDraft $innerRole; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role - */ - public function __construct(Role $role) + public function __construct(Role|RoleDraft $role) { $this->innerRole = $role; } /** * Magic getter for routing get calls to innerRole. - * - * @param string $property The name of the property to retrieve - * - * @return mixed */ - public function __get($property) + public function __get(string $property): mixed { return $this->innerRole->$property; } /** * Magic set for routing set calls to innerRole. - * - * @param string $property - * @param mixed $propertyValue */ - public function __set($property, $propertyValue) + public function __set(string $property, mixed $propertyValue): void { $this->innerRole->$property = $propertyValue; } /** * Magic isset for routing isset calls to innerRole. - * - * @param string $property - * - * @return bool */ - public function __isset($property) + public function __isset(string $property): bool { return $this->innerRole->__isset($property); } diff --git a/src/lib/Server/Values/RestTrashItem.php b/src/lib/Server/Values/RestTrashItem.php index bce2c8c2a..db6783323 100644 --- a/src/lib/Server/Values/RestTrashItem.php +++ b/src/lib/Server/Values/RestTrashItem.php @@ -15,25 +15,14 @@ */ class RestTrashItem extends RestValue { - /** - * A trash item. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem - */ - public $trashItem; + public TrashItem $trashItem; /** * Number of children of the trash item. - * - * @var int */ - public $childCount; + public int $childCount; - /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem $trashItem - * @param int $childCount - */ - public function __construct(TrashItem $trashItem, $childCount) + public function __construct(TrashItem $trashItem, int $childCount) { $this->trashItem = $trashItem; $this->childCount = $childCount; diff --git a/src/lib/Server/Values/RestUser.php b/src/lib/Server/Values/RestUser.php index 5187609b7..fe7c9fa78 100644 --- a/src/lib/Server/Values/RestUser.php +++ b/src/lib/Server/Values/RestUser.php @@ -18,37 +18,20 @@ */ class RestUser extends RestValue { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content - */ - public $content; + public Content $content; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ContentType $contentType; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo - */ - public $contentInfo; + public ContentInfo $contentInfo; /** * @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public $relations; + public array $relations; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location - */ - public $mainLocation; + public Location $mainLocation; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $mainLocation * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] $relations */ public function __construct(Content $content, ContentType $contentType, ContentInfo $contentInfo, Location $mainLocation, array $relations) diff --git a/src/lib/Server/Values/RestUserGroup.php b/src/lib/Server/Values/RestUserGroup.php index fbe3edf17..b461d8b2b 100644 --- a/src/lib/Server/Values/RestUserGroup.php +++ b/src/lib/Server/Values/RestUserGroup.php @@ -18,38 +18,20 @@ */ class RestUserGroup extends RestValue { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content - */ - public $content; + public Content $content; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ContentType $contentType; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo - */ - public $contentInfo; + public ContentInfo $contentInfo; /** * @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public $relations; + public array $relations; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location - */ - public $mainLocation; + public Location $mainLocation; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $mainLocation * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] $relations */ public function __construct( diff --git a/src/lib/Server/Values/RestUserGroupRoleAssignment.php b/src/lib/Server/Values/RestUserGroupRoleAssignment.php index 7d085f07d..6ffac0f88 100644 --- a/src/lib/Server/Values/RestUserGroupRoleAssignment.php +++ b/src/lib/Server/Values/RestUserGroupRoleAssignment.php @@ -15,27 +15,14 @@ */ class RestUserGroupRoleAssignment extends RestValue { - /** - * Role assignment. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroupRoleAssignment - */ - public $roleAssignment; + public UserGroupRoleAssignment $roleAssignment; /** - * User group ID to which the role is assigned. - * - * @var mixed + * User group path to which the role is assigned. */ - public $id; + public string|int $id; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroupRoleAssignment $roleAssignment - * @param mixed $id - */ - public function __construct(UserGroupRoleAssignment $roleAssignment, $id) + public function __construct(UserGroupRoleAssignment $roleAssignment, string|int $id) { $this->roleAssignment = $roleAssignment; $this->id = $id; diff --git a/src/lib/Server/Values/RestUserGroupUpdateStruct.php b/src/lib/Server/Values/RestUserGroupUpdateStruct.php index 935eca645..06d2413b8 100644 --- a/src/lib/Server/Values/RestUserGroupUpdateStruct.php +++ b/src/lib/Server/Values/RestUserGroupUpdateStruct.php @@ -15,27 +15,14 @@ */ class RestUserGroupUpdateStruct extends RestValue { - /** - * UserGroup update struct. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroupUpdateStruct - */ - public $userGroupUpdateStruct; + public UserGroupUpdateStruct $userGroupUpdateStruct; /** - * If set, section of the UserGroup will be updated. - * - * @var mixed + * If set, a section of a UserGroup will be updated. */ - public $sectionId; + public ?int $sectionId; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroupUpdateStruct $userGroupUpdateStruct - * @param mixed $sectionId - */ - public function __construct(UserGroupUpdateStruct $userGroupUpdateStruct, $sectionId = null) + public function __construct(UserGroupUpdateStruct $userGroupUpdateStruct, ?int $sectionId = null) { $this->userGroupUpdateStruct = $userGroupUpdateStruct; $this->sectionId = $sectionId; diff --git a/src/lib/Server/Values/RestUserRoleAssignment.php b/src/lib/Server/Values/RestUserRoleAssignment.php index c1417c72f..9887c6c9a 100644 --- a/src/lib/Server/Values/RestUserRoleAssignment.php +++ b/src/lib/Server/Values/RestUserRoleAssignment.php @@ -15,27 +15,14 @@ */ class RestUserRoleAssignment extends RestValue { - /** - * Role assignment. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\UserRoleAssignment - */ - public $roleAssignment; + public UserRoleAssignment $roleAssignment; /** * User ID to which the role is assigned. - * - * @var mixed */ - public $id; + public int|string $id; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserRoleAssignment $roleAssignment - * @param mixed $id - */ - public function __construct(UserRoleAssignment $roleAssignment, $id) + public function __construct(UserRoleAssignment $roleAssignment, int|string $id) { $this->roleAssignment = $roleAssignment; $this->id = $id; diff --git a/src/lib/Server/Values/RestUserUpdateStruct.php b/src/lib/Server/Values/RestUserUpdateStruct.php index 0f656af16..95be79545 100644 --- a/src/lib/Server/Values/RestUserUpdateStruct.php +++ b/src/lib/Server/Values/RestUserUpdateStruct.php @@ -15,27 +15,14 @@ */ class RestUserUpdateStruct extends RestValue { - /** - * User update struct. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\UserUpdateStruct - */ - public $userUpdateStruct; + public UserUpdateStruct $userUpdateStruct; /** * If set, section of the User will be updated. - * - * @var mixed */ - public $sectionId; + public ?int $sectionId; - /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserUpdateStruct $userUpdateStruct - * @param mixed $sectionId - */ - public function __construct(UserUpdateStruct $userUpdateStruct, $sectionId = null) + public function __construct(UserUpdateStruct $userUpdateStruct, ?int $sectionId = null) { $this->userUpdateStruct = $userUpdateStruct; $this->sectionId = $sectionId; diff --git a/src/lib/Server/Values/RestViewInput.php b/src/lib/Server/Values/RestViewInput.php index 6a367c4a2..6477bbb9e 100644 --- a/src/lib/Server/Values/RestViewInput.php +++ b/src/lib/Server/Values/RestViewInput.php @@ -7,6 +7,7 @@ namespace Ibexa\Rest\Server\Values; +use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Rest\Value as RestValue; /** @@ -14,27 +15,11 @@ */ class RestViewInput extends RestValue { - /** - * The search query. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query - */ - public $query; + public Query $query; - /** - * View identifier. - * - * @var string - */ - public $identifier; + public string $identifier; - /** - * @var string|null - */ - public $languageCode; + public ?string $languageCode; - /** - * @var bool|null - */ - public $useAlwaysAvailable; + public ?bool $useAlwaysAvailable; } diff --git a/src/lib/Server/Values/RoleAssignment.php b/src/lib/Server/Values/RoleAssignment.php index 9ba989e20..adb5d8b08 100644 --- a/src/lib/Server/Values/RoleAssignment.php +++ b/src/lib/Server/Values/RoleAssignment.php @@ -15,27 +15,11 @@ */ class RoleAssignment extends RestValue { - /** - * Role ID. - * - * @var mixed - */ - public $roleId; + public int $roleId; - /** - * Role limitation. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation - */ - public $limitation; + public ?RoleLimitation $limitation; - /** - * Construct. - * - * @param mixed $roleId - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation $limitation - */ - public function __construct($roleId, RoleLimitation $limitation = null) + public function __construct(int $roleId, RoleLimitation $limitation = null) { $this->roleId = $roleId; $this->limitation = $limitation; diff --git a/src/lib/Server/Values/RoleAssignmentList.php b/src/lib/Server/Values/RoleAssignmentList.php index 640f7b76a..9ca14c32a 100644 --- a/src/lib/Server/Values/RoleAssignmentList.php +++ b/src/lib/Server/Values/RoleAssignmentList.php @@ -19,30 +19,22 @@ class RoleAssignmentList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment[] */ - public $roleAssignments; + public array $roleAssignments; /** * User or user group ID to which the roles are assigned. - * - * @var mixed */ - public $id; + public int|string $id; /** * Indicator if the role assignment is for user group. - * - * @var bool */ - public $isGroupAssignment; + public bool $isGroupAssignment; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment[] $roleAssignments - * @param mixed $id - * @param bool $isGroupAssignment */ - public function __construct(array $roleAssignments, $id, $isGroupAssignment = false) + public function __construct(array $roleAssignments, string|int $id, bool $isGroupAssignment = false) { $this->roleAssignments = $roleAssignments; $this->id = $id; diff --git a/src/lib/Server/Values/RoleList.php b/src/lib/Server/Values/RoleList.php index 5ec7b48f9..61a213a3c 100644 --- a/src/lib/Server/Values/RoleList.php +++ b/src/lib/Server/Values/RoleList.php @@ -15,26 +15,19 @@ class RoleList extends RestValue { /** - * Roles. - * * @var \Ibexa\Contracts\Core\Repository\Values\User\Role[] */ - public $roles; + public array $roles; /** * Path used to load the list of roles. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\User\Role[] $roles - * @param string $path */ - public function __construct(array $roles, $path) + public function __construct(array $roles, string $path) { $this->roles = $roles; $this->path = $path; diff --git a/src/lib/Server/Values/SectionList.php b/src/lib/Server/Values/SectionList.php index 0f7dbdc42..7a9728683 100644 --- a/src/lib/Server/Values/SectionList.php +++ b/src/lib/Server/Values/SectionList.php @@ -19,22 +19,19 @@ class SectionList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\Content\Section[] */ - public $sections; + public array $sections; /** * Path used to load the list of sections. - * - * @var string */ - public $path; + public string $path; /** * Construct. * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section[] $sections - * @param string $path */ - public function __construct(array $sections, $path) + public function __construct(array $sections, string $path) { $this->sections = $sections; $this->path = $path; diff --git a/src/lib/Server/Values/SeeOther.php b/src/lib/Server/Values/SeeOther.php index c37c89aa8..6cc51be3f 100644 --- a/src/lib/Server/Values/SeeOther.php +++ b/src/lib/Server/Values/SeeOther.php @@ -11,8 +11,15 @@ class SeeOther extends RestValue { - public function __construct($redirectUri) + private string $redirectUri; + + public function __construct(string $redirectUri) { $this->redirectUri = $redirectUri; } + + public function getRedirectUri(): string + { + return $this->redirectUri; + } } diff --git a/src/lib/Server/Values/TemporaryRedirect.php b/src/lib/Server/Values/TemporaryRedirect.php index 8ab91d935..84307ff8f 100644 --- a/src/lib/Server/Values/TemporaryRedirect.php +++ b/src/lib/Server/Values/TemporaryRedirect.php @@ -11,19 +11,9 @@ class TemporaryRedirect extends RestValue { - /** - * Redirect URI. - * - * @var string - */ - public $redirectUri; + public string $redirectUri; - /** - * Construct. - * - * @param string $redirectUri - */ - public function __construct($redirectUri) + public function __construct(string $redirectUri) { $this->redirectUri = $redirectUri; } diff --git a/src/lib/Server/Values/Trash.php b/src/lib/Server/Values/Trash.php index bdbcfa3b8..fc67938ec 100644 --- a/src/lib/Server/Values/Trash.php +++ b/src/lib/Server/Values/Trash.php @@ -19,22 +19,17 @@ class Trash extends RestValue * * @var \Ibexa\Rest\Server\Values\RestTrashItem[] */ - public $trashItems; + public array $trashItems; /** * Path used to load the list of the trash items. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Rest\Server\Values\RestTrashItem[] $trashItems - * @param string $path */ - public function __construct(array $trashItems, $path) + public function __construct(array $trashItems, string $path) { $this->trashItems = $trashItems; $this->path = $path; diff --git a/src/lib/Server/Values/URLAliasList.php b/src/lib/Server/Values/URLAliasList.php index 646fd6abf..8b45d5b85 100644 --- a/src/lib/Server/Values/URLAliasList.php +++ b/src/lib/Server/Values/URLAliasList.php @@ -19,22 +19,17 @@ class URLAliasList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias[] */ - public $urlAliases; + public array $urlAliases; /** * Path used to load the list of URL aliases. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias[] $urlAliases - * @param string $path */ - public function __construct(array $urlAliases, $path) + public function __construct(array $urlAliases, string $path) { $this->urlAliases = $urlAliases; $this->path = $path; diff --git a/src/lib/Server/Values/URLAliasRefList.php b/src/lib/Server/Values/URLAliasRefList.php index 3953726aa..397eaf036 100644 --- a/src/lib/Server/Values/URLAliasRefList.php +++ b/src/lib/Server/Values/URLAliasRefList.php @@ -19,22 +19,17 @@ class URLAliasRefList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias[] */ - public $urlAliases; + public array $urlAliases; /** * Path that was used to fetch the list of URL aliases. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias[] $urlAliases - * @param string $path */ - public function __construct(array $urlAliases, $path) + public function __construct(array $urlAliases, string $path) { $this->urlAliases = $urlAliases; $this->path = $path; diff --git a/src/lib/Server/Values/URLWildcardList.php b/src/lib/Server/Values/URLWildcardList.php index 389fda2a0..8fc00e27f 100644 --- a/src/lib/Server/Values/URLWildcardList.php +++ b/src/lib/Server/Values/URLWildcardList.php @@ -19,11 +19,9 @@ class URLWildcardList extends RestValue * * @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard[] */ - public $urlWildcards; + public array $urlWildcards; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard[] $urlWildcards */ public function __construct(array $urlWildcards) diff --git a/src/lib/Server/Values/UserGroupList.php b/src/lib/Server/Values/UserGroupList.php index 2c05b4d89..d4514edfe 100644 --- a/src/lib/Server/Values/UserGroupList.php +++ b/src/lib/Server/Values/UserGroupList.php @@ -19,22 +19,17 @@ class UserGroupList extends RestValue * * @var \Ibexa\Rest\Server\Values\RestUserGroup[] */ - public $userGroups; + public array $userGroups; /** * Path which was used to fetch the list of user groups. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Rest\Server\Values\RestUserGroup[] $userGroups - * @param string $path */ - public function __construct(array $userGroups, $path) + public function __construct(array $userGroups, string $path) { $this->userGroups = $userGroups; $this->path = $path; diff --git a/src/lib/Server/Values/UserGroupRefList.php b/src/lib/Server/Values/UserGroupRefList.php index a35aa254d..f89d4ecd4 100644 --- a/src/lib/Server/Values/UserGroupRefList.php +++ b/src/lib/Server/Values/UserGroupRefList.php @@ -19,30 +19,22 @@ class UserGroupRefList extends RestValue * * @var \Ibexa\Rest\Server\Values\RestUserGroup[] */ - public $userGroups; + public array $userGroups; /** * Path which was used to fetch the list of user groups. - * - * @var string */ - public $path; + public string $path; /** * User ID whose groups are the ones in the list. - * - * @var mixed */ - public $userId; + public int|string|null $userId; /** - * Construct. - * * @param \Ibexa\Rest\Server\Values\RestUserGroup[] $userGroups - * @param string $path - * @param mixed $userId */ - public function __construct(array $userGroups, $path, $userId = null) + public function __construct(array $userGroups, string $path, int|string|null $userId = null) { $this->userGroups = $userGroups; $this->path = $path; diff --git a/src/lib/Server/Values/UserList.php b/src/lib/Server/Values/UserList.php index c316e6df0..bc2599cb7 100644 --- a/src/lib/Server/Values/UserList.php +++ b/src/lib/Server/Values/UserList.php @@ -15,26 +15,19 @@ class UserList extends RestValue { /** - * Users. - * * @var \Ibexa\Rest\Server\Values\RestUser[] */ - public $users; + public array $users; /** * Path which was used to fetch the list of users. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Rest\Server\Values\RestUser[] $users - * @param string $path */ - public function __construct(array $users, $path) + public function __construct(array $users, string $path) { $this->users = $users; $this->path = $path; diff --git a/src/lib/Server/Values/UserRefList.php b/src/lib/Server/Values/UserRefList.php index 46b35e5e1..b7e11364f 100644 --- a/src/lib/Server/Values/UserRefList.php +++ b/src/lib/Server/Values/UserRefList.php @@ -15,26 +15,19 @@ class UserRefList extends RestValue { /** - * Users. - * * @var \Ibexa\Rest\Server\Values\RestUser[] */ - public $users; + public array $users; /** * Path which was used to fetch the list of users. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Rest\Server\Values\RestUser[] $users - * @param string $path */ - public function __construct(array $users, $path) + public function __construct(array $users, string $path) { $this->users = $users; $this->path = $path; diff --git a/src/lib/Server/Values/Version.php b/src/lib/Server/Values/Version.php index f6e020237..8077e095c 100644 --- a/src/lib/Server/Values/Version.php +++ b/src/lib/Server/Values/Version.php @@ -16,37 +16,24 @@ */ class Version extends RestValue { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content - */ - public $content; + public Content $content; - /** - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType - */ - public $contentType; + public ContentType $contentType; /** * @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public $relations; + public array $relations; /** * Path used to load this content. - * - * @var string */ - public $path; + public ?string $path; /** - * Construct. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] $relations - * @param string $path */ - public function __construct(Content $content, ContentType $contentType, array $relations, $path = null) + public function __construct(Content $content, ContentType $contentType, array $relations, ?string $path = null) { $this->content = $content; $this->contentType = $contentType; diff --git a/src/lib/Server/Values/VersionList.php b/src/lib/Server/Values/VersionList.php index cd1dd6583..1b31262a7 100644 --- a/src/lib/Server/Values/VersionList.php +++ b/src/lib/Server/Values/VersionList.php @@ -15,26 +15,19 @@ class VersionList extends RestValue { /** - * Versions. - * * @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] */ - public $versions; + public array $versions; /** * Path used to retrieve this version list. - * - * @var string */ - public $path; + public string $path; /** - * Construct. - * * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] $versions - * @param string $path */ - public function __construct(array $versions, $path) + public function __construct(array $versions, string $path) { $this->versions = $versions; $this->path = $path; diff --git a/src/lib/Server/Values/VersionTranslationInfo.php b/src/lib/Server/Values/VersionTranslationInfo.php index 19adf2295..855b56c23 100644 --- a/src/lib/Server/Values/VersionTranslationInfo.php +++ b/src/lib/Server/Values/VersionTranslationInfo.php @@ -17,18 +17,12 @@ class VersionTranslationInfo extends RestValue { private VersionInfo $versionInfo; - /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo - */ public function __construct(VersionInfo $versionInfo) { $this->versionInfo = $versionInfo; } - /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo - */ - public function getVersionInfo() + public function getVersionInfo(): VersionInfo { return $this->versionInfo; } diff --git a/src/lib/Server/View/AcceptHeaderVisitorDispatcher.php b/src/lib/Server/View/AcceptHeaderVisitorDispatcher.php index b3a6d95a8..afc98a2d2 100644 --- a/src/lib/Server/View/AcceptHeaderVisitorDispatcher.php +++ b/src/lib/Server/View/AcceptHeaderVisitorDispatcher.php @@ -20,18 +20,13 @@ class AcceptHeaderVisitorDispatcher /** * Mapping of regular expressions matching the mime type accept headers to * view handlers. - * - * @var array */ - protected $mapping = []; + protected array $mapping = []; /** * Adds view handler. - * - * @param string $regexp - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor */ - public function addVisitor($regexp, OutputVisitor $visitor): void + public function addVisitor(string $regexp, OutputVisitor $visitor): void { $this->mapping[$regexp] = $visitor; } @@ -39,14 +34,9 @@ public function addVisitor($regexp, OutputVisitor $visitor): void /** * Dispatches a visitable result to the mapped visitor. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param mixed $result - * * @throws \RuntimeException - * - * @return \Symfony\Component\HttpFoundation\Response */ - public function dispatch(Request $request, $result): Response + public function dispatch(Request $request, mixed $result): Response { foreach ($request->getAcceptableContentTypes() as $mimeType) { /** @var \Ibexa\Contracts\Rest\Output\Visitor $visitor */ diff --git a/src/lib/Values/ContentObjectStates.php b/src/lib/Values/ContentObjectStates.php index 8de705d03..e177eebcf 100644 --- a/src/lib/Values/ContentObjectStates.php +++ b/src/lib/Values/ContentObjectStates.php @@ -9,23 +9,10 @@ use Ibexa\Rest\Value as RestValue; -/** - * ContentObjectStates view model. - */ class ContentObjectStates extends RestValue { - /** - * Object states. - * - * @var array - */ - public $states; + public array $states; - /** - * Construct. - * - * @param array $states - */ public function __construct(array $states) { $this->states = $states; diff --git a/src/lib/Values/Resource.php b/src/lib/Values/Resource.php index 6799ad90f..ec2bf8b4d 100644 --- a/src/lib/Values/Resource.php +++ b/src/lib/Values/Resource.php @@ -14,35 +14,13 @@ */ class Resource extends RestValue { - /** - * Resource name. - * - * @var string - */ - public $name; + public string $name; - /** - * Media Type of the resource. - * - * @var string - */ - public $mediaType; + public string $mediaType; - /** - * href of the resource. - * - * @var string - */ - public $href; + public string $href; - /** - * Resource constructor. - * - * @param $name - * @param $mediaType - * @param $href - */ - public function __construct($name, $mediaType, $href) + public function __construct(string $name, string $mediaType, string $href) { $this->name = $name; $this->mediaType = $mediaType; diff --git a/src/lib/Values/RestContentMetadataUpdateStruct.php b/src/lib/Values/RestContentMetadataUpdateStruct.php index 83114529e..26ce937e3 100644 --- a/src/lib/Values/RestContentMetadataUpdateStruct.php +++ b/src/lib/Values/RestContentMetadataUpdateStruct.php @@ -18,8 +18,6 @@ class RestContentMetadataUpdateStruct extends ContentMetadataUpdateStruct * ID of the section to assign. * * Leave null to not change section assignment. - * - * @var mixed */ - public $sectionId; + public ?int $sectionId = null; } diff --git a/src/lib/Values/RestObjectState.php b/src/lib/Values/RestObjectState.php index d44720fd7..5e7f1bc95 100644 --- a/src/lib/Values/RestObjectState.php +++ b/src/lib/Values/RestObjectState.php @@ -17,25 +17,15 @@ class RestObjectState extends RestValue { /** * Wrapped object state. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - public $objectState; + public ObjectState $objectState; /** * Group ID to which wrapped state belongs. - * - * @var mixed */ - public $groupId; + public string|int $groupId; - /** - * Constructor. - * - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState - * @param mixed $groupId - */ - public function __construct(ObjectState $objectState, $groupId) + public function __construct(ObjectState $objectState, string|int $groupId) { $this->objectState = $objectState; $this->groupId = $groupId; diff --git a/src/lib/Values/Root.php b/src/lib/Values/Root.php index 677361115..42897f6c3 100644 --- a/src/lib/Values/Root.php +++ b/src/lib/Values/Root.php @@ -27,7 +27,7 @@ public function __construct(array $resources = []) /** * @return resource[] */ - public function getResources() + public function getResources(): array { return $this->resources; } diff --git a/tests/bundle/CorsOptions/RestProviderTest.php b/tests/bundle/CorsOptions/RestProviderTest.php index fc81cf2bf..de29f8761 100644 --- a/tests/bundle/CorsOptions/RestProviderTest.php +++ b/tests/bundle/CorsOptions/RestProviderTest.php @@ -22,7 +22,7 @@ class RestProviderTest extends TestCase * Return value expectation for RequestMatcher::matchRequest * Set to false to expect Router::match() never to be called, or to an exception to have it throw one. */ - protected $matchRequestResult = []; + protected mixed $matchRequestResult; public function testGetOptions(): void { @@ -87,11 +87,9 @@ public function testGetOptionsNotRestRequest(): void } /** - * @param bool $isRestRequest wether or not to set the is_rest_request attribute - * - * @return \Symfony\Component\HttpFoundation\Request + * @param bool $isRestRequest whether to set the is_rest_request attribute */ - protected function createRequest($isRestRequest = true): Request + protected function createRequest(bool $isRestRequest = true): Request { $request = new Request(); if ($isRestRequest) { @@ -108,10 +106,7 @@ protected function getProvider(): RestProvider ); } - /** - * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Routing\Matcher\RequestMatcherInterface - */ - protected function getRequestMatcherMock(): MockObject + protected function getRequestMatcherMock(): RequestMatcherInterface&MockObject { $mock = $this->createMock(RequestMatcherInterface::class); diff --git a/tests/bundle/EventListener/ResponseListenerTest.php b/tests/bundle/EventListener/ResponseListenerTest.php index eabad7978..127b1ca13 100644 --- a/tests/bundle/EventListener/ResponseListenerTest.php +++ b/tests/bundle/EventListener/ResponseListenerTest.php @@ -11,6 +11,7 @@ use Exception; use Ibexa\Bundle\Rest\EventListener\ResponseListener; use Ibexa\Rest\Server\View\AcceptHeaderVisitorDispatcher; +use PHPUnit\Framework\MockObject\MockObject; use stdClass; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; @@ -25,8 +26,7 @@ final class ResponseListenerTest extends EventListenerTest { - /** @var \Ibexa\Rest\Server\View\AcceptHeaderVisitorDispatcher&\PHPUnit\Framework\MockObject\MockObject */ - protected AcceptHeaderVisitorDispatcher $visitorDispatcherMock; + protected AcceptHeaderVisitorDispatcher&MockObject $visitorDispatcherMock; protected stdClass $eventValue; @@ -36,8 +36,7 @@ final class ResponseListenerTest extends EventListenerTest protected EventDispatcherInterface $event; - /** @var \Symfony\Component\HttpKernel\KernelInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected KernelInterface $kernelMock; + protected KernelInterface&MockObject $kernelMock; public function setUp(): void { @@ -123,10 +122,7 @@ protected function onKernelView( self::assertEquals($this->response, $event->getResponse()); } - /** - * @return \Ibexa\Rest\Server\View\AcceptHeaderVisitorDispatcher&\PHPUnit\Framework\MockObject\MockObject - */ - private function getVisitorDispatcherMock(): AcceptHeaderVisitorDispatcher + private function getVisitorDispatcherMock(): AcceptHeaderVisitorDispatcher&MockObject { if (!isset($this->visitorDispatcherMock)) { $this->visitorDispatcherMock = $this->createMock(AcceptHeaderVisitorDispatcher::class); @@ -152,10 +148,7 @@ protected function getViewEvent(): ViewEvent ); } - /** - * @return \PHPUnit\Framework\MockObject\MockObject&\Symfony\Component\HttpKernel\KernelInterface - */ - protected function getKernelMock(): KernelInterface + protected function getKernelMock(): KernelInterface&MockObject { return $this->createMock(KernelInterface::class); } @@ -170,10 +163,7 @@ private function getExceptionEvent(): ExceptionEvent ); } - /** - * @return \Symfony\Component\HttpFoundation\Request&\PHPUnit\Framework\MockObject\MockObject - */ - private function getRequestMock(): Request + private function getRequestMock(): Request&MockObject { $request = $this->createMock(Request::class); $request->attributes = $this->getRequestAttributesMock(); diff --git a/tests/bundle/Functional/ContentTest.php b/tests/bundle/Functional/ContentTest.php index 3a503a91c..0effc5ebe 100644 --- a/tests/bundle/Functional/ContentTest.php +++ b/tests/bundle/Functional/ContentTest.php @@ -136,12 +136,8 @@ public function testUpdateContentMetadata(string $restContentHref): void /** * @depends testPublishContent - * - * @param string $restContentHref - * - * @return string ContentVersion REST ID */ - public function testCreateDraftFromVersion(string $restContentHref) + public function testCreateDraftFromVersion(string $restContentHref): string { $response = $this->sendHttpRequest( $this->createHttpRequest('COPY', "{$restContentHref}/versions/1") @@ -159,8 +155,6 @@ public function testCreateDraftFromVersion(string $restContentHref) * * @covers \Ibexa\Rest\Server\Controller\Content::redirectCurrentVersion * - * @param string $restContentHref - * * @throws \Psr\Http\Client\ClientException */ public function testRedirectCurrentVersion(string $restContentHref): void @@ -177,8 +171,6 @@ public function testRedirectCurrentVersion(string $restContentHref): void /** * @depends testCreateDraftFromVersion * Covers GET /content/objects//versions/ - * - * @param string $restContentVersionHref */ public function testLoadContentVersion(string $restContentVersionHref): void { @@ -198,7 +190,7 @@ public function testLoadContentVersion(string $restContentVersionHref): void * * @return string the copied content href */ - public function testCopyContent($restContentHref) + public function testCopyContent(string $restContentHref): string { $testContent = $this->loadContent($restContentHref); @@ -450,8 +442,6 @@ private function loadContent(string $restContentHref) * Covers DELETE /content/objects//versions//translations/. * * @depends testCreateDraftFromVersion - * - * @param string $restContentVersionHref */ public function testDeleteTranslationFromDraft(string $restContentVersionHref): void { @@ -483,10 +473,8 @@ public function testDeleteTranslationFromDraft(string $restContentVersionHref): * Covers GET /content/objects//versions * * @depends testCreateDraftFromVersion - * - * @param string $restContentVersionHref */ - public function testLoadContentVersionsProvidesDeleteTranslationFromDraftResourceLink($restContentVersionHref): void + public function testLoadContentVersionsProvidesDeleteTranslationFromDraftResourceLink(string $restContentVersionHref): void { $translationToDelete = 'pol-PL'; // create Version Draft containing pol-PL Translation @@ -621,10 +609,8 @@ public function testDeleteTranslation() * Covers DELETE /content/objects//translations/. * * @depends testDeleteTranslation - * - * @param string $restContentHref */ - public function testDeleteTranslationOfContentWithSingleTranslationVersion($restContentHref): void + public function testDeleteTranslationOfContentWithSingleTranslationVersion(string $restContentHref): void { // create draft independent from other tests $restContentVersionHref = $this->createDraftFromVersion("$restContentHref/versions/1"); @@ -688,12 +674,9 @@ private function createVersionTranslation(string $restContentVersionHref, string * Iterate through Version Items returned by REST view for ContentType: VersionList+json * and return first VersionInfo data matching given status. * - * @param array $versionList * @param string $status uppercase string representation of Version status - * - * @return array */ - private function getVersionInfoFromJSONVersionListByStatus(array $versionList, string $status) + private function getVersionInfoFromJSONVersionListByStatus(array $versionList, string $status): array { foreach ($versionList['VersionItem'] as $versionItem) { if ($versionItem['VersionInfo']['status'] === $status) { @@ -706,8 +689,6 @@ private function getVersionInfoFromJSONVersionListByStatus(array $versionList, s /** * Assert that Version REST Response contains proper fields. - * - * @param \Psr\Http\Message\ResponseInterface $response */ private function assertVersionResponseContainsExpectedFields(ResponseInterface $response): void { diff --git a/tests/bundle/Functional/ContentTypeTest.php b/tests/bundle/Functional/ContentTypeTest.php index e0d815187..b5f1f7844 100644 --- a/tests/bundle/Functional/ContentTypeTest.php +++ b/tests/bundle/Functional/ContentTypeTest.php @@ -177,8 +177,6 @@ public function testLoadContentTypeGroupListWithIdentifier(): void /** * @depends testUpdateContentTypeGroup * Covers GET /content/typegroups/ - * - * @param string $contentTypeGroupHref */ public function testLoadContentTypeGroup(string $contentTypeGroupHref): void { @@ -435,8 +433,6 @@ public function testContentTypeLoadFieldDefinitionList($contentTypeHref) * @depends testAddContentTypeDraftFieldDefinition * Covers GET /content/types//fieldDefinitions/ * - * @param string $fieldDefinitionHref - * * @throws \Psr\Http\Client\ClientException */ public function testLoadContentTypeFieldDefinition(string $fieldDefinitionHref): void @@ -506,8 +502,6 @@ public function testUpdateContentTypeDraftFieldDefinition(string $fieldDefinitio * Covers DELETE /content/types//draft/fieldDefinitions/. * * @depends testAddContentTypeDraftFieldDefinition - * - * @param string $fieldDefinitionHref */ public function deleteContentTypeDraftFieldDefinition(string $fieldDefinitionHref): void { @@ -536,7 +530,7 @@ public function testDeleteContentTypeDraft(string $contentTypeDraftHref): void * @depends testCreateContentType * Covers PUBLISH /content/types//draft */ - public function testPublishContentTypeDraft($contentTypeHref): void + public function testPublishContentTypeDraft(string $contentTypeHref): void { // we need to create a content type draft first since we deleted the previous one in testDeleteContentTypeDraft $contentTypeDraftHref = $this->testCreateContentTypeDraft($contentTypeHref); diff --git a/tests/bundle/Functional/LanguageTest.php b/tests/bundle/Functional/LanguageTest.php index f56f1e33b..fe07e1c44 100644 --- a/tests/bundle/Functional/LanguageTest.php +++ b/tests/bundle/Functional/LanguageTest.php @@ -14,7 +14,7 @@ final class LanguageTest extends RESTFunctionalTestCase { use ResourceAssertionsTrait; - private const SNAPSHOT_DIR = __DIR__ . '/_snapshot'; + private const string SNAPSHOT_DIR = __DIR__ . '/_snapshot'; public function testLanguageListJson(): void { diff --git a/tests/bundle/Functional/RoleTest.php b/tests/bundle/Functional/RoleTest.php index 9e271c6ca..f0ed005f3 100644 --- a/tests/bundle/Functional/RoleTest.php +++ b/tests/bundle/Functional/RoleTest.php @@ -191,7 +191,7 @@ public function testUpdateRoleDraft(string $roleDraftHref): void * * @return string The created policy href */ - public function testAddPolicy($roleHref) + public function testAddPolicy(string $roleHref): string { // @todo Error in Resource URL in spec @ https://github.com/ezsystems/ezpublish-kernel/blob/master/doc/specifications/rest/REST-API-V2.rst#151213create-policy $xml = <<< XML @@ -233,7 +233,7 @@ public function testAddPolicy($roleHref) * * @return string The created policy href */ - public function testAddPolicyByRoleDraft($roleDraftHref) + public function testAddPolicyByRoleDraft(string $roleDraftHref): string { $xml = <<< XML @@ -286,7 +286,7 @@ public function testLoadPolicy(string $policyHref): void * * @depends testPublishRoleDraft */ - public function testLoadPolicies($roleHref): void + public function testLoadPolicies(string $roleHref): void { $response = $this->sendHttpRequest( $this->createHttpRequest('GET', "$roleHref/policies") @@ -300,7 +300,7 @@ public function testLoadPolicies($roleHref): void * * @depends testAddPolicy */ - public function testUpdatePolicy(string $policyHref) + public function testUpdatePolicy(string $policyHref): mixed { $xml = <<< XML @@ -363,7 +363,7 @@ public function testUpdatePolicyByRoleDraft(string $policyHref): void * * @todo stop using the anonymous user, this is dangerous... */ - public function testAssignRoleToUser($roleHref) + public function testAssignRoleToUser(string $roleHref): string { $xml = <<< XML @@ -389,16 +389,11 @@ public function testAssignRoleToUser($roleHref) } /** - * @covers \POST /user/users/{userId}/roles - * - * @param string $roleHref - * @param array $limitation - * - * @return string assigned role href + * @covers \POST /user/users/{userId}/roles * * @dataProvider provideLimitations */ - public function testAssignRoleToUserWithLimitation(array $limitation) + public function testAssignRoleToUserWithLimitation(array $limitation): string { $roleHref = $this->createAndPublishRole('testAssignRoleToUserWithLimitation_' . $limitation['identifier']); @@ -471,11 +466,10 @@ public function testUnassignRoleFromUser(string $roleAssignmentHref): void /** * @depends testPublishRoleDraft - * Covers POST /user/groups/{groupId}/roles * - * @return string role assignment href + * Covers POST /user/groups/{groupId}/roles */ - public function testAssignRoleToUserGroup($roleHref) + public function testAssignRoleToUserGroup(string $roleHref): string { $xml = <<< XML @@ -632,7 +626,7 @@ public function testDeleteRole(string $roleHref): void * * @depends testCreateRoleDraft */ - public function testPublishRoleDraft(string $roleDraftHref) + public function testPublishRoleDraft(string $roleDraftHref): string { $response = $this->sendHttpRequest( $this->createHttpRequest('PUBLISH', $roleDraftHref) @@ -656,7 +650,7 @@ public function testPublishRoleDraft(string $roleDraftHref) * * @depends testCreateRoleDraft */ - public function testDeleteRoleDraft($roleDraftHref): void + public function testDeleteRoleDraft(string $roleDraftHref): void { // we need to create a role draft first since we published the previous one in testPublishRoleDraft $roleHref = $this->testCreateRoleDraft($this->roleDraftHrefToRoleHref($roleDraftHref)); @@ -675,7 +669,7 @@ public function testDeleteRoleDraft($roleDraftHref): void * * @return string Role href */ - private function roleDraftHrefToRoleHref($roleDraftHref): string + private function roleDraftHrefToRoleHref(string $roleDraftHref): string { return str_replace('/draft', '', $roleDraftHref); } @@ -683,11 +677,9 @@ private function roleDraftHrefToRoleHref($roleDraftHref): string /** * Creates and publishes a role with $identifier. * - * @param string $identifier - * * @return string The href of the published role */ - private function createAndPublishRole(string $identifier) + private function createAndPublishRole(string $identifier): string { $xml = <<< XML diff --git a/tests/bundle/Functional/SearchView/SearchViewTest.php b/tests/bundle/Functional/SearchView/SearchViewTest.php index 779bbc1a8..dc4ba6de4 100644 --- a/tests/bundle/Functional/SearchView/SearchViewTest.php +++ b/tests/bundle/Functional/SearchView/SearchViewTest.php @@ -14,13 +14,11 @@ class SearchViewTest extends SearchViewTestCase { - /** @var string */ - protected $contentTypeHref; + protected string $contentTypeHref; - /** @var string[] */ - protected $contentHrefList; + /** @var array */ + protected array $contentHrefList; - /** @var string */ private string $nonSearchableContentHref; /** @@ -358,11 +356,7 @@ public function jsonProvider(): array } /** - * @param string $name - * @param string $operator * @param string|string[] $value - * - * @return \DOMElement */ private function buildFieldXml(string $name, string $operator, string|array $value): DOMElement { diff --git a/tests/bundle/Functional/TestCase.php b/tests/bundle/Functional/TestCase.php index f7e814d39..68b1a8137 100644 --- a/tests/bundle/Functional/TestCase.php +++ b/tests/bundle/Functional/TestCase.php @@ -18,7 +18,7 @@ class TestCase extends BaseTestCase { - public const X_HTTP_METHOD_OVERRIDE_MAP = [ + public const array X_HTTP_METHOD_OVERRIDE_MAP = [ 'PUBLISH' => 'POST', 'MOVE' => 'POST', 'PATCH' => 'PATCH', @@ -27,23 +27,17 @@ class TestCase extends BaseTestCase private Psr18Client $httpClient; - /** - * @var string - */ - private $httpHost; + private string $httpHost; /** * HTTP scheme (http or https). - * - * @var string */ - private $httpScheme; + private string $httpScheme; /** - * @var string - * Basic auth login:password + * Basic auth login:password. */ - private $httpAuth; + private string $httpAuth; protected static $testSuffix; @@ -51,24 +45,18 @@ class TestCase extends BaseTestCase /** * The username to use for login. - * - * @var string */ - private $loginUsername; + private string $loginUsername; /** * The password to use for login. - * - * @var string */ - private $loginPassword; + private string $loginPassword; /** * If true, a login request is automatically done during setUp(). - * - * @var bool */ - protected $autoLogin = true; + protected bool $autoLogin = true; /** * List of REST contentId (/content/objects/12345) created by tests. @@ -111,25 +99,23 @@ public function sendHttpRequest(RequestInterface $request): ResponseInterface return $this->httpClient->sendRequest($request); } - protected function getHttpHost() + protected function getHttpHost(): string { return $this->httpHost; } - protected function getLoginUsername() + protected function getLoginUsername(): string { return $this->loginUsername; } - protected function getLoginPassword() + protected function getLoginPassword(): string { return $this->loginPassword; } /** * Get base URI for Browser based requests. - * - * @return string */ protected function getBaseURI(): string { @@ -137,14 +123,7 @@ protected function getBaseURI(): string } /** - * @param string $method - * @param string $uri - * @param string $contentType - * @param string $acceptType - * @param string $body * @param array $extraHeaders [key => value] array of extra headers - * - * @return \Psr\Http\Message\RequestInterface */ public function createHttpRequest( string $method, @@ -175,7 +154,7 @@ public function createHttpRequest( ); } - protected function assertHttpResponseCodeEquals(ResponseInterface $response, $expected) + protected function assertHttpResponseCodeEquals(ResponseInterface $response, int $expected): void { $responseCode = $response->getStatusCode(); try { @@ -198,7 +177,7 @@ protected function assertHttpResponseCodeEquals(ResponseInterface $response, $ex } } - private function getHttpResponseCodeErrorMessage($errorMessage): string + private function getHttpResponseCodeErrorMessage(mixed $errorMessage): string { $errorMessageString = <<< EOF Server error message ({$errorMessage->errorCode}): {$errorMessage->errorMessage} @@ -217,7 +196,7 @@ private function getHttpResponseCodeErrorMessage($errorMessage): string return $errorMessageString; } - protected function assertHttpResponseHasHeader(ResponseInterface $response, $header, $expectedValue = null) + protected function assertHttpResponseHasHeader(ResponseInterface $response, string $header, $expectedValue = null) { $headerValue = $response->hasHeader($header) ? $response->getHeader($header)[0] : null; self::assertNotNull($headerValue, "Failed asserting that response has a {$header} header"); @@ -226,7 +205,7 @@ protected function assertHttpResponseHasHeader(ResponseInterface $response, $hea } } - protected function generateMediaTypeString($typeString): string + protected function generateMediaTypeString(string $typeString): string { return "application/vnd.ibexa.api.$typeString"; } @@ -243,7 +222,7 @@ protected function getMediaFromTypeString(string $typeString): string return substr($typeString, strlen($prefix)); } - protected function addCreatedElement(string $href) + protected function addCreatedElement(string $href): void { $testCase = $this; self::$createdContent[$href] = static function () use ($href, $testCase): void { @@ -260,7 +239,7 @@ public static function tearDownAfterClass(): void private static function clearCreatedElement(array $contentArray): void { - foreach (array_reverse($contentArray) as $href => $callback) { + foreach (array_reverse($contentArray) as $callback) { $callback(); } } @@ -268,7 +247,6 @@ private static function clearCreatedElement(array $contentArray): void /** * @param string $string The value of the folders name field * @param string $parentLocationId The REST resource id of the parent location - * @param string|null $remoteId * * @return array created Content, as an array */ @@ -310,11 +288,9 @@ protected function createFolder( } /** - * @param $xml - * * @return array Content key of the Content struct array */ - protected function createContent(string $xml) + protected function createContent(string $xml): array { $request = $this->createHttpRequest( 'POST', @@ -344,12 +320,7 @@ protected function createContent(string $xml) return $content['Content']; } - /** - * @param string $contentHref - * - * @return array - */ - protected function getContentLocations($contentHref) + protected function getContentLocations(string $contentHref): array { $response = $this->sendHttpRequest( $this->createHttpRequest('GET', "$contentHref/locations", '', 'LocationList+json') @@ -385,11 +356,7 @@ protected function login(): \stdClass } /** - * @param string $login - * @param string $password * @param array $extraHeaders extra [key => value] headers to be passed with the authentication request - * - * @return \Psr\Http\Message\RequestInterface */ protected function createAuthenticationHttpRequest(string $login, string $password, array $extraHeaders = []): RequestInterface { diff --git a/tests/bundle/Functional/TrashTest.php b/tests/bundle/Functional/TrashTest.php index 774a33504..47b770a72 100644 --- a/tests/bundle/Functional/TrashTest.php +++ b/tests/bundle/Functional/TrashTest.php @@ -14,7 +14,7 @@ class TrashTest extends RESTFunctionalTestCase /** * @return string The created trash item href */ - public function testCreateTrashItem() + public function testCreateTrashItem(): string { return $this->createTrashItem('testCreateTrashItem'); } @@ -49,7 +49,7 @@ public function testLoadTrashItem(string $trashItemHref): void * * @depends testCreateTrashItem */ - public function testDeleteTrashItem($trashItemId): void + public function testDeleteTrashItem(string $trashItemId): void { // we create a new one, since restore also needs the feature $trashItemHref = $this->createTrashItem($trashItemId); @@ -178,11 +178,6 @@ private function createTrashItem(string $id): string return $this->sendLocationToTrash($folderLocations['LocationList']['Location'][0]['_href']); } - /** - * @param string $contentHref - * - * @return string - */ private function sendLocationToTrash(string $contentHref): string { $trashRequest = $this->createHttpRequest( diff --git a/tests/bundle/Functional/UserTest.php b/tests/bundle/Functional/UserTest.php index 7c5cb11ec..7a1ff5a15 100644 --- a/tests/bundle/Functional/UserTest.php +++ b/tests/bundle/Functional/UserTest.php @@ -13,7 +13,7 @@ final class UserTest extends RESTFunctionalTestCase { - private const HEADER_LOCATION = 'Location'; + private const string HEADER_LOCATION = 'Location'; /** * Covers GET /user/groups/root. diff --git a/tests/lib/FieldTypeProcessor/AuthorProcessorTest.php b/tests/lib/FieldTypeProcessor/AuthorProcessorTest.php index 25197f2f2..afc2260f9 100644 --- a/tests/lib/FieldTypeProcessor/AuthorProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/AuthorProcessorTest.php @@ -66,9 +66,6 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings ); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\AuthorProcessor - */ protected function getProcessor(): AuthorProcessor { return new AuthorProcessor(); diff --git a/tests/lib/FieldTypeProcessor/BinaryProcessorTest.php b/tests/lib/FieldTypeProcessor/BinaryProcessorTest.php index a24393041..f77e841a2 100644 --- a/tests/lib/FieldTypeProcessor/BinaryProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/BinaryProcessorTest.php @@ -39,8 +39,6 @@ public function testPostProcessValueHash(): void /** * Returns the processor under test. - * - * @return \Ibexa\Rest\FieldTypeProcessor\BinaryProcessor */ protected function getProcessor(): BinaryProcessor { diff --git a/tests/lib/FieldTypeProcessor/DateAndTimeProcessorTest.php b/tests/lib/FieldTypeProcessor/DateAndTimeProcessorTest.php index 6d92deae3..db6db1b07 100644 --- a/tests/lib/FieldTypeProcessor/DateAndTimeProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/DateAndTimeProcessorTest.php @@ -67,9 +67,6 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings ); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\DateAndTimeProcessor - */ protected function getProcessor(): DateAndTimeProcessor { return new DateAndTimeProcessor(); diff --git a/tests/lib/FieldTypeProcessor/DateProcessorTest.php b/tests/lib/FieldTypeProcessor/DateProcessorTest.php index 74fff61de..0bd840b99 100644 --- a/tests/lib/FieldTypeProcessor/DateProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/DateProcessorTest.php @@ -64,9 +64,6 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings ); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\DateProcessor - */ protected function getProcessor(): DateProcessor { return new DateProcessor(); diff --git a/tests/lib/FieldTypeProcessor/MediaProcessorTest.php b/tests/lib/FieldTypeProcessor/MediaProcessorTest.php index 34dbe9992..cd82de322 100644 --- a/tests/lib/FieldTypeProcessor/MediaProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/MediaProcessorTest.php @@ -59,8 +59,11 @@ public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings) * @covers \Ibexa\Rest\FieldTypeProcessor\MediaProcessor::postProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings): void + public function testPostProcessFieldSettingsHash(array $outputSettings, array $inputSettings): void { $processor = $this->getProcessor(); @@ -70,9 +73,6 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings ); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\MediaProcessor - */ protected function getProcessor(): MediaProcessor { return new MediaProcessor($this->getTempDir()); diff --git a/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php b/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php index 2a6b51fe4..791ccf870 100644 --- a/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php @@ -41,8 +41,11 @@ static function ($constantName): array { * @covers \Ibexa\Rest\FieldTypeProcessor\RelationListProcessor::preProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings): void + public function testPreProcessFieldSettingsHash(array $inputSettings, array $outputSettings): void { $processor = $this->getProcessor(); @@ -56,8 +59,11 @@ public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings) * @covers \Ibexa\Rest\FieldTypeProcessor\RelationListProcessor::postProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings): void + public function testPostProcessFieldSettingsHash(array $outputSettings, array $inputSettings): void { $processor = $this->getProcessor(); @@ -67,7 +73,7 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings ); } - public function testpostProcessFieldSettingsHashLocation(): void + public function testPostProcessFieldSettingsHashLocation(): void { $processor = $this->getProcessor(); @@ -125,9 +131,6 @@ public function testPostProcessValueHash(): void self::assertEquals('/api/ibexa/v2/content/objects/300', $hash['destinationContentHrefs'][1]); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\RelationListProcessor - */ protected function getProcessor(): RelationListProcessor { return new RelationListProcessor(); diff --git a/tests/lib/FieldTypeProcessor/RelationProcessorTest.php b/tests/lib/FieldTypeProcessor/RelationProcessorTest.php index 41e58d232..3bea1712b 100644 --- a/tests/lib/FieldTypeProcessor/RelationProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/RelationProcessorTest.php @@ -44,8 +44,11 @@ static function ($constantName): array { * @covers \Ibexa\Rest\FieldTypeProcessor\RelationProcessor::preProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings): void + public function testPreProcessFieldSettingsHash(array $inputSettings, array $outputSettings): void { $processor = $this->getProcessor(); @@ -59,8 +62,11 @@ public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings) * @covers \Ibexa\Rest\FieldTypeProcessor\RelationProcessor::postProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings): void + public function testPostProcessFieldSettingsHash(array $outputSettings, array $inputSettings): void { $processor = $this->getProcessor(); @@ -164,9 +170,6 @@ public function testPostProcessFieldValueHashNotAccessibleLocation(): void ], $hash); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\RelationProcessor - */ protected function getProcessor(): RelationProcessor { return new RelationProcessor(); diff --git a/tests/lib/FieldTypeProcessor/TimeProcessorTest.php b/tests/lib/FieldTypeProcessor/TimeProcessorTest.php index 04d595518..9f84e6f4e 100644 --- a/tests/lib/FieldTypeProcessor/TimeProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/TimeProcessorTest.php @@ -26,7 +26,7 @@ class TimeProcessorTest extends TestCase public function fieldSettingsHashes(): array { return array_map( - static function ($constantName): array { + static function (string $constantName): array { return [ ['defaultType' => $constantName], ['defaultType' => constant("Ibexa\\Core\\FieldType\\Time\\Type::{$constantName}")], @@ -40,8 +40,11 @@ static function ($constantName): array { * @covers \Ibexa\Rest\FieldTypeProcessor\TimeProcessor::preProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings): void + public function testPreProcessFieldSettingsHash(array $inputSettings, array $outputSettings): void { $processor = $this->getProcessor(); @@ -55,8 +58,11 @@ public function testPreProcessFieldSettingsHash($inputSettings, $outputSettings) * @covers \Ibexa\Rest\FieldTypeProcessor\TimeProcessor::postProcessFieldSettingsHash * * @dataProvider fieldSettingsHashes + * + * @param array $inputSettings + * @param array $outputSettings */ - public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings): void + public function testPostProcessFieldSettingsHash(array $outputSettings, array $inputSettings): void { $processor = $this->getProcessor(); @@ -66,9 +72,6 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings ); } - /** - * @return \Ibexa\Rest\FieldTypeProcessor\TimeProcessor - */ protected function getProcessor(): TimeProcessor { return new TimeProcessor(); diff --git a/tests/lib/Input/FieldTypeParserTest.php b/tests/lib/Input/FieldTypeParserTest.php index af1274108..a46ac73c3 100644 --- a/tests/lib/Input/FieldTypeParserTest.php +++ b/tests/lib/Input/FieldTypeParserTest.php @@ -67,7 +67,7 @@ public function testParseFieldValue(): void ->with('42') ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($contentTypeMock) { + static function () use ($contentTypeMock): ContentType&MockObject { return $contentTypeMock; } ); @@ -94,7 +94,7 @@ static function () use ($contentTypeMock) { ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); @@ -129,7 +129,7 @@ public function testParseValue(): void ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); @@ -162,7 +162,7 @@ public function testParseValueWithPreProcessing(): void ->method('getProcessor') ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( - static function () use ($processor) { + static function () use ($processor): FieldTypeProcessor&MockObject { return $processor; } ); @@ -178,7 +178,7 @@ static function () use ($processor) { ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); @@ -207,7 +207,7 @@ public function testParseFieldSettings(): void ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); @@ -240,7 +240,7 @@ public function testParseFieldSettingsWithPreProcessing(): void ->method('getProcessor') ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( - static function () use ($processor) { + static function () use ($processor): FieldTypeProcessor&MockObject { return $processor; } ); @@ -256,7 +256,7 @@ static function () use ($processor) { ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); @@ -285,7 +285,7 @@ public function testParseValidatorConfiguration(): void ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); @@ -318,7 +318,7 @@ public function testParseValidatorConfigurationWithPreProcessing(): void ->method('getProcessor') ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( - static function () use ($processor) { + static function () use ($processor): FieldTypeProcessor&MockObject { return $processor; } ); @@ -334,7 +334,7 @@ static function () use ($processor) { ->with(self::equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - static function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock): FieldType&MockObject { return $fieldTypeMock; } ); diff --git a/tests/lib/Input/Handler/XmlTest.php b/tests/lib/Input/Handler/XmlTest.php index e2505f46c..26cba12db 100644 --- a/tests/lib/Input/Handler/XmlTest.php +++ b/tests/lib/Input/Handler/XmlTest.php @@ -38,7 +38,7 @@ public static function getXmlFixtures(): array $fixtures = []; foreach (glob(__DIR__ . '/_fixtures/*.xml') as $xmlFile) { $fixtures[] = [ - file_get_contents($xmlFile), + (string)file_get_contents($xmlFile), is_file($xmlFile . '.php') ? include $xmlFile . '.php' : null, ]; } @@ -49,7 +49,7 @@ public static function getXmlFixtures(): array /** * @dataProvider getXmlFixtures */ - public function testConvertXml($xml, $expectation): void + public function testConvertXml(string $xml, mixed $expectation): void { $handler = new Xml(); diff --git a/tests/lib/Output/FieldTypeSerializerTest.php b/tests/lib/Output/FieldTypeSerializerTest.php index e0c6a09c3..73b396ecc 100644 --- a/tests/lib/Output/FieldTypeSerializerTest.php +++ b/tests/lib/Output/FieldTypeSerializerTest.php @@ -146,7 +146,7 @@ public function testSerializeFieldSettingsWithPostProcessing(): void ->method('getProcessor') ->with('myFancyFieldType') ->willReturnCallback( - static function () use ($processorMock) { + static function () use ($processorMock): FieldTypeProcessor&MockObject { return $processorMock; } ); @@ -216,7 +216,7 @@ public function testSerializeValidatorConfigurationWithPostProcessing(): void ->method('getProcessor') ->with('myFancyFieldType') ->willReturnCallback( - static function () use ($processorMock) { + static function () use ($processorMock): FieldTypeProcessor&MockObject { return $processorMock; } ); @@ -254,7 +254,7 @@ protected function getFieldTypeSerializer(): FieldTypeSerializer ); } - protected function getFieldTypeServiceMock() + protected function getFieldTypeServiceMock(): FieldTypeService&MockObject { if (!isset($this->fieldTypeServiceMock)) { $this->fieldTypeServiceMock = $this->createMock(FieldTypeService::class); @@ -263,7 +263,7 @@ protected function getFieldTypeServiceMock() return $this->fieldTypeServiceMock; } - protected function getFieldTypeProcessorRegistryMock() + protected function getFieldTypeProcessorRegistryMock(): FieldTypeProcessorRegistry&MockObject { if (!isset($this->fieldTypeProcessorRegistryMock)) { $this->fieldTypeProcessorRegistryMock = $this->createMock(FieldTypeProcessorRegistry::class); @@ -272,7 +272,7 @@ protected function getFieldTypeProcessorRegistryMock() return $this->fieldTypeProcessorRegistryMock; } - protected function getFieldTypeProcessorMock() + protected function getFieldTypeProcessorMock(): FieldTypeProcessor&MockObject { if (!isset($this->fieldTypeProcessorMock)) { $this->fieldTypeProcessorMock = $this->createMock(FieldTypeProcessor::class); @@ -281,7 +281,7 @@ protected function getFieldTypeProcessorMock() return $this->fieldTypeProcessorMock; } - protected function getContentTypeMock() + protected function getContentTypeMock(): APIContentType&MockObject { if (!isset($this->contentTypeMock)) { $this->contentTypeMock = $this->createMock(APIContentType::class); @@ -290,7 +290,7 @@ protected function getContentTypeMock() return $this->contentTypeMock; } - protected function getFieldTypeMock() + protected function getFieldTypeMock(): APIFieldType&MockObject { if (!isset($this->fieldTypeMock)) { $this->fieldTypeMock = $this->createMock(APIFieldType::class); @@ -351,7 +351,7 @@ private function createFieldTypeMock( private function mockFieldTypeServiceGetFieldType( string $identifier, - APIFieldType $fieldType + APIFieldType $fieldType, ): void { $this->getFieldTypeServiceMock() ->method('getFieldType') diff --git a/tests/lib/Output/ValueObjectVisitorBaseTest.php b/tests/lib/Output/ValueObjectVisitorBaseTest.php index 509095fa4..c79437772 100644 --- a/tests/lib/Output/ValueObjectVisitorBaseTest.php +++ b/tests/lib/Output/ValueObjectVisitorBaseTest.php @@ -7,6 +7,7 @@ namespace Ibexa\Tests\Rest\Output; +use DOMNode; use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; use Ibexa\Contracts\Rest\Output\Visitor; use Ibexa\Contracts\Rest\UriParser\UriParserInterface; @@ -23,15 +24,15 @@ abstract class ValueObjectVisitorBaseTest extends Server\BaseTest { use AssertXmlTagTrait; - protected (Visitor & MockObject)|null $visitorMock = null; + protected (Visitor&MockObject)|null $visitorMock = null; - protected (Response & MockObject)|null $responseMock = null; + protected (Response&MockObject)|null $responseMock = null; protected Xml|null $generator; - private (RouterInterface & MockObject)|null $routerMock = null; + private (RouterInterface&MockObject)|null $routerMock = null; - private (RouterInterface & MockObject)|null $templatedRouterMock = null; + private (RouterInterface&MockObject)|null $templatedRouterMock = null; private int $routerCallIndex = 0; @@ -39,7 +40,7 @@ abstract class ValueObjectVisitorBaseTest extends Server\BaseTest private UriParserInterface&MockObject $uriParser; - protected function getVisitorMock(): Visitor & MockObject + protected function getVisitorMock(): Visitor&MockObject { if (!isset($this->visitorMock)) { $this->visitorMock = $this->createMock(Visitor::class); @@ -52,7 +53,7 @@ protected function getVisitorMock(): Visitor & MockObject return $this->visitorMock; } - protected function getResponseMock(): Response & MockObject + protected function getResponseMock(): Response&MockObject { if (!isset($this->responseMock)) { $this->responseMock = $this->getMockBuilder(Response::class) @@ -82,11 +83,8 @@ protected function getGenerator(): Xml * This method asserts that $xpathExpression results in a non-empty node * set in context of $domNode, by wrapping the "boolean()" function around * it and evaluating it on the document owning $domNode. - * - * @param \DOMNode $domNode - * @param string $xpathExpression */ - protected function assertXPath(\DOMNode $domNode, $xpathExpression) + protected function assertXPath(DOMNode $domNode, string $xpathExpression): void { $ownerDocument = ($domNode instanceof \DOMDOcument ? $domNode @@ -100,7 +98,7 @@ protected function assertXPath(\DOMNode $domNode, $xpathExpression) ); } - protected function getVisitor() + protected function getVisitor(): ValueObjectVisitor { $visitor = $this->internalGetVisitor(); $visitor->setUriParser($this->getUriParser()); @@ -110,7 +108,7 @@ protected function getVisitor() return $visitor; } - protected function getUriParser(): UriParserInterface & MockObject + protected function getUriParser(): UriParserInterface&MockObject { if (!isset($this->uriParser)) { $this->uriParser = $this->createMock(UriParserInterface::class); @@ -119,7 +117,7 @@ protected function getUriParser(): UriParserInterface & MockObject return $this->uriParser; } - protected function getRouterMock(): RouterInterface & MockObject + protected function getRouterMock(): RouterInterface&MockObject { if (!isset($this->routerMock)) { $this->routerMock = $this->createMock(RouterInterface::class); @@ -131,19 +129,15 @@ protected function getRouterMock(): RouterInterface & MockObject /** * Resets the router mock and its expected calls index & list. */ - protected function resetRouterMock() + protected function resetRouterMock(): void { $this->routerMock = null; } /** * Adds an expectation to the routerMock. Expectations must be added sequentially. - * - * @param string $routeName - * @param array $arguments - * @param string $returnValue */ - protected function addRouteExpectation($routeName, $arguments, $returnValue) + protected function addRouteExpectation(string $routeName, array $arguments, string $returnValue): void { $this->getRouterMock() ->expects(self::at($this->routerCallIndex++)) @@ -155,10 +149,7 @@ protected function addRouteExpectation($routeName, $arguments, $returnValue) ->willReturn($returnValue); } - /** - * @return \Symfony\Component\Routing\RouterInterface|\PHPUnit\Framework\MockObject\MockObject - */ - protected function getTemplatedRouterMock() + protected function getTemplatedRouterMock(): RouterInterface&MockObject { if (!isset($this->templatedRouterMock)) { $this->templatedRouterMock = $this->createMock(RouterInterface::class); diff --git a/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php b/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php index 35f89152f..e3247439a 100644 --- a/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php +++ b/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php @@ -37,12 +37,6 @@ public function testParse(): void 'ObjectState not created correctly.' ); - self::assertInstanceOf( - '\\Ibexa\\Contracts\\Core\\Repository\\Values\\ObjectState\\ObjectState', - $result[0]->objectState, - 'Inner ObjectState not created correctly.' - ); - self::assertEquals( 21, $result[0]->objectState->id, diff --git a/tests/lib/Server/Input/Parser/ContentTypeCreateTest.php b/tests/lib/Server/Input/Parser/ContentTypeCreateTest.php index cb6072187..36fbdf2ea 100644 --- a/tests/lib/Server/Input/Parser/ContentTypeCreateTest.php +++ b/tests/lib/Server/Input/Parser/ContentTypeCreateTest.php @@ -247,8 +247,6 @@ protected function getContentTypeServiceMock(): ContentTypeService & MockObject /** * Returns the array under test. - * - * @return array */ protected function getInputArray(): array { diff --git a/tests/lib/Server/Input/Parser/ContentTypeUpdateTest.php b/tests/lib/Server/Input/Parser/ContentTypeUpdateTest.php index cee5fe004..7320ab18b 100644 --- a/tests/lib/Server/Input/Parser/ContentTypeUpdateTest.php +++ b/tests/lib/Server/Input/Parser/ContentTypeUpdateTest.php @@ -158,9 +158,6 @@ protected function getContentTypeServiceMock(): ContentTypeService&MockObject return $contentTypeServiceMock; } - /** - * @return array - */ protected function getInputArray(): array { return [ diff --git a/tests/lib/Server/Input/Parser/ContentUpdateTest.php b/tests/lib/Server/Input/Parser/ContentUpdateTest.php index 50710e6f5..4f836e28d 100644 --- a/tests/lib/Server/Input/Parser/ContentUpdateTest.php +++ b/tests/lib/Server/Input/Parser/ContentUpdateTest.php @@ -53,7 +53,7 @@ public function testParserResultOwner(RestContentMetadataUpdateStruct $result): /** * @dataProvider providerForTestParseFailureInvalidHref */ - public function testParseFailureInvalidHref($element, $exceptionMessage): void + public function testParseFailureInvalidHref(string $element, string $exceptionMessage): void { $inputArray = $this->getValidInputData(); $inputArray[$element]['_href'] = '/invalid/section/uri'; @@ -92,7 +92,7 @@ public function providerForTestParseFailureInvalidHref(): array /** * @dataProvider providerForTestParseFailureInvalidDate */ - public function testParseFailureInvalidDate($element, $exceptionMessage): void + public function testParseFailureInvalidDate(string $element, string $exceptionMessage): void { $inputArray = $this->getValidInputData(); $inputArray[$element] = 42; diff --git a/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php b/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php index 1801fc865..00f5d70a0 100644 --- a/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php +++ b/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php @@ -18,8 +18,8 @@ final class SiblingTest extends BaseTest { - private const EXAMPLE_LOCATION_ID = 54; - private const EXAMPLE_PARENT_LOCATION_ID = 2; + private const int EXAMPLE_LOCATION_ID = 54; + private const int EXAMPLE_PARENT_LOCATION_ID = 2; private LocationService & MockObject $locationService; diff --git a/tests/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParserTest.php b/tests/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParserTest.php index d61ddca10..17aae3bb8 100644 --- a/tests/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParserTest.php +++ b/tests/lib/Server/Input/Parser/Limitation/RouteBasedLimitationParserTest.php @@ -34,8 +34,6 @@ public function testParse(): void /** * Must return the tested parser object. - * - * @return \Ibexa\Rest\Server\Input\Parser\Limitation\RouteBasedLimitationParser */ protected function internalGetParser(): RouteBasedLimitationParser { diff --git a/tests/lib/Server/Input/Parser/LocationUpdateTest.php b/tests/lib/Server/Input/Parser/LocationUpdateTest.php index dd3b8709d..b2fd5abcb 100644 --- a/tests/lib/Server/Input/Parser/LocationUpdateTest.php +++ b/tests/lib/Server/Input/Parser/LocationUpdateTest.php @@ -17,8 +17,8 @@ class LocationUpdateTest extends BaseTest { - public function testParse(): void - { + public function testParse(): void + { $inputArray = [ 'priority' => 0, 'remoteId' => 'remote-id', @@ -36,12 +36,6 @@ public function testParse(): void 'LocationUpdateStruct not created correctly.' ); - self::assertInstanceOf( - LocationUpdateStruct::class, - $result->locationUpdateStruct, - 'LocationUpdateStruct not created correctly.' - ); - self::assertEquals( 0, $result->locationUpdateStruct->priority, @@ -72,8 +66,8 @@ public function testParse(): void ); } - public function testParseWithMissingSortField(): void - { + public function testParseWithMissingSortField(): void + { $inputArray = [ 'priority' => 0, 'remoteId' => 'remote-id', @@ -88,11 +82,6 @@ public function testParseWithMissingSortField(): void $result ); - self::assertInstanceOf( - LocationUpdateStruct::class, - $result->locationUpdateStruct - ); - self::assertNull( $result->locationUpdateStruct->sortField ); @@ -117,11 +106,6 @@ public function testParseWithMissingSortOrder(): void $result ); - self::assertInstanceOf( - LocationUpdateStruct::class, - $result->locationUpdateStruct - ); - self::assertNull( $result->locationUpdateStruct->sortOrder ); diff --git a/tests/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClassTest.php b/tests/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClassTest.php index 7b8bddd5f..2013820e3 100644 --- a/tests/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClassTest.php +++ b/tests/lib/Server/Input/Parser/SortClause/DataKeyValueObjectClassTest.php @@ -84,8 +84,6 @@ public function testParseExceptionOnNonexistingValueObjectClass(): void /** * Returns the DataKeyValueObjectClass parser. - * - * @return \Ibexa\Rest\Server\Input\Parser\SortClause\DataKeyValueObjectClass */ protected function internalGetParser(): DataKeyValueObjectClass { diff --git a/tests/lib/Server/Input/Parser/SortClause/FieldTest.php b/tests/lib/Server/Input/Parser/SortClause/FieldTest.php index db04fee6d..2f2d86d8d 100644 --- a/tests/lib/Server/Input/Parser/SortClause/FieldTest.php +++ b/tests/lib/Server/Input/Parser/SortClause/FieldTest.php @@ -72,8 +72,6 @@ public function testParseExceptionOnInvalidDirectionFormat(): void /** * Returns the Field parser. - * - * @return \Ibexa\Rest\Server\Input\Parser\SortClause\Field */ protected function internalGetParser(): FieldParser { diff --git a/tests/lib/Server/Input/Parser/ViewInputOneDotOneTest.php b/tests/lib/Server/Input/Parser/ViewInputOneDotOneTest.php index 456f508f2..52d905491 100644 --- a/tests/lib/Server/Input/Parser/ViewInputOneDotOneTest.php +++ b/tests/lib/Server/Input/Parser/ViewInputOneDotOneTest.php @@ -35,6 +35,8 @@ public function testParseContentQuery(): void $expectedViewInput = new RestViewInput(); $expectedViewInput->identifier = 'Query identifier'; $expectedViewInput->query = new Query(); + $expectedViewInput->languageCode = null; + $expectedViewInput->useAlwaysAvailable = null; self::assertEquals($expectedViewInput, $result, 'RestViewInput not created correctly.'); } @@ -59,6 +61,8 @@ public function testParseLocationQuery(): void $expectedViewInput = new RestViewInput(); $expectedViewInput->identifier = 'Query identifier'; $expectedViewInput->query = new LocationQuery(); + $expectedViewInput->languageCode = null; + $expectedViewInput->useAlwaysAvailable = null; self::assertEquals($expectedViewInput, $result, 'RestViewInput not created correctly.'); } diff --git a/tests/lib/Server/Input/Parser/ViewInputTest.php b/tests/lib/Server/Input/Parser/ViewInputTest.php index 1ad7b4fae..b2e5cdcd8 100644 --- a/tests/lib/Server/Input/Parser/ViewInputTest.php +++ b/tests/lib/Server/Input/Parser/ViewInputTest.php @@ -33,6 +33,8 @@ public function testParse(): void $expectedViewInput = new RestViewInput(); $expectedViewInput->identifier = 'Query identifier'; $expectedViewInput->query = new Query(); + $expectedViewInput->languageCode = null; + $expectedViewInput->useAlwaysAvailable = null; self::assertEquals($expectedViewInput, $result, 'RestViewInput not created correctly.'); } diff --git a/tests/lib/Server/Output/ValueObjectVisitor/ContentListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/ContentListTest.php index 40890d554..39e40370d 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/ContentListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/ContentListTest.php @@ -125,8 +125,6 @@ public function testResultContainsTotalCountAttributes(string $result): void /** * Get the ContentList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\ContentList */ protected function internalGetVisitor(): ValueObjectVisitor\ContentList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoListTest.php index 3fdf12a8f..0433b8c4b 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeInfoListTest.php @@ -17,10 +17,8 @@ class ContentTypeInfoListTest extends ValueObjectVisitorBaseTest { /** * Test the ContentTypeInfoList visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -123,8 +121,6 @@ public function testContentTypeInfoListVisitsChildren(): void /** * Get the ContentTypeInfoList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\ContentTypeInfoList */ protected function internalGetVisitor(): ValueObjectVisitor\ContentTypeInfoList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeListTest.php index 2f5793f31..d269e8f8d 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/ContentTypeListTest.php @@ -17,10 +17,8 @@ class ContentTypeListTest extends ValueObjectVisitorBaseTest { /** * Test the ContentTypeList visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -123,8 +121,6 @@ public function testContentTypeListVisitsChildren(): void /** * Get the ContentTypeList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\ContentTypeList */ protected function internalGetVisitor(): ValueObjectVisitor\ContentTypeList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/CountryListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/CountryListTest.php index 5fec9ac91..4043c088e 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/CountryListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/CountryListTest.php @@ -7,13 +7,14 @@ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; +use DOMDocument; use Ibexa\Rest\Server\Output\ValueObjectVisitor; use Ibexa\Rest\Server\Values\CountryList; use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; class CountryListTest extends ValueObjectVisitorBaseTest { - public function testVisit(): \DOMDocument + public function testVisit(): DOMDocument { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -47,7 +48,7 @@ public function testVisit(): \DOMDocument self::assertNotEmpty($result); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXml($result); @@ -55,66 +56,54 @@ public function testVisit(): \DOMDocument } /** - * @param \DOMDocument $dom - * * @depends testVisit */ - public function testCountryListMediaType(\DOMDocument $dom): void + public function testCountryListMediaType(DOMDocument $dom): void { $this->assertXPath($dom, '/CountryList/Country[1][@media-type="application/vnd.ibexa.api.Country+xml"]'); $this->assertXPath($dom, '/CountryList/Country[2][@media-type="application/vnd.ibexa.api.Country+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisit */ - public function testCountryListId(\DOMDocument $dom): void + public function testCountryListId(DOMDocument $dom): void { $this->assertXPath($dom, '/CountryList/Country[1][@id="VA"]'); $this->assertXPath($dom, '/CountryList/Country[2][@id="HM"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisit */ - public function testCountryListName(\DOMDocument $dom): void + public function testCountryListName(DOMDocument $dom): void { $this->assertXPath($dom, '/CountryList/Country[1]/name[text()="Holy See (Vatican City State)"]'); $this->assertXPath($dom, '/CountryList/Country[2]/name[text()="Heard Island and McDonald Islands"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisit */ - public function testCountryListAlpha2(\DOMDocument $dom): void + public function testCountryListAlpha2(DOMDocument $dom): void { $this->assertXPath($dom, '/CountryList/Country[1]/Alpha2[text()="VA"]'); $this->assertXPath($dom, '/CountryList/Country[2]/Alpha2[text()="HM"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisit */ - public function testCountryListAlpha3(\DOMDocument $dom): void + public function testCountryListAlpha3(DOMDocument $dom): void { $this->assertXPath($dom, '/CountryList/Country[1]/Alpha3[text()="VAT"]'); $this->assertXPath($dom, '/CountryList/Country[2]/Alpha3[text()="HMD"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisit */ - public function testCountryListIDC(\DOMDocument $dom): void + public function testCountryListIDC(DOMDocument $dom): void { $this->assertXPath($dom, '/CountryList/Country[1]/IDC[text()="3906"]'); $this->assertXPath($dom, '/CountryList/Country[2]/IDC[text()="672"]'); @@ -122,8 +111,6 @@ public function testCountryListIDC(\DOMDocument $dom): void /** * Get the CountryList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\CountryList */ protected function internalGetVisitor(): ValueObjectVisitor\CountryList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/LocationListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/LocationListTest.php index 08e360914..3d2b76f45 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/LocationListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/LocationListTest.php @@ -15,10 +15,8 @@ class LocationListTest extends ValueObjectVisitorBaseTest { /** * Test the LocationList visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -81,8 +79,6 @@ public function testResultContainsLocationListAttributes($result): void /** * Get the LocationList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\LocationList */ protected function internalGetVisitor(): ValueObjectVisitor\LocationList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/LocationTest.php b/tests/lib/Server/Output/ValueObjectVisitor/LocationTest.php index 9ae7b9e41..8915035f8 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/LocationTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/LocationTest.php @@ -22,11 +22,11 @@ final class LocationTest extends ValueObjectVisitorBaseTest { - private const MAIN_LOCATION_ID = 78; + private const int MAIN_LOCATION_ID = 78; - private const UNAUTHORIZED_MAIN_LOCATION_ID = 111; + private const int UNAUTHORIZED_MAIN_LOCATION_ID = 111; - private const LOCATION_ID = 55; + private const int LOCATION_ID = 55; private LocationService&MockObject $locationServiceMock; diff --git a/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateListTest.php index 4c9d845ba..548a73603 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateListTest.php @@ -17,10 +17,8 @@ class ObjectStateListTest extends ValueObjectVisitorBaseTest { /** * Test the ObjectStateList visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -52,11 +50,9 @@ public function testVisit() /** * Test if result contains ObjectStateList element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsObjectStateListElement($result): void + public function testResultContainsObjectStateListElement(string $result): void { $this->assertXMLTag( [ @@ -71,11 +67,9 @@ public function testResultContainsObjectStateListElement($result): void /** * Test if result contains ObjectStateList element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsObjectStateListAttributes($result): void + public function testResultContainsObjectStateListAttributes(string $result): void { $this->assertXMLTag( [ @@ -122,8 +116,6 @@ public function testObjectStateListVisitsChildren(): void /** * Get the ObjectStateList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\ObjectStateList */ protected function internalGetVisitor(): ValueObjectVisitor\ObjectStateList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/PolicyListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/PolicyListTest.php index 9c756fb72..b629e1539 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/PolicyListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/PolicyListTest.php @@ -17,10 +17,8 @@ class PolicyListTest extends ValueObjectVisitorBaseTest { /** * Test the PolicyList visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -45,11 +43,9 @@ public function testVisit() /** * Test if result contains PolicyList element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsPolicyListElement($result): void + public function testResultContainsPolicyListElement(string $result): void { $this->assertXMLTag( [ @@ -64,11 +60,9 @@ public function testResultContainsPolicyListElement($result): void /** * Test if result contains PolicyList element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsPolicyListAttributes($result): void + public function testResultContainsPolicyListAttributes(string $result): void { $this->assertXMLTag( [ @@ -115,8 +109,6 @@ public function testPolicyListVisitsChildren(): void /** * Get the PolicyList visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\PolicyList */ protected function internalGetVisitor(): ValueObjectVisitor\PolicyList { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/PolicyTest.php b/tests/lib/Server/Output/ValueObjectVisitor/PolicyTest.php index 885d39e84..2a3dd192d 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/PolicyTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/PolicyTest.php @@ -176,8 +176,6 @@ public function testResultContainsLimitationsAttributes(string $result): void /** * Get the Policy visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\Policy */ protected function internalGetVisitor(): Policy { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php index 011aa6593..fb4960c4c 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php @@ -19,8 +19,7 @@ class RestContentTest extends BaseContentValueObjectVisitorTestCase { - /** @var \Ibexa\Core\Helper\TranslationHelper|\PHPUnit\Framework\MockObject\MockObject */ - private MockObject $translationHelper; + private MockObject&TranslationHelper $translationHelper; protected function setUp(): void { @@ -71,7 +70,7 @@ public function testVisitWithoutEmbeddedVersion(): DOMDocument ); $this->addRouteExpectation( 'ibexa.rest.load_location', - ['locationPath' => $locationPath = trim($restContent->mainLocation->pathString, '/')], + ['locationPath' => $locationPath = trim((string)$restContent->mainLocation?->pathString, '/')], "/content/locations/{$locationPath}" ); $this->addRouteExpectation( @@ -284,8 +283,6 @@ public function testVisitWithEmbeddedVersion(): DOMDocument } /** - * @param \DOMDocument $dom - * * @depends testVisitWithEmbeddedVersion */ public function testContentMediaTypeWithVersionCorrect(DOMDocument $dom): void @@ -294,8 +291,6 @@ public function testContentMediaTypeWithVersionCorrect(DOMDocument $dom): void } /** - * @param \DOMDocument $dom - * * @depends testVisitWithEmbeddedVersion */ public function testEmbeddedCurrentVersionHrefCorrect(DOMDocument $dom): void @@ -304,8 +299,6 @@ public function testEmbeddedCurrentVersionHrefCorrect(DOMDocument $dom): void } /** - * @param \DOMDocument $dom - * * @depends testVisitWithEmbeddedVersion */ public function testEmbeddedCurrentVersionMediaTypeCorrect(DOMDocument $dom): void @@ -313,9 +306,6 @@ public function testEmbeddedCurrentVersionMediaTypeCorrect(DOMDocument $dom): vo $this->assertXPath($dom, '/Content/CurrentVersion[@media-type="application/vnd.ibexa.api.Version+xml"]'); } - /** - * Get the Content visitor. - */ protected function internalGetVisitor(): ValueObjectVisitor\RestContent { return new ValueObjectVisitor\RestContent( diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestExecutedViewTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestExecutedViewTest.php index 7b78505a7..e8f15c1a7 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestExecutedViewTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestExecutedViewTest.php @@ -7,6 +7,7 @@ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; +use DOMDocument; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\LocationService; @@ -23,9 +24,9 @@ class RestExecutedViewTest extends ValueObjectVisitorBaseTest { - private const EXAMPLE_LOCATION_ID = 54; + private const int EXAMPLE_LOCATION_ID = 54; - public function testVisit(): \DOMDocument + public function testVisit(): DOMDocument { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -66,7 +67,7 @@ public function testVisit(): \DOMDocument self::assertNotEmpty($result); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXml($result); return $dom; @@ -98,7 +99,7 @@ public function provideXpathAssertions(): array * * @dataProvider provideXpathAssertions */ - public function testGeneratedXml(string $xpath, \DOMDocument $dom): void + public function testGeneratedXml(string $xpath, DOMDocument $dom): void { $this->assertXPath($dom, $xpath); } @@ -111,12 +112,12 @@ protected function internalGetVisitor(): ValueObjectVisitor\RestExecutedView ); } - public function getLocationServiceMock(): LocationService & MockObject + public function getLocationServiceMock(): LocationService&MockObject { return $this->createMock(LocationService::class); } - private function getRelationListFacadeMock(): ContentService\RelationListFacadeInterface & MockObject + private function getRelationListFacadeMock(): ContentService\RelationListFacadeInterface&MockObject { $relationListFacade = $this->createMock(ContentService\RelationListFacadeInterface::class); $relationListFacade->method('getRelations')->willReturnCallback( @@ -126,7 +127,7 @@ private function getRelationListFacadeMock(): ContentService\RelationListFacadeI return $relationListFacade; } - public function getContentTypeServiceMock(): ContentTypeService & MockObject + public function getContentTypeServiceMock(): ContentTypeService&MockObject { return $this->createMock(ContentTypeService::class); } diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestLocationRootNodeTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestLocationRootNodeTest.php index dfc9bf7ff..113f72b89 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestLocationRootNodeTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestLocationRootNodeTest.php @@ -17,10 +17,8 @@ class RestLocationRootNodeTest extends RestLocationTest { /** * Test the Location visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -101,11 +99,9 @@ public function testVisit() /** * Test if result contains id value element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsIdValueElement($result): void + public function testResultContainsIdValueElement(string $result): void { $this->assertXMLTag( [ @@ -121,11 +117,9 @@ public function testResultContainsIdValueElement($result): void /** * Test if result contains ParentLocation element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsParentLocationElement($result): void + public function testResultContainsParentLocationElement(string $result): void { $this->assertXMLTag( [ @@ -140,11 +134,9 @@ public function testResultContainsParentLocationElement($result): void /** * Test if result contains ParentLocation element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsParentLocationAttributes($result): void + public function testResultContainsParentLocationAttributes(string $result): void { $this->assertXMLTag( [ @@ -160,11 +152,9 @@ public function testResultContainsParentLocationAttributes($result): void /** * Test if result contains Location element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsLocationAttributes($result): void + public function testResultContainsLocationAttributes(string $result): void { $this->assertXMLTag( [ @@ -183,11 +173,9 @@ public function testResultContainsLocationAttributes($result): void /** * Test if result contains Children element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsChildrenAttributes($result): void + public function testResultContainsChildrenAttributes(string $result): void { $this->assertXMLTag( [ @@ -206,11 +194,9 @@ public function testResultContainsChildrenAttributes($result): void /** * Test if result contains pathString value element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsPathStringValueElement($result): void + public function testResultContainsPathStringValueElement(string $result): void { $this->assertXMLTag( [ @@ -226,11 +212,9 @@ public function testResultContainsPathStringValueElement($result): void /** * Test if result contains Content element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsUrlAliasesTagAttributes($result): void + public function testResultContainsUrlAliasesTagAttributes(string $result): void { $this->assertXMLTag( [ @@ -248,8 +232,6 @@ public function testResultContainsUrlAliasesTagAttributes($result): void /** * Get the Location visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestLocation */ protected function internalGetVisitor(): ValueObjectVisitor\RestLocation { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestLocationTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestLocationTest.php index dab07174a..b73d35c56 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestLocationTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestLocationTest.php @@ -18,10 +18,8 @@ class RestLocationTest extends ValueObjectVisitorBaseTest { /** * Test the Location visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -486,8 +484,6 @@ public function testResultContainsUrlAliasesTagAttributes(string $result): void /** * Get the Location visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestLocation */ protected function internalGetVisitor(): ValueObjectVisitor\RestLocation { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestRelationTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestRelationTest.php index d065e31f3..8ca654208 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestRelationTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestRelationTest.php @@ -17,10 +17,8 @@ class RestRelationTest extends ValueObjectVisitorBaseTest { /** * Test the RestRelation visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -85,11 +83,9 @@ public function testVisit() /** * Test if result contains Relation element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsRelationElement($result): void + public function testResultContainsRelationElement(string $result): void { $this->assertXMLTag( [ @@ -108,11 +104,9 @@ public function testResultContainsRelationElement($result): void /** * Test if result contains Relation element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsRelationAttributes($result): void + public function testResultContainsRelationAttributes(string $result): void { $this->assertXMLTag( [ @@ -129,11 +123,9 @@ public function testResultContainsRelationAttributes($result): void } /** - * @param string $result - * * @depends testVisit */ - public function testResultContainsSourceContentElement($result): void + public function testResultContainsSourceContentElement(string $result): void { $this->assertXMLTag( [ @@ -150,11 +142,9 @@ public function testResultContainsSourceContentElement($result): void } /** - * @param string $result - * * @depends testVisit */ - public function testResultContainsDestinationContentElement($result): void + public function testResultContainsDestinationContentElement(string $result): void { $this->assertXMLTag( [ @@ -171,11 +161,9 @@ public function testResultContainsDestinationContentElement($result): void } /** - * @param string $result - * * @depends testVisit */ - public function testResultContainsSourceFieldDefinitionIdentifierElement($result): void + public function testResultContainsSourceFieldDefinitionIdentifierElement(string $result): void { $this->assertXMLTag( [ @@ -189,11 +177,9 @@ public function testResultContainsSourceFieldDefinitionIdentifierElement($result } /** - * @param string $result - * * @depends testVisit */ - public function testResultContainsRelationTypeElement($result): void + public function testResultContainsRelationTypeElement(string $result): void { $this->assertXMLTag( [ @@ -208,8 +194,6 @@ public function testResultContainsRelationTypeElement($result): void /** * Get the Relation visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestRelation */ protected function internalGetVisitor(): ValueObjectVisitor\RestRelation { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RoleTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RoleTest.php index 0e4f65f2d..950d95274 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RoleTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RoleTest.php @@ -9,6 +9,7 @@ use Ibexa\Core\Repository\Values\User; use Ibexa\Rest\Server\Output\ValueObjectVisitor\Role; +use Ibexa\Rest\Server\Values\RestRole; use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; class RoleTest extends ValueObjectVisitorBaseTest @@ -44,7 +45,7 @@ public function testVisit(): string $visitor->visit( $this->getVisitorMock(), $generator, - $role + new RestRole($role), ); $result = $generator->endDocument(null); diff --git a/tests/lib/Server/Output/ValueObjectVisitor/TrashTest.php b/tests/lib/Server/Output/ValueObjectVisitor/TrashTest.php index cdb633f50..0f4f1ecad 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/TrashTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/TrashTest.php @@ -17,10 +17,8 @@ class TrashTest extends ValueObjectVisitorBaseTest { /** * Test the Trash visitor. - * - * @return string */ - public function testVisit() + public function testVisit(): string { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -45,11 +43,9 @@ public function testVisit() /** * Test if result contains Trash element. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsTrashElement($result): void + public function testResultContainsTrashElement(string $result): void { $this->assertXMLTag( [ @@ -64,11 +60,9 @@ public function testResultContainsTrashElement($result): void /** * Test if result contains Trash element attributes. * - * @param string $result - * * @depends testVisit */ - public function testResultContainsTrashAttributes($result): void + public function testResultContainsTrashAttributes(string $result): void { $this->assertXMLTag( [ @@ -123,8 +117,6 @@ public function testTrashVisitsChildren(): void /** * Get the Trash visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\Trash */ protected function internalGetVisitor(): ValueObjectVisitor\Trash {