diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 00000000..4ba28536 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,25 @@ +withRules([ + 'declare_strict_types' => false, +]); + +return $configFactory + ->buildConfig() + ->setFinder( + PhpCsFixer\Finder::create() + ->in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + ->files()->name('*.php') + ); diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 0c73f93b..00000000 --- a/.php_cs +++ /dev/null @@ -1,10 +0,0 @@ -setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__ . '/src') - ->in(__DIR__ . '/tests') - ->files()->name('*.php') - ) -; diff --git a/composer.json b/composer.json index 0925c191..b839ba29 100644 --- a/composer.json +++ b/composer.json @@ -24,13 +24,13 @@ } }, "require": { - "php": "^7.3", + "php": "^7.4", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-simplexml": "*", "ext-xmlwriter": "*", - "ezsystems/ezplatform-kernel": "^4.0@dev", + "ibexa/core": "^4.0@dev", "symfony/http-kernel": "^5.3", "symfony/dependency-injection": "^5.3", "symfony/routing": "^5.3", @@ -47,9 +47,9 @@ }, "require-dev": { "ibexa/ci-scripts": "^0.2@dev", - "ezsystems/doctrine-dbal-schema": "^4.0@dev", - "ezsystems/ezplatform-code-style": "^0.1.0", - "friendsofphp/php-cs-fixer": "^2.16.0", + "ibexa/doctrine-schema": "^4.0@dev", + "ibexa/code-style": "^1.0", + "friendsofphp/php-cs-fixer": "^3.0", "phpunit/phpunit": "^8.5", "matthiasnoback/symfony-dependency-injection-test": "^4.1", "nyholm/psr7": "^1.1", @@ -57,7 +57,7 @@ "symfony/browser-kit": "^5.3" }, "scripts": { - "fix-cs": "@php ./vendor/bin/php-cs-fixer fix -v --show-progress=estimating" + "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots" }, "extra": { "branch-alias": { diff --git a/src/bundle/ApiLoader/Factory.php b/src/bundle/ApiLoader/Factory.php index 01605a5f..c78323b0 100644 --- a/src/bundle/ApiLoader/Factory.php +++ b/src/bundle/ApiLoader/Factory.php @@ -1,14 +1,14 @@ addMethodCall( - 'addVisitor', [ + 'addVisitor', + [ $regexp, $visitor['reference'], ] diff --git a/src/bundle/DependencyInjection/Compiler/ValueObjectVisitorPass.php b/src/bundle/DependencyInjection/Compiler/ValueObjectVisitorPass.php index 0a7810ca..1ca2e181 100644 --- a/src/bundle/DependencyInjection/Compiler/ValueObjectVisitorPass.php +++ b/src/bundle/DependencyInjection/Compiler/ValueObjectVisitorPass.php @@ -1,7 +1,7 @@ ['default_router' => ['non_siteaccess_aware_routes' => ['ezpublish_rest_']]]]; - $container->prependExtensionConfig('ezpublish', $config); + $container->prependExtensionConfig('ibexa', $config); } } diff --git a/src/bundle/DependencyInjection/Security/RestSessionBasedFactory.php b/src/bundle/DependencyInjection/Security/RestSessionBasedFactory.php index b4cfe1d9..6a0165b2 100644 --- a/src/bundle/DependencyInjection/Security/RestSessionBasedFactory.php +++ b/src/bundle/DependencyInjection/Security/RestSessionBasedFactory.php @@ -1,7 +1,7 @@ * - * @var \EzSystems\EzPlatformRest\Input\Parser[] + * @var \Ibexa\Contracts\Rest\Input\Parser[] */ protected $parsers = []; @@ -47,7 +47,7 @@ public function __construct(array $parsers = []) * Adds another parser for the given Content Type. * * @param string $mediaType - * @param \EzSystems\EzPlatformRest\Input\Parser $parser + * @param \Ibexa\Contracts\Rest\Input\Parser $parser */ public function addParser($mediaType, Parser $parser) { @@ -61,7 +61,7 @@ public function addParser($mediaType, Parser $parser) * @param array $data * @param string $mediaType * - * @return \eZ\Publish\API\Repository\Values\ValueObject + * @return \Ibexa\Contracts\Core\Repository\Values\ValueObject */ public function parse(array $data, $mediaType) { diff --git a/src/contracts/Output/Exceptions/InvalidTypeException.php b/src/contracts/Output/Exceptions/InvalidTypeException.php index e96bb1d2..9e0fb1a2 100644 --- a/src/contracts/Output/Exceptions/InvalidTypeException.php +++ b/src/contracts/Output/Exceptions/InvalidTypeException.php @@ -1,7 +1,7 @@ * - * @var \EzSystems\EzPlatformRest\Input\Handler[] + * @var \Ibexa\Contracts\Rest\Input\Handler[] */ protected $handlers = []; /** - * @var \EzSystems\EzPlatformRest\Input\ParsingDispatcher + * @var \Ibexa\Contracts\Rest\Input\ParsingDispatcher */ protected $parsingDispatcher; /** * Construct from optional parsers array. * - * @param \EzSystems\EzPlatformRest\Input\ParsingDispatcher $parsingDispatcher - * @param \EzSystems\EzPlatformRest\Input\Handler[] $handlers + * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher + * @param \Ibexa\Contracts\Rest\Input\Handler[] $handlers */ public function __construct(ParsingDispatcher $parsingDispatcher, array $handlers = []) { @@ -55,7 +55,7 @@ public function __construct(ParsingDispatcher $parsingDispatcher, array $handler * Adds another handler for the given Content Type. * * @param string $type - * @param \EzSystems\EzPlatformRest\Input\Handler $handler + * @param \Ibexa\Contracts\Rest\Input\Handler $handler */ public function addHandler($type, Handler $handler) { @@ -65,7 +65,7 @@ public function addHandler($type, Handler $handler) /** * Parse provided request. * - * @param \EzSystems\EzPlatformRest\Message $message + * @param \Ibexa\Rest\Message $message * * @return mixed */ diff --git a/src/lib/Input/FieldTypeParser.php b/src/lib/Input/FieldTypeParser.php index abeb7bc2..deb27407 100644 --- a/src/lib/Input/FieldTypeParser.php +++ b/src/lib/Input/FieldTypeParser.php @@ -1,43 +1,43 @@ identifier, $contentType2->identifier); } ); } elseif ($sort === 'desc') { usort( $contentTypes, - function (APIContentType $contentType1, APIContentType $contentType2) { + static function (APIContentType $contentType1, APIContentType $contentType2) { return strcasecmp($contentType1->identifier, $contentType2->identifier) * -1; } ); @@ -924,7 +924,7 @@ function (APIContentType $contentType1, APIContentType $contentType2) { if ($sort === 'asc' || $sort === null) { usort( $contentTypes, - function ($timeObj3, $timeObj4) { + static function ($timeObj3, $timeObj4) { $timeObj3 = strtotime($timeObj3->modificationDate->format('Y-m-d H:i:s')); $timeObj4 = strtotime($timeObj4->modificationDate->format('Y-m-d H:i:s')); @@ -934,7 +934,7 @@ function ($timeObj3, $timeObj4) { } elseif ($sort === 'desc') { usort( $contentTypes, - function ($timeObj3, $timeObj4) { + static function ($timeObj3, $timeObj4) { $timeObj3 = strtotime($timeObj3->modificationDate->format('Y-m-d H:i:s')); $timeObj4 = strtotime($timeObj4->modificationDate->format('Y-m-d H:i:s')); diff --git a/src/lib/Server/Controller/JWT.php b/src/lib/Server/Controller/JWT.php index 8cd0a265..f6039cd5 100644 --- a/src/lib/Server/Controller/JWT.php +++ b/src/lib/Server/Controller/JWT.php @@ -1,19 +1,19 @@ inputDispatcher->parse( new Message( ['Content-Type' => $request->headers->get('Content-Type')], diff --git a/src/lib/Server/Controller/Location.php b/src/lib/Server/Controller/Location.php index 0d27dd7d..85547a20 100644 --- a/src/lib/Server/Controller/Location.php +++ b/src/lib/Server/Controller/Location.php @@ -1,22 +1,22 @@ roleService->loadRole($roleId); $roleDraft = $this->roleService->createRoleDraft($loadedRole); - /** @var \eZ\Publish\API\Repository\Values\User\PolicyDraft $policyDraft */ + /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft $policyDraft */ foreach ($roleDraft->getPolicies() as $policyDraft) { $this->roleService->removePolicyByRoleDraft($roleDraft, $policyDraft); } @@ -366,9 +366,9 @@ public function deletePolicies($roleId) * @param $roleId * @param $policyId * - * @throws \EzSystems\EzPlatformRest\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException * - * @return \eZ\Publish\API\Repository\Values\User\Policy + * @return \Ibexa\Contracts\Core\Repository\Values\User\Policy */ public function loadPolicy($roleId, $policyId, Request $request) { @@ -387,7 +387,7 @@ public function loadPolicy($roleId, $policyId, Request $request) * * @param int $roleId ID of a role draft * - * @return \EzSystems\EzPlatformRest\Server\Values\CreatedPolicy + * @return \Ibexa\Rest\Server\Values\CreatedPolicy */ public function addPolicy($roleId, Request $request) { @@ -434,7 +434,7 @@ public function addPolicy($roleId, Request $request) * * @param $role \eZ\Publish\API\Repository\Values\User\Role * - * @return \eZ\Publish\API\Repository\Values\User\Policy + * @return \Ibexa\Contracts\Core\Repository\Values\User\Policy */ private function getLastAddedPolicy($role) { @@ -456,9 +456,9 @@ private function getLastAddedPolicy($role) * @param int $roleId ID of a role draft * @param int $policyId ID of a policy * - * @throws \EzSystems\EzPlatformRest\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException * - * @return \eZ\Publish\API\Repository\Values\User\Policy + * @return \Ibexa\Contracts\Core\Repository\Values\User\Policy */ public function updatePolicy($roleId, $policyId, Request $request) { @@ -521,9 +521,9 @@ public function updatePolicy($roleId, $policyId, Request $request) * @param int $roleId ID of a role draft * @param int $policyId ID of a policy * - * @throws \EzSystems\EzPlatformRest\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException * - * @return \EzSystems\EzPlatformRest\Server\Values\NoContent + * @return \Ibexa\Rest\Server\Values\NoContent */ public function deletePolicy($roleId, $policyId, Request $request) { @@ -569,7 +569,7 @@ public function deletePolicy($roleId, $policyId, Request $request) * * @param $userId * - * @return \EzSystems\EzPlatformRest\Server\Values\RoleAssignmentList + * @return \Ibexa\Rest\Server\Values\RoleAssignmentList */ public function assignRoleToUser($userId, Request $request) { @@ -599,7 +599,7 @@ public function assignRoleToUser($userId, Request $request) * * @param $groupPath * - * @return \EzSystems\EzPlatformRest\Server\Values\RoleAssignmentList + * @return \Ibexa\Rest\Server\Values\RoleAssignmentList */ public function assignRoleToUserGroup($groupPath, Request $request) { @@ -633,7 +633,7 @@ public function assignRoleToUserGroup($groupPath, Request $request) * @param $userId * @param $roleId * - * @return \EzSystems\EzPlatformRest\Server\Values\RoleAssignmentList + * @return \Ibexa\Rest\Server\Values\RoleAssignmentList */ public function unassignRoleFromUser($userId, $roleId) { @@ -656,7 +656,7 @@ public function unassignRoleFromUser($userId, $roleId) * @param $groupPath * @param $roleId * - * @return \EzSystems\EzPlatformRest\Server\Values\RoleAssignmentList + * @return \Ibexa\Rest\Server\Values\RoleAssignmentList */ public function unassignRoleFromUserGroup($groupPath, $roleId) { @@ -680,7 +680,7 @@ public function unassignRoleFromUserGroup($groupPath, $roleId) * * @param $userId * - * @return \EzSystems\EzPlatformRest\Server\Values\RoleAssignmentList + * @return \Ibexa\Rest\Server\Values\RoleAssignmentList */ public function loadRoleAssignmentsForUser($userId) { @@ -696,7 +696,7 @@ public function loadRoleAssignmentsForUser($userId) * * @param $groupPath * - * @return \EzSystems\EzPlatformRest\Server\Values\RoleAssignmentList + * @return \Ibexa\Rest\Server\Values\RoleAssignmentList */ public function loadRoleAssignmentsForUserGroup($groupPath) { @@ -715,9 +715,9 @@ public function loadRoleAssignmentsForUserGroup($groupPath) * @param $userId * @param $roleId * - * @throws \EzSystems\EzPlatformRest\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException * - * @return \EzSystems\EzPlatformRest\Server\Values\RestUserRoleAssignment + * @return \Ibexa\Rest\Server\Values\RestUserRoleAssignment */ public function loadRoleAssignmentForUser($userId, $roleId, Request $request) { @@ -739,9 +739,9 @@ public function loadRoleAssignmentForUser($userId, $roleId, Request $request) * @param $groupPath * @param $roleId * - * @throws \EzSystems\EzPlatformRest\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Rest\Exceptions\NotFoundException * - * @return \EzSystems\EzPlatformRest\Server\Values\RestUserGroupRoleAssignment + * @return \Ibexa\Rest\Server\Values\RestUserGroupRoleAssignment */ public function loadRoleAssignmentForUserGroup($groupPath, $roleId, Request $request) { @@ -762,7 +762,7 @@ public function loadRoleAssignmentForUserGroup($groupPath, $roleId, Request $req /** * Search all policies which are applied to a given user. * - * @return \EzSystems\EzPlatformRest\Server\Values\PolicyList + * @return \Ibexa\Rest\Server\Values\PolicyList */ public function listPoliciesForUser(Request $request) { @@ -785,9 +785,9 @@ public function listPoliciesForUser(Request $request) * * Needed since both structs are encoded into the same media type on input. * - * @param \eZ\Publish\API\Repository\Values\User\RoleCreateStruct $createStruct + * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleCreateStruct $createStruct * - * @return \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct + * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct */ protected function mapToUpdateStruct(RoleCreateStruct $createStruct) { diff --git a/src/lib/Server/Controller/Root.php b/src/lib/Server/Controller/Root.php index f2512d35..3041ade5 100644 --- a/src/lib/Server/Controller/Root.php +++ b/src/lib/Server/Controller/Root.php @@ -1,14 +1,13 @@ fieldTypeParser->parseValue($fieldDefinition->fieldTypeIdentifier, - $fieldData['fieldValue']); + $fieldValue = $this->fieldTypeParser->parseValue( + $fieldDefinition->fieldTypeIdentifier, + $fieldData['fieldValue'] + ); $languageCode = null; if (array_key_exists('languageCode', $fieldData)) { diff --git a/src/lib/Server/Input/Parser/ContentQuery.php b/src/lib/Server/Input/Parser/ContentQuery.php index d14118d0..ced52438 100644 --- a/src/lib/Server/Input/Parser/ContentQuery.php +++ b/src/lib/Server/Input/Parser/ContentQuery.php @@ -1,12 +1,12 @@ Operator::IN, 'EQ' => Operator::EQ, 'GT' => Operator::GT, @@ -33,11 +33,11 @@ class Field extends BaseParser * Parses input structure to a Criterion object. * * @param array $data - * @param \EzSystems\EzPlatformRest\Input\ParsingDispatcher $parsingDispatcher + * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher * - * @throws \EzSystems\EzPlatformRest\Exceptions\Parser + * @throws \Ibexa\Contracts\Rest\Exceptions\Parser * - * @return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Field + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Field */ public function parse(array $data, ParsingDispatcher $parsingDispatcher) { @@ -64,7 +64,7 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher) * * For the full list of supported operators: * - * @see \EzSystems\EzPlatformRest\Server\Input\Parser\Criterion\Field::OPERATORS + * @see \Ibexa\Rest\Server\Input\Parser\Criterion\Field::OPERATORS * * @param string $operatorName operator literal operator name * diff --git a/src/lib/Server/Input/Parser/Criterion/FullText.php b/src/lib/Server/Input/Parser/Criterion/FullText.php index 608fdf6f..afb6b570 100644 --- a/src/lib/Server/Input/Parser/Criterion/FullText.php +++ b/src/lib/Server/Input/Parser/Criterion/FullText.php @@ -1,15 +1,15 @@ valueObject instanceof ApiValues\Content) { - /** @var \eZ\Publish\API\Repository\Values\Content\Content $searchHit->valueObject */ + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $searchHit->valueObject */ $contentInfo = $searchHit->valueObject->contentInfo; try { diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php b/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php index bc8e0065..8a4a126a 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php @@ -1,15 +1,15 @@ content; $generator->startObjectElement('Version'); @@ -60,9 +60,9 @@ public function visit(Visitor $visitor, Generator $generator, $data) /** * Visits a single content field and generates its content. * - * @param \EzSystems\EzPlatformRest\Output\Generator $generator - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * @param \eZ\Publish\API\Repository\Values\Content\Field $field + * @param \Ibexa\Contracts\Rest\Output\Generator $generator + * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ public function visitField(Generator $generator, ContentType $contentType, Field $field) { diff --git a/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php b/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php index ef59ca0e..0d64f7f0 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php +++ b/src/lib/Server/Output/ValueObjectVisitor/VersionInfo.php @@ -1,17 +1,17 @@ startObjectElement('Creator', 'User'); $generator->startAttribute( 'href', - $this->router->generate('ezpublish_rest_loadUser', - ['userId' => $versionInfo->creatorId]) + $this->router->generate( + 'ezpublish_rest_loadUser', + ['userId' => $versionInfo->creatorId] + ) ); $generator->endAttribute('href'); $generator->endObjectElement('Creator'); diff --git a/src/lib/Server/Output/ValueObjectVisitor/VersionList.php b/src/lib/Server/Output/ValueObjectVisitor/VersionList.php index 2889748c..862d97b0 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/VersionList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/VersionList.php @@ -1,13 +1,13 @@ storage = $storage ?: new NativeSessionTokenStorage(); $this->namespace = $this->resolveNamespace($requestStack); @@ -50,7 +50,7 @@ public function hasToken($tokenId) /** * Resolves token namespace. * - * @param RequestStack $requestStack + * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack * * @return string */ diff --git a/src/lib/Server/Security/EventListener/SecurityListener.php b/src/lib/Server/Security/EventListener/SecurityListener.php index 49b83479..73766b3e 100644 --- a/src/lib/Server/Security/EventListener/SecurityListener.php +++ b/src/lib/Server/Security/EventListener/SecurityListener.php @@ -1,15 +1,15 @@ getAcceptableContentTypes() as $mimeType) { - /** @var \EzSystems\EzPlatformRest\Output\Visitor $visitor */ + /** @var \Ibexa\Contracts\Rest\Output\Visitor $visitor */ foreach ($this->mapping as $regexp => $visitor) { if (preg_match($regexp, $mimeType)) { return $visitor->visit($result); diff --git a/src/lib/Value.php b/src/lib/Value.php index ff865641..1850c282 100644 --- a/src/lib/Value.php +++ b/src/lib/Value.php @@ -1,7 +1,7 @@ container->getDefinition('ezpublish_rest.output.visitor.dispatcher')->getMethodCalls(); - return array_map(function ($call) { + return array_map(static function ($call) { return (string) $call[1][1]; }, $calls); } diff --git a/tests/bundle/DependencyInjection/Compiler/ValueObjectVisitorPassTest.php b/tests/bundle/DependencyInjection/Compiler/ValueObjectVisitorPassTest.php index 7d897236..fd0df34b 100644 --- a/tests/bundle/DependencyInjection/Compiler/ValueObjectVisitorPassTest.php +++ b/tests/bundle/DependencyInjection/Compiler/ValueObjectVisitorPassTest.php @@ -1,15 +1,15 @@ expects($this->any()) ->method('isTokenValid') ->willReturnCallback( - function (CsrfToken $token) { + static function (CsrfToken $token) { if ($token == new CsrfToken(self::INTENTION, self::VALID_TOKEN)) { return true; } @@ -195,7 +192,7 @@ function (CsrfToken $token) { } /** - * @return MockObject|RequestEvent + * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpKernel\Event\RequestEvent */ protected function getEvent($class = null) { @@ -228,7 +225,7 @@ protected function getSessionMock() } /** - * @return ParameterBag|MockObject + * @return \Symfony\Component\HttpFoundation\ParameterBag|\PHPUnit\Framework\MockObject\MockObject */ protected function getRequestHeadersMock() { @@ -262,7 +259,7 @@ protected function getRequestHeadersMock() } /** - * @return MockObject|Request + * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpFoundation\Request */ protected function getRequestMock() { @@ -297,7 +294,7 @@ protected function getRequestMock() } /** - * @return MockObject|EventDispatcherInterface + * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\EventDispatcher\EventDispatcherInterface */ protected function getEventDispatcherMock() { @@ -311,7 +308,7 @@ protected function getEventDispatcherMock() /** * @param bool $csrfEnabled * - * @return CsrfListener + * @return \Ibexa\Bundle\Rest\EventListener\CsrfListener */ protected function getEventListener($csrfEnabled = true) { diff --git a/tests/bundle/EventListener/EventListenerTest.php b/tests/bundle/EventListener/EventListenerTest.php index 4b86fa3f..c41cd34f 100644 --- a/tests/bundle/EventListener/EventListenerTest.php +++ b/tests/bundle/EventListener/EventListenerTest.php @@ -1,31 +1,28 @@ createHttpRequest( - 'POST', '/api/ezp/v2/bookmark/' . $locationId + 'POST', + '/api/ezp/v2/bookmark/' . $locationId ); $response = $this->sendHttpRequest($request); @@ -38,7 +39,8 @@ public function testCreateBookmark(): int public function testCreateBookmarkIfAlreadyExists(int $locationId): void { $request = $this->createHttpRequest( - 'POST', '/api/ezp/v2/bookmark/' . $locationId + 'POST', + '/api/ezp/v2/bookmark/' . $locationId ); $response = $this->sendHttpRequest($request); @@ -52,7 +54,8 @@ public function testCreateBookmarkIfAlreadyExists(int $locationId): void public function testIsBookmarked(int $locationId): void { $request = $this->createHttpRequest( - 'HEAD', '/api/ezp/v2/bookmark/' . $locationId + 'HEAD', + '/api/ezp/v2/bookmark/' . $locationId ); $response = $this->sendHttpRequest($request); @@ -65,7 +68,8 @@ public function testIsBookmarkedReturnsNotFound(): void $locationId = 43; $request = $this->createHttpRequest( - 'HEAD', '/api/ezp/v2/bookmark/' . $locationId + 'HEAD', + '/api/ezp/v2/bookmark/' . $locationId ); $response = $this->sendHttpRequest($request); @@ -79,7 +83,8 @@ public function testIsBookmarkedReturnsNotFound(): void public function testDeleteBookmark(int $locationId): void { $request = $this->createHttpRequest( - 'DELETE', '/api/ezp/v2/bookmark/' . $locationId + 'DELETE', + '/api/ezp/v2/bookmark/' . $locationId ); $response = $this->sendHttpRequest($request); @@ -106,7 +111,8 @@ public function testDeleteBookmarkReturnNotFound(): void $locationId = 43; $request = $this->createHttpRequest( - 'DELETE', '/api/ezp/v2/bookmark/' . $locationId + 'DELETE', + '/api/ezp/v2/bookmark/' . $locationId ); $response = $this->sendHttpRequest($request); diff --git a/tests/bundle/Functional/ContentTest.php b/tests/bundle/Functional/ContentTest.php index 5958c0f4..b1fd1d09 100644 --- a/tests/bundle/Functional/ContentTest.php +++ b/tests/bundle/Functional/ContentTest.php @@ -1,7 +1,7 @@ 'POST', 'MOVE' => 'POST', 'PATCH' => 'PATCH', @@ -265,7 +265,7 @@ protected function getMediaFromTypeString($typeString) protected function addCreatedElement($href) { $testCase = $this; - self::$createdContent[$href] = function () use ($href, $testCase) { + self::$createdContent[$href] = static function () use ($href, $testCase) { $testCase->sendHttpRequest( $testCase->createHttpRequest('DELETE', $href) ); diff --git a/tests/bundle/Functional/TrashTest.php b/tests/bundle/Functional/TrashTest.php index 4ef81159..ec402e4f 100644 --- a/tests/bundle/Functional/TrashTest.php +++ b/tests/bundle/Functional/TrashTest.php @@ -1,7 +1,7 @@ $constantName], ['defaultAuthor' => constant("eZ\\Publish\\Core\\FieldType\\Author\\Type::{$constantName}")], @@ -58,7 +58,7 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\AuthorProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\AuthorProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessor/BinaryInputProcessorTest.php b/tests/lib/FieldTypeProcessor/BinaryInputProcessorTest.php index 1b09aba2..d779bb3d 100644 --- a/tests/lib/FieldTypeProcessor/BinaryInputProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/BinaryInputProcessorTest.php @@ -1,7 +1,7 @@ $constantName], ['defaultType' => constant("eZ\\Publish\\Core\\FieldType\\DateAndTime\\Type::{$constantName}")], @@ -59,7 +59,7 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\DateAndTimeProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\DateAndTimeProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessor/DateProcessorTest.php b/tests/lib/FieldTypeProcessor/DateProcessorTest.php index eb918d84..7c183afc 100644 --- a/tests/lib/FieldTypeProcessor/DateProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/DateProcessorTest.php @@ -1,7 +1,7 @@ $constantName], ['defaultType' => constant("eZ\\Publish\\Core\\FieldType\\Date\\Type::{$constantName}")], @@ -58,7 +58,7 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\DateProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\DateProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessor/ImageProcessorTest.php b/tests/lib/FieldTypeProcessor/ImageProcessorTest.php index 57f72a10..8a052e0a 100644 --- a/tests/lib/FieldTypeProcessor/ImageProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/ImageProcessorTest.php @@ -1,18 +1,17 @@ $constantName], ['mediaType' => constant("eZ\\Publish\\Core\\FieldType\\Media\\Type::{$constantName}")], @@ -62,7 +62,7 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\MediaProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\MediaProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php b/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php index 1f21fdc9..fa6730c7 100644 --- a/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/RelationListProcessorTest.php @@ -1,13 +1,13 @@ $constantName], ['selectionMethod' => constant("eZ\\Publish\\Core\\FieldType\\RelationList\\Type::{$constantName}")], @@ -119,7 +119,7 @@ public function testPostProcessValueHash() } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\RelationListProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\RelationListProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessor/RelationProcessorTest.php b/tests/lib/FieldTypeProcessor/RelationProcessorTest.php index f1d28c01..09bdbce2 100644 --- a/tests/lib/FieldTypeProcessor/RelationProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/RelationProcessorTest.php @@ -1,13 +1,13 @@ $constantName], ['selectionMethod' => constant("eZ\\Publish\\Core\\FieldType\\Relation\\Type::{$constantName}")], @@ -128,7 +128,7 @@ public function testPostProcessFieldValueHashNullValue() } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\RelationProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\RelationProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessor/TimeProcessorTest.php b/tests/lib/FieldTypeProcessor/TimeProcessorTest.php index 914704df..a69d91e1 100644 --- a/tests/lib/FieldTypeProcessor/TimeProcessorTest.php +++ b/tests/lib/FieldTypeProcessor/TimeProcessorTest.php @@ -1,7 +1,7 @@ $constantName], ['defaultType' => constant("eZ\\Publish\\Core\\FieldType\\Time\\Type::{$constantName}")], @@ -58,7 +58,7 @@ public function testPostProcessFieldSettingsHash($outputSettings, $inputSettings } /** - * @return \EzSystems\EzPlatformRest\FieldTypeProcessor\TimeProcessor + * @return \Ibexa\Rest\FieldTypeProcessor\TimeProcessor */ protected function getProcessor() { diff --git a/tests/lib/FieldTypeProcessorRegistryTest.php b/tests/lib/FieldTypeProcessorRegistryTest.php index 31fb273f..3ea13662 100644 --- a/tests/lib/FieldTypeProcessorRegistryTest.php +++ b/tests/lib/FieldTypeProcessorRegistryTest.php @@ -1,13 +1,13 @@ method('convert') ->with('Hello world!') ->willReturn( - [ + [ [ 'someKey' => 'someValue', ], diff --git a/tests/lib/Input/FieldTypeParserTest.php b/tests/lib/Input/FieldTypeParserTest.php index 3ae0ad9d..d689cf05 100644 --- a/tests/lib/Input/FieldTypeParserTest.php +++ b/tests/lib/Input/FieldTypeParserTest.php @@ -1,21 +1,21 @@ with('42') ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($contentTypeMock) { + static function () use ($contentTypeMock) { return $contentTypeMock; } ); @@ -92,7 +92,7 @@ function () use ($contentTypeMock) { ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -127,7 +127,7 @@ public function testParseValue() ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -160,7 +160,7 @@ public function testParseValueWithPreProcessing() ->method('getProcessor') ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( - function () use ($processor) { + static function () use ($processor) { return $processor; } ); @@ -176,7 +176,7 @@ function () use ($processor) { ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -205,7 +205,7 @@ public function testParseFieldSettings() ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -238,7 +238,7 @@ public function testParseFieldSettingsWithPreProcessing() ->method('getProcessor') ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( - function () use ($processor) { + static function () use ($processor) { return $processor; } ); @@ -254,7 +254,7 @@ function () use ($processor) { ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -283,7 +283,7 @@ public function testParseValidatorConfiguration() ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -316,7 +316,7 @@ public function testParseValidatorConfigurationWithPreProcessing() ->method('getProcessor') ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( - function () use ($processor) { + static function () use ($processor) { return $processor; } ); @@ -332,7 +332,7 @@ function () use ($processor) { ->with($this->equalTo('some-fancy-field-type')) ->willReturnCallback( // Avoid PHPUnit cloning - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); diff --git a/tests/lib/Input/Handler/JsonTest.php b/tests/lib/Input/Handler/JsonTest.php index 732bdd2e..6ca12abb 100644 --- a/tests/lib/Input/Handler/JsonTest.php +++ b/tests/lib/Input/Handler/JsonTest.php @@ -1,13 +1,13 @@ expectException(\EzSystems\EzPlatformRest\Exceptions\Parser::class); + $this->expectException(\Ibexa\Contracts\Rest\Exceptions\Parser::class); $dispatcher = new ParsingDispatcher(); @@ -96,7 +96,7 @@ public function testParseStripFormat() } /** - * @return \EzSystems\EzPlatformRest\Input\Parser|\PHPUnit\Framework\MockObject\MockObject + * @return \Ibexa\Contracts\Rest\Input\Parser|\PHPUnit\Framework\MockObject\MockObject */ private function createParserMock() { diff --git a/tests/lib/MessageTest.php b/tests/lib/MessageTest.php index a381fb31..ec5a5bc7 100644 --- a/tests/lib/MessageTest.php +++ b/tests/lib/MessageTest.php @@ -1,7 +1,7 @@ method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -100,11 +100,11 @@ public function testSerializeFieldValueWithProcessor() ->with( $this->equalTo('some-field') )->willReturn( - new FieldDefinition( - [ + new FieldDefinition( + [ 'fieldTypeIdentifier' => 'myFancyFieldType', ] - ) + ) ); $processorMock = $this->getFieldTypeProcessorMock(); @@ -118,7 +118,7 @@ public function testSerializeFieldValueWithProcessor() ->method('getProcessor') ->with('myFancyFieldType') ->willReturnCallback( - function () use ($processorMock) { + static function () use ($processorMock) { return $processorMock; } ); @@ -132,7 +132,7 @@ function () use ($processorMock) { ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -173,7 +173,7 @@ public function testSerializeFieldDefaultValue() ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -206,7 +206,7 @@ public function testSerializeFieldSettings() ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -239,7 +239,7 @@ public function testSerializeFieldSettingsWithPostProcessing() ->method('getProcessor') ->with('myFancyFieldType') ->willReturnCallback( - function () use ($processorMock) { + static function () use ($processorMock) { return $processorMock; } ); @@ -259,7 +259,7 @@ function () use ($processorMock) { ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -292,7 +292,7 @@ public function testSerializeValidatorConfiguration() ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -325,7 +325,7 @@ public function testSerializeValidatorConfigurationWithPostProcessing() ->method('getProcessor') ->with('myFancyFieldType') ->willReturnCallback( - function () use ($processorMock) { + static function () use ($processorMock) { return $processorMock; } ); @@ -339,7 +339,7 @@ function () use ($processorMock) { ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); @@ -355,7 +355,7 @@ function () use ($fieldTypeMock) { ->method('getFieldType') ->with($this->equalTo('myFancyFieldType')) ->willReturnCallback( - function () use ($fieldTypeMock) { + static function () use ($fieldTypeMock) { return $fieldTypeMock; } ); diff --git a/tests/lib/Output/Generator/FieldTypeHashGeneratorBaseTest.php b/tests/lib/Output/Generator/FieldTypeHashGeneratorBaseTest.php index 11a9cdc6..d045d1e9 100644 --- a/tests/lib/Output/Generator/FieldTypeHashGeneratorBaseTest.php +++ b/tests/lib/Output/Generator/FieldTypeHashGeneratorBaseTest.php @@ -1,7 +1,7 @@ getGeneratorMock(); $valueObjectDispatcherMock = $this->getValueObjectDispatcherMock(); @@ -119,7 +119,7 @@ public function testSetHeaders() /** * @todo This is a test for a feature that needs refactoring. * - * @see \EzSystems\EzPlatformRest\Output\Visitor::visit + * @see \Ibexa\Contracts\Rest\Output\Visitor::visit */ public function testSetFilteredHeaders() { @@ -217,7 +217,7 @@ public function testSetStatusCodeNoOverride() } /** - * @return Common\Output\ValueObjectVisitorDispatcher|\PHPUnit\Framework\MockObject\MockObject + * @return \Ibexa\Contracts\Rest\Output\ValueObjectVisitorDispatcher|\PHPUnit\Framework\MockObject\MockObject */ public function getValueObjectDispatcherMock() { diff --git a/tests/lib/Server/BaseTest.php b/tests/lib/Server/BaseTest.php index 74688490..1704b68f 100644 --- a/tests/lib/Server/BaseTest.php +++ b/tests/lib/Server/BaseTest.php @@ -1,7 +1,7 @@ requestParserMock)) { $that = &$this; - $callback = function ($href, $attribute) use ($that) { + $callback = static function ($href, $attribute) use ($that) { foreach ($that->getParseHrefExpectationsMap() as $map) { if ($map[0] == $href && $map[1] == $attribute) { if ($map[2] instanceof \Exception) { @@ -96,7 +96,7 @@ protected function getRequestParserMock() /** * Get the parser tools. * - * @return \EzSystems\EzPlatformRest\Input\ParserTools + * @return \Ibexa\Rest\Input\ParserTools */ protected function getParserTools() { @@ -118,7 +118,7 @@ protected function getParser() /** * Must return the tested parser object. * - * @return \EzSystems\EzPlatformRest\Server\Input\Parser\Base + * @return \Ibexa\Rest\Server\Input\Parser\Base */ abstract protected function internalGetParser(); } diff --git a/tests/lib/Server/Input/Parser/ContentCreateTest.php b/tests/lib/Server/Input/Parser/ContentCreateTest.php index 1c412efa..3b400765 100644 --- a/tests/lib/Server/Input/Parser/ContentCreateTest.php +++ b/tests/lib/Server/Input/Parser/ContentCreateTest.php @@ -1,23 +1,23 @@ equalTo('eng-US') ) ->willReturn( - new ContentCreateStruct( - [ + new ContentCreateStruct( + [ 'contentType' => $contentType, 'mainLanguageCode' => 'eng-US', ] - ) + ) ); return $contentServiceMock; @@ -581,7 +581,7 @@ protected function getContentServiceMock() /** * Get the content type service mock object. * - * @return \eZ\Publish\API\Repository\ContentTypeService + * @return \Ibexa\Contracts\Core\Repository\ContentTypeService */ protected function getContentTypeServiceMock() { @@ -607,7 +607,7 @@ public function getParseHrefExpectationsMap() /** * Get the content type used in ContentCreate parser. * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ protected function getContentType() { diff --git a/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php b/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php index 7d7ddbaa..93c65929 100644 --- a/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php +++ b/tests/lib/Server/Input/Parser/ContentObjectStatesTest.php @@ -1,7 +1,7 @@ method('newContentTypeCreateStruct') ->with($this->equalTo('new_content_type')) ->willReturn( - new ContentTypeCreateStruct( - [ + new ContentTypeCreateStruct( + [ 'identifier' => 'new_content_type', ] - ) + ) ); return $contentTypeServiceMock; diff --git a/tests/lib/Server/Input/Parser/ContentTypeGroupInputTest.php b/tests/lib/Server/Input/Parser/ContentTypeGroupInputTest.php index 661cb28a..1f2bac97 100644 --- a/tests/lib/Server/Input/Parser/ContentTypeGroupInputTest.php +++ b/tests/lib/Server/Input/Parser/ContentTypeGroupInputTest.php @@ -1,15 +1,15 @@ createMock(Content\Query\Criterion::class, [], [], '', false); - $parserMock = $this->createMock(\EzSystems\EzPlatformRest\Input\Parser::class); + $parserMock = $this->createMock(\Ibexa\Contracts\Rest\Input\Parser::class); $parserMock->method('parse')->willReturn($criterionMock); $result = $this->internalGetParser()->parse($logicalAndParsedFromXml, new ParsingDispatcher([ diff --git a/tests/lib/Server/Input/Parser/Criterion/LogicalOrTest.php b/tests/lib/Server/Input/Parser/Criterion/LogicalOrTest.php index c61e90a5..b6f0c049 100644 --- a/tests/lib/Server/Input/Parser/Criterion/LogicalOrTest.php +++ b/tests/lib/Server/Input/Parser/Criterion/LogicalOrTest.php @@ -1,14 +1,14 @@ createMock(Content\Query\Criterion::class, [], [], '', false); - $parserMock = $this->createMock(\EzSystems\EzPlatformRest\Input\Parser::class); + $parserMock = $this->createMock(\Ibexa\Contracts\Rest\Input\Parser::class); $parserMock->method('parse')->willReturn($criterionMock); $result = $this->internalGetParser()->parse($logicalOrParsedFromXml, new ParsingDispatcher([ diff --git a/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php b/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php index 136acd06..05c7ba70 100644 --- a/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php +++ b/tests/lib/Server/Input/Parser/Criterion/SiblingTest.php @@ -1,17 +1,17 @@ method('newFieldDefinitionCreateStruct') ->with($this->equalTo('title'), $this->equalTo('ezstring')) ->willReturn( - new FieldDefinitionCreateStruct( - [ + new FieldDefinitionCreateStruct( + [ 'identifier' => 'title', 'fieldTypeIdentifier' => 'ezstring', ] - ) + ) ); return $contentTypeServiceMock; diff --git a/tests/lib/Server/Input/Parser/FieldDefinitionUpdateTest.php b/tests/lib/Server/Input/Parser/FieldDefinitionUpdateTest.php index 2ff7e0ce..d7472186 100644 --- a/tests/lib/Server/Input/Parser/FieldDefinitionUpdateTest.php +++ b/tests/lib/Server/Input/Parser/FieldDefinitionUpdateTest.php @@ -1,20 +1,20 @@ expects($this->any()) ->method('newFieldDefinitionUpdateStruct') ->willReturn( - new FieldDefinitionUpdateStruct() + new FieldDefinitionUpdateStruct() ); $contentTypeServiceMock->expects($this->any()) ->method('loadContentTypeDraft') ->with($this->equalTo(42)) ->willReturn( - new ContentTypeDraft( - [ + new ContentTypeDraft( + [ 'innerContentType' => new ContentType([ 'fieldDefinitions' => new FieldDefinitionCollection([ new FieldDefinition( @@ -216,7 +216,7 @@ protected function getContentTypeServiceMock() ]), ]), ] - ) + ) ); return $contentTypeServiceMock; diff --git a/tests/lib/Server/Input/Parser/JWTInputTest.php b/tests/lib/Server/Input/Parser/JWTInputTest.php index a784c654..988bfe4c 100644 --- a/tests/lib/Server/Input/Parser/JWTInputTest.php +++ b/tests/lib/Server/Input/Parser/JWTInputTest.php @@ -1,7 +1,7 @@ equalTo($contentType) ) ->willReturn( - new UserCreateStruct( - [ + new UserCreateStruct( + [ 'contentType' => $contentType, 'mainLanguageCode' => 'eng-US', ] - ) + ) ); return $userServiceMock; @@ -498,7 +498,7 @@ protected function getUserServiceMock() /** * Get the content type service mock object. * - * @return \eZ\Publish\API\Repository\ContentTypeService + * @return \Ibexa\Contracts\Core\Repository\ContentTypeService */ protected function getContentTypeServiceMock() { @@ -515,7 +515,7 @@ protected function getContentTypeServiceMock() /** * Get the content type used in UserCreate parser. * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ protected function getContentType() { diff --git a/tests/lib/Server/Input/Parser/UserGroupCreateTest.php b/tests/lib/Server/Input/Parser/UserGroupCreateTest.php index 4ac2ca42..4a158aaf 100644 --- a/tests/lib/Server/Input/Parser/UserGroupCreateTest.php +++ b/tests/lib/Server/Input/Parser/UserGroupCreateTest.php @@ -1,22 +1,22 @@ assertInstanceOf( - \eZ\Publish\API\Repository\Values\ContentType\ContentType::class, + \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType::class, $result->contentType, 'contentType not created correctly.' ); @@ -294,7 +294,7 @@ public function testParseExceptionOnMissingFieldValue() /** * Returns the UserGroupCreate parser. * - * @return \EzSystems\EzPlatformRest\Server\Input\Parser\UserGroupCreate + * @return \Ibexa\Rest\Server\Input\Parser\UserGroupCreate */ protected function internalGetParser() { @@ -308,7 +308,7 @@ protected function internalGetParser() /** * Get the field type parser mock object. * - * @return \EzSystems\EzPlatformRest\Input\FieldTypeParser ; + * @return \Ibexa\Rest\Input\FieldTypeParser ; */ private function getFieldTypeParserMock() { @@ -335,7 +335,7 @@ private function getFieldTypeParserMock() /** * Get the user service mock object. * - * @return \eZ\Publish\API\Repository\UserService + * @return \Ibexa\Contracts\Core\Repository\UserService */ protected function getUserServiceMock() { @@ -349,12 +349,12 @@ protected function getUserServiceMock() $this->equalTo($contentType) ) ->willReturn( - new UserGroupCreateStruct( - [ + new UserGroupCreateStruct( + [ 'contentType' => $contentType, 'mainLanguageCode' => 'eng-US', ] - ) + ) ); return $userServiceMock; @@ -363,7 +363,7 @@ protected function getUserServiceMock() /** * Get the content type service mock object. * - * @return \eZ\Publish\API\Repository\ContentTypeService + * @return \Ibexa\Contracts\Core\Repository\ContentTypeService */ protected function getContentTypeServiceMock() { @@ -380,7 +380,7 @@ protected function getContentTypeServiceMock() /** * Get the content type used in UserGroupCreate parser. * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ protected function getContentType() { diff --git a/tests/lib/Server/Input/Parser/UserGroupUpdateTest.php b/tests/lib/Server/Input/Parser/UserGroupUpdateTest.php index 26a03841..7e1b0302 100644 --- a/tests/lib/Server/Input/Parser/UserGroupUpdateTest.php +++ b/tests/lib/Server/Input/Parser/UserGroupUpdateTest.php @@ -1,25 +1,25 @@ method('loadLocation') ->with($this->equalTo(5)) ->willReturn( - new Location( - [ + new Location( + [ 'contentInfo' => new ContentInfo( [ 'id' => 4, ] ), ] - ) + ) ); return $userServiceMock; @@ -284,7 +284,7 @@ protected function getLocationServiceMock() /** * Get the content service mock object. * - * @return \eZ\Publish\API\Repository\ContentService + * @return \Ibexa\Contracts\Core\Repository\ContentService */ protected function getContentServiceMock() { diff --git a/tests/lib/Server/Input/Parser/UserUpdateTest.php b/tests/lib/Server/Input/Parser/UserUpdateTest.php index 20a64ca4..0b9e2c87 100644 --- a/tests/lib/Server/Input/Parser/UserUpdateTest.php +++ b/tests/lib/Server/Input/Parser/UserUpdateTest.php @@ -1,22 +1,22 @@ expects($this->any()) ->method('hasParameter') ->willReturnCallback( - function ($parameterName) use ($options) { - return isset($options[$parameterName]); - } + static function ($parameterName) use ($options) { + return isset($options[$parameterName]); + } ); $mock ->expects($this->any()) ->method('getParameter') ->willReturnCallback( - function ($parameterName, $defaultValue) use ($options) { - return isset($options[$parameterName]) ? $options[$parameterName] : $defaultValue; - } + static function ($parameterName, $defaultValue) use ($options) { + return isset($options[$parameterName]) ? $options[$parameterName] : $defaultValue; + } ); return $mock; diff --git a/tests/lib/Server/Output/ValueObjectVisitor/ConflictTest.php b/tests/lib/Server/Output/ValueObjectVisitor/ConflictTest.php index 969860a4..8bd66f20 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/ConflictTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/ConflictTest.php @@ -1,14 +1,14 @@ getVisitorMock()->expects($this->exactly(2)) ->method('visitValueObject') - ->with($this->isInstanceOf(\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup::class)); + ->with($this->isInstanceOf(\Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup::class)); $visitor->visit( $this->getVisitorMock(), @@ -115,7 +115,7 @@ public function testObjectStateGroupListVisitsChildren() /** * Get the ObjectStateGroupList visitor. * - * @return \EzSystems\EzPlatformRest\Server\Output\ValueObjectVisitor\ObjectStateGroupList + * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\ObjectStateGroupList */ protected function internalGetVisitor() { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupTest.php b/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupTest.php index dd2eca73..e5a23cb0 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/ObjectStateGroupTest.php @@ -1,14 +1,14 @@ getVisitorMock()->expects($this->exactly(2)) ->method('setHeader') ->willReturnMap( - ['Allow', 'GET,POST'], - ['Content-Length', 0] + ['Allow', 'GET,POST'], + ['Content-Length', 0] ); $visitor->visit( @@ -47,7 +47,7 @@ public function testVisit() /** * Get the NoContent visitor. * - * @return \EzSystems\EzPlatformRest\Server\Output\ValueObjectVisitor\NoContent + * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\NoContent */ protected function internalGetVisitor() { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/PermanentRedirectTest.php b/tests/lib/Server/Output/ValueObjectVisitor/PermanentRedirectTest.php index 5cea179c..a4e95238 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/PermanentRedirectTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/PermanentRedirectTest.php @@ -1,14 +1,14 @@ startDocument(null); - $contentTypeLimitation = new \eZ\Publish\API\Repository\Values\User\Limitation\ContentTypeLimitation(); + $contentTypeLimitation = new \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation(); $contentTypeLimitation->limitationValues = [1, 2, 3]; $policy = new User\Policy( @@ -205,7 +205,7 @@ public function testResultContainsLimitationsAttributes($result) /** * Get the Policy visitor. * - * @return \EzSystems\EzPlatformRest\Server\Output\ValueObjectVisitor\Policy + * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\Policy */ protected function internalGetVisitor() { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RelationListTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RelationListTest.php index 1835b186..245db68d 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RelationListTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RelationListTest.php @@ -1,16 +1,16 @@ translationHelper = $this->createMock(TranslationHelper::class); $this->translationHelper ->method('getTranslatedContentNameByContentInfo') - ->willReturnCallback(function (ContentInfo $content) { + ->willReturnCallback(static function (ContentInfo $content) { return $content->name . ' (Translated)'; }); } @@ -515,7 +515,7 @@ public function testEmbeddedCurrentVersionMediaTypeCorrect(\DOMDocument $dom) /** * Get the Content visitor. * - * @return \EzSystems\EzPlatformRest\Server\Output\ValueObjectVisitor\RestContent + * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestContent */ protected function internalGetVisitor() { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestContentTypeTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestContentTypeTest.php index c439d10f..5fe18c15 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestContentTypeTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestContentTypeTest.php @@ -1,16 +1,16 @@ getVisitorMock()->expects($this->exactly(2)) ->method('visitValueObject') - ->with($this->isInstanceOf(\eZ\Publish\API\Repository\Values\Content\VersionInfo::class)); + ->with($this->isInstanceOf(\Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo::class)); $visitor->visit( $this->getVisitorMock(), @@ -148,7 +148,7 @@ public function testVersionListVisitsChildren() /** * Get the VersionList visitor. * - * @return \EzSystems\EzPlatformRest\Server\Output\ValueObjectVisitor\VersionList + * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\VersionList */ protected function internalGetVisitor() { diff --git a/tests/lib/Server/Output/ValueObjectVisitor/VersionTest.php b/tests/lib/Server/Output/ValueObjectVisitor/VersionTest.php index cb9e6107..ae4cb635 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/VersionTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/VersionTest.php @@ -1,20 +1,20 @@