diff --git a/.github/ci/files/config/dao-classmap.php b/.github/ci/files/config/dao-classmap.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/bundles/AdminBundle/src/Controller/Admin/Asset/AssetController.php b/bundles/AdminBundle/src/Controller/Admin/Asset/AssetController.php index a3029b55d87..392a6473d09 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Asset/AssetController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Asset/AssetController.php @@ -926,7 +926,7 @@ public function updateAction(Request $request): JsonResponse /** * @Route("/webdav{path}", name="pimcore_admin_webdav", requirements={"path"=".*"}) */ - public function webdavAction() + public function webdavAction(): void { $homeDir = Asset::getById(1); @@ -1593,7 +1593,7 @@ public function getDocumentThumbnailAction(Request $request): BinaryFileResponse return $response; } - protected function addThumbnailCacheHeaders(Response $response) + protected function addThumbnailCacheHeaders(Response $response): void { $lifetime = 300; $date = new \DateTime('now'); @@ -2475,7 +2475,7 @@ public function importServerFilesAction(Request $request): JsonResponse ]); } - protected function checkForPharStreamWrapper($path) + protected function checkForPharStreamWrapper(string $path): void { if (stripos($path, 'phar://') !== false) { throw $this->createAccessDeniedException('Using PHAR files is not allowed!'); @@ -2815,7 +2815,7 @@ public function deleteImageFeaturesAction(Request $request): JsonResponse throw $this->createAccessDeniedHttpException(); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/Asset/AssetHelperController.php b/bundles/AdminBundle/src/Controller/Admin/Asset/AssetHelperController.php index 59a0a5a7a38..aafc2a6a997 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Asset/AssetHelperController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Asset/AssetHelperController.php @@ -573,7 +573,7 @@ public function gridSaveColumnConfigAction(Request $request): JsonResponse * * @throws \Exception */ - protected function updateGridConfigShares(?GridConfig $gridConfig, array $metadata) + protected function updateGridConfigShares(?GridConfig $gridConfig, array $metadata): void { $user = $this->getAdminUser(); if (!$gridConfig || !$user->isAllowed('share_configurations')) { @@ -614,7 +614,7 @@ protected function updateGridConfigShares(?GridConfig $gridConfig, array $metada * * @throws \Exception */ - protected function updateGridConfigFavourites(?GridConfig $gridConfig, array $metadata) + protected function updateGridConfigFavourites(?GridConfig $gridConfig, array $metadata): void { $currentUser = $this->getAdminUser(); diff --git a/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassController.php b/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassController.php index d7224b0b284..6e8fc7bc0ce 100644 --- a/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassController.php +++ b/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassController.php @@ -1822,7 +1822,7 @@ public function doBulkExportAction(Request $request): Response return $response; } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassificationstoreController.php b/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassificationstoreController.php index c84efa5bc26..ccfcd0e2bd5 100644 --- a/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassificationstoreController.php +++ b/bundles/AdminBundle/src/Controller/Admin/DataObject/ClassificationstoreController.php @@ -1568,7 +1568,7 @@ public function getPageAction(Request $request): JsonResponse return $this->adminJson(['success' => true, 'page' => $page]); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectController.php b/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectController.php index 369436fa9a3..3aa194be3e9 100644 --- a/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectController.php +++ b/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectController.php @@ -1369,7 +1369,7 @@ private function executeInsideTransaction(callable $fn): void } } - protected function reindexBasedOnSortOrder(DataObject\AbstractObject $parentObject, string $currentSortOrder) + protected function reindexBasedOnSortOrder(DataObject\AbstractObject $parentObject, string $currentSortOrder): void { $fn = function () use ($parentObject, $currentSortOrder) { $list = new DataObject\Listing(); @@ -1703,7 +1703,7 @@ public function saveFolderAction(Request $request): JsonResponse throw $this->createAccessDeniedHttpException(); } - protected function assignPropertiesFromEditmode(Request $request, DataObject\AbstractObject $object) + protected function assignPropertiesFromEditmode(Request $request, DataObject\AbstractObject $object): void { if ($request->get('properties')) { $properties = []; @@ -2159,7 +2159,7 @@ public function previewAction(Request $request): RedirectResponse|Response } } - protected function processRemoteOwnerRelations(DataObject\Concrete $object, array $toDelete, array $toAdd, string $ownerFieldName) + protected function processRemoteOwnerRelations(DataObject\Concrete $object, array $toDelete, array $toAdd, string $ownerFieldName): void { $getter = 'get' . ucfirst($ownerFieldName); $setter = 'set' . ucfirst($ownerFieldName); @@ -2241,7 +2241,7 @@ protected function detectAddedRemoteOwnerRelations(array $relations, array $valu return $diff; } - protected function getLatestVersion(DataObject\Concrete $object, &$draftVersion = null): DataObject\Concrete + protected function getLatestVersion(DataObject\Concrete $object, ?DataObject\Concrete &$draftVersion = null): DataObject\Concrete { $latestVersion = $object->getLatestVersion($this->getAdminUser()->getId()); if ($latestVersion) { @@ -2256,7 +2256,7 @@ protected function getLatestVersion(DataObject\Concrete $object, &$draftVersion return $object; } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectHelperController.php b/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectHelperController.php index 2652609409f..543903599b5 100644 --- a/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectHelperController.php +++ b/bundles/AdminBundle/src/Controller/Admin/DataObject/DataObjectHelperController.php @@ -640,7 +640,7 @@ public function getDefaultGridFields(bool $noSystemColumns, ?DataObject\ClassDef * @param int $objectId * @param array|null $context */ - protected function appendBrickFields(DataObject\ClassDefinition\Data $field, array $brickFields, array &$availableFields, string $gridType, int &$count, string $brickType, DataObject\ClassDefinition $class, int $objectId, array $context = null) + protected function appendBrickFields(DataObject\ClassDefinition\Data $field, array $brickFields, array &$availableFields, string $gridType, int &$count, string $brickType, DataObject\ClassDefinition $class, int $objectId, array $context = null): void { if (!empty($brickFields)) { foreach ($brickFields as $bf) { @@ -970,7 +970,7 @@ public function gridSaveColumnConfigAction(Request $request): JsonResponse * * @throws \Exception */ - protected function updateGridConfigShares(?GridConfig $gridConfig, array $metadata) + protected function updateGridConfigShares(?GridConfig $gridConfig, array $metadata): void { $user = $this->getAdminUser(); if (!$gridConfig || !$user->isAllowed('share_configurations')) { @@ -1012,7 +1012,7 @@ protected function updateGridConfigShares(?GridConfig $gridConfig, array $metada * * @throws \Exception */ - protected function updateGridConfigFavourites(?GridConfig $gridConfig, array $metadata, int $objectId) + protected function updateGridConfigFavourites(?GridConfig $gridConfig, array $metadata, int $objectId): void { $currentUser = $this->getAdminUser(); @@ -1220,36 +1220,6 @@ public function importUploadAction(Request $request): JsonResponse return $response; } - private function getDataPreview($originalFile, $dialect): array - { - $count = 0; - $data = []; - if (($handle = fopen($originalFile, 'r')) !== false) { - while (($rowData = fgetcsv($handle, 0, $dialect->delimiter, $dialect->quotechar, $dialect->escapechar)) !== false) { - $tmpData = []; - - foreach ($rowData as $key => $value) { - $tmpData['field_' . $key] = $value; - } - - $tmpData['rowId'] = $count + 1; - $data[] = $tmpData; - - $count++; - - /** - * Reached the number or rows for the preview - */ - if ($count > 18) { - break; - } - } - fclose($handle); - } - - return $data; - } - protected function extractLanguage(Request $request): string { $requestedLanguage = $request->get('language'); @@ -1808,7 +1778,7 @@ public function getAvailableVisibleFieldsAction(Request $request): JsonResponse * @param bool $firstOne * @param DataObject\ClassDefinition\Data[] $commonFields */ - protected function processAvailableFieldDefinitions(array $fds, bool &$firstOne, array &$commonFields) + protected function processAvailableFieldDefinitions(array $fds, bool &$firstOne, array &$commonFields): void { foreach ($fds as $fd) { if ($fd instanceof DataObject\ClassDefinition\Data\Fieldcollections || $fd instanceof DataObject\ClassDefinition\Data\Objectbricks diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/DocumentController.php b/bundles/AdminBundle/src/Controller/Admin/Document/DocumentController.php index 19158d248dd..b0f96ec9149 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/DocumentController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/DocumentController.php @@ -1517,7 +1517,7 @@ private function getSeoNodeConfig(Document $document): array return $nodeConfig; } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/DocumentControllerBase.php b/bundles/AdminBundle/src/Controller/Admin/Document/DocumentControllerBase.php index 0c12525f1ac..b7b2b6a0780 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/DocumentControllerBase.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/DocumentControllerBase.php @@ -106,7 +106,7 @@ protected function preSendDataActions(array &$data, Model\Document $document, ?V throw $this->createAccessDeniedHttpException(); } - protected function addPropertiesToDocument(Request $request, Model\Document $document) + protected function addPropertiesToDocument(Request $request, Model\Document $document): void { // properties if ($request->get('properties')) { @@ -339,9 +339,9 @@ public function onKernelControllerEvent(ControllerEvent $event): void $this->checkPermission('documents'); } - abstract protected function setValuesToDocument(Request $request, Model\Document $page); + abstract protected function setValuesToDocument(Request $request, Model\Document $document): void; - protected function handleTask(string $task, Model\Document\PageSnippet $page) + protected function handleTask(string $task, Model\Document\PageSnippet $page): void { if ($task === self::TASK_PUBLISH || $task === self::TASK_VERSION) { $page->deleteAutoSaveVersions($this->getAdminUser()->getId()); @@ -368,7 +368,7 @@ protected function checkForLock(Model\Document $document): JsonResponse|bool * @throws Element\ValidationException * @throws \Exception */ - protected function saveDocument(Model\Document $document, Request $request, bool $latestVersion = false, $task = null): array + protected function saveDocument(Model\Document $document, Request $request, bool $latestVersion = false, ?string $task = null): array { if ($latestVersion && $document instanceof Model\Document\PageSnippet) { $document = $this->getLatestVersion($document); diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/EmailController.php b/bundles/AdminBundle/src/Controller/Admin/Document/EmailController.php index 8a0b2cd7932..c51932d2ba8 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/EmailController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/EmailController.php @@ -118,11 +118,11 @@ public function saveAction(Request $request): JsonResponse } } - protected function setValuesToDocument(Request $request, Document $page): void + protected function setValuesToDocument(Request $request, Document $document): void { - $this->addSettingsToDocument($request, $page); - $this->addDataToDocument($request, $page); - $this->addPropertiesToDocument($request, $page); - $this->applySchedulerDataToElement($request, $page); + $this->addSettingsToDocument($request, $document); + $this->addDataToDocument($request, $document); + $this->addPropertiesToDocument($request, $document); + $this->applySchedulerDataToElement($request, $document); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/FolderController.php b/bundles/AdminBundle/src/Controller/Admin/Document/FolderController.php index 0050d7e8f7b..6d790d82a9c 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/FolderController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/FolderController.php @@ -81,8 +81,8 @@ public function saveAction(Request $request): JsonResponse return $this->adminJson(['success' => true, 'treeData' => $treeData]); } - protected function setValuesToDocument(Request $request, Document $folder) + protected function setValuesToDocument(Request $request, Document $document): void { - $this->addPropertiesToDocument($request, $folder); + $this->addPropertiesToDocument($request, $document); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/HardlinkController.php b/bundles/AdminBundle/src/Controller/Admin/Document/HardlinkController.php index b599755e39c..5b2abfbcac6 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/HardlinkController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/HardlinkController.php @@ -106,9 +106,9 @@ public function saveAction(Request $request): JsonResponse /** * @param Request $request - * @param Document\Hardlink $link + * @param Document\Hardlink $document */ - protected function setValuesToDocument(Request $request, Document $link) + protected function setValuesToDocument(Request $request, Document $document): void { // data if ($request->get('data')) { @@ -118,11 +118,11 @@ protected function setValuesToDocument(Request $request, Document $link) if ($sourceDocument = Document::getByPath($data['sourcePath'])) { $sourceId = $sourceDocument->getId(); } - $link->setSourceId($sourceId); - $link->setValues($data); + $document->setSourceId($sourceId); + $document->setValues($data); } - $this->addPropertiesToDocument($request, $link); - $this->applySchedulerDataToElement($request, $link); + $this->addPropertiesToDocument($request, $document); + $this->applySchedulerDataToElement($request, $document); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/LinkController.php b/bundles/AdminBundle/src/Controller/Admin/Document/LinkController.php index d24fab2af48..277abf80cf9 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/LinkController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/LinkController.php @@ -111,9 +111,9 @@ public function saveAction(Request $request): JsonResponse /** * @param Request $request - * @param Document\Link $link + * @param Document\Link $document */ - protected function setValuesToDocument(Request $request, Document $link) + protected function setValuesToDocument(Request $request, Document $document): void { // data if ($request->get('data')) { @@ -163,10 +163,10 @@ protected function setValuesToDocument(Request $request, Document $link) unset($data['path']); - $link->setValues($data); + $document->setValues($data); } - $this->addPropertiesToDocument($request, $link); - $this->applySchedulerDataToElement($request, $link); + $this->addPropertiesToDocument($request, $document); + $this->applySchedulerDataToElement($request, $document); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/NewsletterController.php b/bundles/AdminBundle/src/Controller/Admin/Document/NewsletterController.php index f3168604618..902c1b750db 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/NewsletterController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/NewsletterController.php @@ -130,16 +130,16 @@ public function saveAction(Request $request): JsonResponse } } - protected function setValuesToDocument(Request $request, Document $page) + protected function setValuesToDocument(Request $request, Document $document): void { - $this->addSettingsToDocument($request, $page); - $this->addDataToDocument($request, $page); - $this->addPropertiesToDocument($request, $page); + $this->addSettingsToDocument($request, $document); + $this->addDataToDocument($request, $document); + $this->addPropertiesToDocument($request, $document); // plaintext if ($request->get('plaintext')) { $plaintext = $this->decodeJson($request->get('plaintext')); - $page->setValues($plaintext); + $document->setValues($plaintext); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/PageController.php b/bundles/AdminBundle/src/Controller/Admin/Document/PageController.php index dfe13e49a01..dc86215b49d 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/PageController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/PageController.php @@ -446,11 +446,11 @@ public function areabrickRenderIndexEditmode( ]); } - protected function setValuesToDocument(Request $request, Document $page) + protected function setValuesToDocument(Request $request, Document $document): void { - $this->addSettingsToDocument($request, $page); - $this->addDataToDocument($request, $page); - $this->addPropertiesToDocument($request, $page); - $this->applySchedulerDataToElement($request, $page); + $this->addSettingsToDocument($request, $document); + $this->addDataToDocument($request, $document); + $this->addPropertiesToDocument($request, $document); + $this->applySchedulerDataToElement($request, $document); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/PrintpageControllerBase.php b/bundles/AdminBundle/src/Controller/Admin/Document/PrintpageControllerBase.php index af19da6ada4..cb86b042e22 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/PrintpageControllerBase.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/PrintpageControllerBase.php @@ -138,11 +138,11 @@ public function saveAction(Request $request): JsonResponse } } - protected function setValuesToDocument(Request $request, Document $page): void + protected function setValuesToDocument(Request $request, Document $document): void { - $this->addSettingsToDocument($request, $page); - $this->addDataToDocument($request, $page); - $this->addPropertiesToDocument($request, $page); + $this->addSettingsToDocument($request, $document); + $this->addDataToDocument($request, $document); + $this->addPropertiesToDocument($request, $document); } /** diff --git a/bundles/AdminBundle/src/Controller/Admin/Document/SnippetController.php b/bundles/AdminBundle/src/Controller/Admin/Document/SnippetController.php index d2b8784f409..cac78d3a7db 100644 --- a/bundles/AdminBundle/src/Controller/Admin/Document/SnippetController.php +++ b/bundles/AdminBundle/src/Controller/Admin/Document/SnippetController.php @@ -144,11 +144,11 @@ public function saveAction(Request $request): JsonResponse } } - protected function setValuesToDocument(Request $request, Document $snippet) + protected function setValuesToDocument(Request $request, Document $document): void { - $this->addSettingsToDocument($request, $snippet); - $this->addDataToDocument($request, $snippet); - $this->applySchedulerDataToElement($request, $snippet); - $this->addPropertiesToDocument($request, $snippet); + $this->addSettingsToDocument($request, $document); + $this->addDataToDocument($request, $document); + $this->applySchedulerDataToElement($request, $document); + $this->addPropertiesToDocument($request, $document); } } diff --git a/bundles/AdminBundle/src/Controller/Admin/ElementController.php b/bundles/AdminBundle/src/Controller/Admin/ElementController.php index cc27f107051..59a99f18e18 100644 --- a/bundles/AdminBundle/src/Controller/Admin/ElementController.php +++ b/bundles/AdminBundle/src/Controller/Admin/ElementController.php @@ -846,8 +846,10 @@ public function analyzePermissionsAction(Request $request): Response { $userId = $request->request->getInt('userId'); if ($userId) { - $user = Model\User::getById($userId); - $userList = [$user]; + $userList = []; + if ($user = Model\User::getById($userId)) { + $userList[] = $user; + } } else { $userList = new Model\User\Listing(); $userList->setCondition('`type` = ?', ['user']); diff --git a/bundles/AdminBundle/src/Controller/Admin/EmailController.php b/bundles/AdminBundle/src/Controller/Admin/EmailController.php index 027682b0803..f508ec27552 100644 --- a/bundles/AdminBundle/src/Controller/Admin/EmailController.php +++ b/bundles/AdminBundle/src/Controller/Admin/EmailController.php @@ -168,7 +168,7 @@ public function showEmailLogAction(Request $request, ?Profiler $profiler): JsonR * @param array $data * @param array|null $fullEntry */ - protected function enhanceLoggingData(array &$data, array &$fullEntry = null) + protected function enhanceLoggingData(array &$data, array &$fullEntry = null): void { if (!empty($data['objectClass'])) { $class = '\\' . ltrim($data['objectClass'], '\\'); diff --git a/bundles/AdminBundle/src/Controller/Admin/External/OpcacheController.php b/bundles/AdminBundle/src/Controller/Admin/External/OpcacheController.php index 516eda75756..7d67dc4183d 100644 --- a/bundles/AdminBundle/src/Controller/Admin/External/OpcacheController.php +++ b/bundles/AdminBundle/src/Controller/Admin/External/OpcacheController.php @@ -52,7 +52,7 @@ public function indexAction(Request $request, ?Profiler $profiler): Response return new Response($content); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/IndexController.php b/bundles/AdminBundle/src/Controller/Admin/IndexController.php index 0c0e59736ec..3402ee9e821 100644 --- a/bundles/AdminBundle/src/Controller/Admin/IndexController.php +++ b/bundles/AdminBundle/src/Controller/Admin/IndexController.php @@ -384,7 +384,7 @@ protected function addNotificationSettings(array &$settings, Config $config): st return $this; } - public function onKernelResponseEvent(ResponseEvent $event) + public function onKernelResponseEvent(ResponseEvent $event): void { $event->getResponse()->headers->set('X-Frame-Options', 'deny', true); } diff --git a/bundles/AdminBundle/src/Controller/Admin/LogController.php b/bundles/AdminBundle/src/Controller/Admin/LogController.php index 90417ace3de..d55b19de6a1 100644 --- a/bundles/AdminBundle/src/Controller/Admin/LogController.php +++ b/bundles/AdminBundle/src/Controller/Admin/LogController.php @@ -36,7 +36,7 @@ */ class LogController extends AdminController implements KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$this->getAdminUser()->isAllowed('application_logging')) { throw new AccessDeniedHttpException("Permission denied, user needs 'application_logging' permission."); @@ -256,10 +256,8 @@ public function showFileObjectAction(Request $request): StreamedResponse|Respons /** * @param resource $fileHandle - * - * @return StreamedResponse */ - private function getResponseForFileHandle($fileHandle) + private function getResponseForFileHandle($fileHandle): StreamedResponse { return new StreamedResponse( static function () use ($fileHandle) { diff --git a/bundles/AdminBundle/src/Controller/Admin/LoginController.php b/bundles/AdminBundle/src/Controller/Admin/LoginController.php index c8e57893d5e..8ef676cb823 100644 --- a/bundles/AdminBundle/src/Controller/Admin/LoginController.php +++ b/bundles/AdminBundle/src/Controller/Admin/LoginController.php @@ -54,7 +54,7 @@ public function __construct( ) { } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { // use browser language for login page if possible $locale = 'en'; @@ -73,7 +73,7 @@ public function onKernelControllerEvent(ControllerEvent $event) } } - public function onKernelResponseEvent(ResponseEvent $event) + public function onKernelResponseEvent(ResponseEvent $event): void { $response = $event->getResponse(); $response->headers->set('X-Frame-Options', 'deny', true); @@ -152,7 +152,7 @@ public function csrfTokenAction(Request $request, CsrfProtectionHandler $csrfPro /** * @Route("/logout", name="pimcore_admin_logout" , methods={"POST"}) */ - public function logoutAction() + public function logoutAction(): void { // this route will never be matched, but will be handled by the logout handler } @@ -240,7 +240,7 @@ public function lostpasswordAction(Request $request, CsrfProtectionHandler $csrf /** * @Route("/login/deeplink", name="pimcore_admin_login_deeplink") */ - public function deeplinkAction(Request $request, EventDispatcherInterface $eventDispatcher) + public function deeplinkAction(Request $request, EventDispatcherInterface $eventDispatcher): Response { // check for deeplink $queryString = $_SERVER['QUERY_STRING']; @@ -273,6 +273,8 @@ public function deeplinkAction(Request $request, EventDispatcherInterface $event ]); } } + + throw $this->createNotFoundException(); } protected function buildLoginPageViewParams(Config $config): array @@ -310,7 +312,7 @@ public function twoFactorAuthenticationAction(Request $request, Config $config): * * @param Request $request */ - public function twoFactorAuthenticationVerifyAction(Request $request) + public function twoFactorAuthenticationVerifyAction(Request $request): void { } diff --git a/bundles/AdminBundle/src/Controller/Admin/PortalController.php b/bundles/AdminBundle/src/Controller/Admin/PortalController.php index a8d906d2452..56a98f1cbb6 100644 --- a/bundles/AdminBundle/src/Controller/Admin/PortalController.php +++ b/bundles/AdminBundle/src/Controller/Admin/PortalController.php @@ -43,7 +43,7 @@ protected function getCurrentConfiguration(Request $request): array return $this->dashboardHelper->getDashboard($request->get('key')); } - protected function saveConfiguration(Request $request, array $config) + protected function saveConfiguration(Request $request, array $config): void { $this->dashboardHelper->saveDashboard($request->get('key'), $config); } @@ -410,7 +410,7 @@ public function portletAnalyticsSitesAction( return $this->adminJson(['data' => $data]); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/RecyclebinController.php b/bundles/AdminBundle/src/Controller/Admin/RecyclebinController.php index 661152ef0b5..9ecc08d4242 100644 --- a/bundles/AdminBundle/src/Controller/Admin/RecyclebinController.php +++ b/bundles/AdminBundle/src/Controller/Admin/RecyclebinController.php @@ -201,7 +201,7 @@ public function addAction(Request $request): JsonResponse return $this->adminJson(['success' => true]); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/SettingsController.php b/bundles/AdminBundle/src/Controller/Admin/SettingsController.php index 9e4674cded1..cd61b17d0e1 100644 --- a/bundles/AdminBundle/src/Controller/Admin/SettingsController.php +++ b/bundles/AdminBundle/src/Controller/Admin/SettingsController.php @@ -555,7 +555,7 @@ public function setSystemAction( * * @throws \Exception */ - protected function checkFallbackLanguageLoop(string $source, array $definitions, array $fallbacks = []) + protected function checkFallbackLanguageLoop(string $source, array $definitions, array $fallbacks = []): void { if (isset($definitions[$source])) { $targets = explode(',', $definitions[$source]); @@ -1608,7 +1608,7 @@ public function getAvailableAlgorithmsAction(Request $request): JsonResponse * @param string $language * @param string $dbName */ - protected function deleteViews(string $language, string $dbName) + protected function deleteViews(string $language, string $dbName): void { $db = \Pimcore\Db::get(); $views = $db->fetchAllAssociative('SHOW FULL TABLES IN ' . $db->quoteIdentifier($dbName) . " WHERE TABLE_TYPE LIKE 'VIEW'"); diff --git a/bundles/AdminBundle/src/Controller/Admin/TargetingController.php b/bundles/AdminBundle/src/Controller/Admin/TargetingController.php index c99ca425dd6..9f07f0ddcc7 100644 --- a/bundles/AdminBundle/src/Controller/Admin/TargetingController.php +++ b/bundles/AdminBundle/src/Controller/Admin/TargetingController.php @@ -312,7 +312,7 @@ public function targetGroupSaveAction(Request $request, CoreCacheHandler $cache) return $this->adminJson(['success' => true]); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/TranslationController.php b/bundles/AdminBundle/src/Controller/Admin/TranslationController.php index df5f1e67a8c..efe5d9e157c 100644 --- a/bundles/AdminBundle/src/Controller/Admin/TranslationController.php +++ b/bundles/AdminBundle/src/Controller/Admin/TranslationController.php @@ -517,7 +517,7 @@ protected function prefixTranslations(array $translations): array return $prefixedTranslations; } - protected function extendTranslationQuery(array $joins, Translation\Listing $list, string $tableName, array $filters) + protected function extendTranslationQuery(array $joins, Translation\Listing $list, string $tableName, array $filters): void { if ($joins) { $list->onCreateQueryBuilder( @@ -560,7 +560,7 @@ function (DoctrineQueryBuilder $select) use ( } } - protected function getGridFilterCondition(Request $request, string $tableName, bool $languageMode = false, $admin = false): array|string|null + protected function getGridFilterCondition(Request $request, string $tableName, bool $languageMode = false, bool $admin = false): array|string|null { $joins = []; $conditions = []; diff --git a/bundles/AdminBundle/src/Controller/Admin/UserController.php b/bundles/AdminBundle/src/Controller/Admin/UserController.php index f52586236eb..7e7c2d6463b 100644 --- a/bundles/AdminBundle/src/Controller/Admin/UserController.php +++ b/bundles/AdminBundle/src/Controller/Admin/UserController.php @@ -1014,7 +1014,7 @@ public function searchAction(Request $request): JsonResponse ]); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Admin/WorkflowController.php b/bundles/AdminBundle/src/Controller/Admin/WorkflowController.php index 58265f94556..bcda49d731d 100644 --- a/bundles/AdminBundle/src/Controller/Admin/WorkflowController.php +++ b/bundles/AdminBundle/src/Controller/Admin/WorkflowController.php @@ -406,7 +406,7 @@ protected function getLatestVersion(mixed $element) * * @throws \Exception */ - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/GDPR/AdminController.php b/bundles/AdminBundle/src/Controller/GDPR/AdminController.php index 9bdbe82f2bb..3bc96914777 100644 --- a/bundles/AdminBundle/src/Controller/GDPR/AdminController.php +++ b/bundles/AdminBundle/src/Controller/GDPR/AdminController.php @@ -44,7 +44,7 @@ public function getDataProvidersAction(Manager $manager): \Pimcore\Bundle\AdminB return $this->adminJson($response); } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/GDPR/AssetController.php b/bundles/AdminBundle/src/Controller/GDPR/AssetController.php index 257f1fe7384..fccc94f6258 100644 --- a/bundles/AdminBundle/src/Controller/GDPR/AssetController.php +++ b/bundles/AdminBundle/src/Controller/GDPR/AssetController.php @@ -36,7 +36,7 @@ */ class AssetController extends \Pimcore\Bundle\AdminBundle\Controller\AdminController implements KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/GDPR/DataObjectController.php b/bundles/AdminBundle/src/Controller/GDPR/DataObjectController.php index 33971298482..cf87cd335d9 100644 --- a/bundles/AdminBundle/src/Controller/GDPR/DataObjectController.php +++ b/bundles/AdminBundle/src/Controller/GDPR/DataObjectController.php @@ -33,7 +33,7 @@ */ class DataObjectController extends \Pimcore\Bundle\AdminBundle\Controller\AdminController implements KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/GDPR/PimcoreUsersController.php b/bundles/AdminBundle/src/Controller/GDPR/PimcoreUsersController.php index 6fa81c860a8..9e801b01551 100644 --- a/bundles/AdminBundle/src/Controller/GDPR/PimcoreUsersController.php +++ b/bundles/AdminBundle/src/Controller/GDPR/PimcoreUsersController.php @@ -32,7 +32,7 @@ */ class PimcoreUsersController extends \Pimcore\Bundle\AdminBundle\Controller\AdminController implements KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/GDPR/SentMailController.php b/bundles/AdminBundle/src/Controller/GDPR/SentMailController.php index 4e69bb16045..d7b1036a5b2 100644 --- a/bundles/AdminBundle/src/Controller/GDPR/SentMailController.php +++ b/bundles/AdminBundle/src/Controller/GDPR/SentMailController.php @@ -32,7 +32,7 @@ */ class SentMailController extends \Pimcore\Bundle\AdminBundle\Controller\AdminController implements KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/Controller/Reports/AnalyticsController.php b/bundles/AdminBundle/src/Controller/Reports/AnalyticsController.php index 57ce1604cce..36e3dbbf2dd 100644 --- a/bundles/AdminBundle/src/Controller/Reports/AnalyticsController.php +++ b/bundles/AdminBundle/src/Controller/Reports/AnalyticsController.php @@ -486,7 +486,7 @@ protected function formatDimension(string $type, string $value): string return $value; } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/DependencyInjection/Compiler/ContentSecurityPolicyUrlsPass.php b/bundles/AdminBundle/src/DependencyInjection/Compiler/ContentSecurityPolicyUrlsPass.php index 1fe70f17535..df6acdc7286 100644 --- a/bundles/AdminBundle/src/DependencyInjection/Compiler/ContentSecurityPolicyUrlsPass.php +++ b/bundles/AdminBundle/src/DependencyInjection/Compiler/ContentSecurityPolicyUrlsPass.php @@ -29,7 +29,7 @@ final class ContentSecurityPolicyUrlsPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $definition = $container->getDefinition(ContentSecurityPolicyHandler::class); diff --git a/bundles/AdminBundle/src/DependencyInjection/Compiler/GDPRDataProviderPass.php b/bundles/AdminBundle/src/DependencyInjection/Compiler/GDPRDataProviderPass.php index dd89d11de06..77f2b87dc5c 100644 --- a/bundles/AdminBundle/src/DependencyInjection/Compiler/GDPRDataProviderPass.php +++ b/bundles/AdminBundle/src/DependencyInjection/Compiler/GDPRDataProviderPass.php @@ -34,7 +34,7 @@ final class GDPRDataProviderPass implements CompilerPassInterface * * @param ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $providers = $container->findTaggedServiceIds('pimcore.gdpr.data-provider'); diff --git a/bundles/AdminBundle/src/DependencyInjection/Compiler/ImportExportLocatorsPass.php b/bundles/AdminBundle/src/DependencyInjection/Compiler/ImportExportLocatorsPass.php index 90e76174a7d..cf59a85fbef 100644 --- a/bundles/AdminBundle/src/DependencyInjection/Compiler/ImportExportLocatorsPass.php +++ b/bundles/AdminBundle/src/DependencyInjection/Compiler/ImportExportLocatorsPass.php @@ -30,7 +30,7 @@ */ final class ImportExportLocatorsPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $this->processGridColumns($container); } diff --git a/bundles/AdminBundle/src/DependencyInjection/Compiler/SerializerPass.php b/bundles/AdminBundle/src/DependencyInjection/Compiler/SerializerPass.php index 5f545f981f7..497bee3aba3 100644 --- a/bundles/AdminBundle/src/DependencyInjection/Compiler/SerializerPass.php +++ b/bundles/AdminBundle/src/DependencyInjection/Compiler/SerializerPass.php @@ -36,7 +36,7 @@ final class SerializerPass implements CompilerPassInterface { use PriorityTaggedServiceTrait; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('Pimcore\\Admin\\Serializer')) { return; diff --git a/bundles/AdminBundle/src/DependencyInjection/Compiler/TranslationServicesPass.php b/bundles/AdminBundle/src/DependencyInjection/Compiler/TranslationServicesPass.php index 395c7a88e83..68a967cd51c 100644 --- a/bundles/AdminBundle/src/DependencyInjection/Compiler/TranslationServicesPass.php +++ b/bundles/AdminBundle/src/DependencyInjection/Compiler/TranslationServicesPass.php @@ -34,7 +34,7 @@ final class TranslationServicesPass implements CompilerPassInterface * * @param ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $providers = $container->findTaggedServiceIds('pimcore.translation.data-extractor'); diff --git a/bundles/AdminBundle/src/DependencyInjection/PimcoreAdminExtension.php b/bundles/AdminBundle/src/DependencyInjection/PimcoreAdminExtension.php index c2d11eb5ed0..2781ef07036 100644 --- a/bundles/AdminBundle/src/DependencyInjection/PimcoreAdminExtension.php +++ b/bundles/AdminBundle/src/DependencyInjection/PimcoreAdminExtension.php @@ -35,7 +35,7 @@ final class PimcoreAdminExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); diff --git a/bundles/AdminBundle/src/EventListener/AdminAuthenticationDoubleCheckListener.php b/bundles/AdminBundle/src/EventListener/AdminAuthenticationDoubleCheckListener.php index 3c37fd73580..55bec29b645 100644 --- a/bundles/AdminBundle/src/EventListener/AdminAuthenticationDoubleCheckListener.php +++ b/bundles/AdminBundle/src/EventListener/AdminAuthenticationDoubleCheckListener.php @@ -72,7 +72,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelController(ControllerEvent $event) + public function onKernelController(ControllerEvent $event): void { if (!$event->isMainRequest()) { return; @@ -144,7 +144,7 @@ protected function getUnauthenticatedMatchers(): array * @throws AccessDeniedHttpException * if there's no current user in the session */ - protected function checkSessionUser() + protected function checkSessionUser(): void { $user = Authentication::authenticateSession(); if (null === $user) { @@ -156,7 +156,7 @@ protected function checkSessionUser() * @throws AccessDeniedHttpException * if there's no current user in the token storage */ - protected function checkTokenStorageUser() + protected function checkTokenStorageUser(): void { $user = $this->tokenResolver->getUser(); diff --git a/bundles/AdminBundle/src/EventListener/AdminExceptionListener.php b/bundles/AdminBundle/src/EventListener/AdminExceptionListener.php index 4884a809450..74c1c897a70 100644 --- a/bundles/AdminBundle/src/EventListener/AdminExceptionListener.php +++ b/bundles/AdminBundle/src/EventListener/AdminExceptionListener.php @@ -46,7 +46,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelException(ExceptionEvent $event) + public function onKernelException(ExceptionEvent $event): void { $request = $event->getRequest(); $ex = $event->getThrowable(); @@ -118,7 +118,7 @@ private function getResponseData(\Throwable $ex, int $defaultStatusCode = 500): * @param string $message * @param string $detailedInfo */ - protected function recursiveAddValidationExceptionSubItems(array $items, string &$message, string &$detailedInfo) + protected function recursiveAddValidationExceptionSubItems(array $items, string &$message, string &$detailedInfo): void { if (!$items) { return; @@ -144,7 +144,7 @@ protected function recursiveAddValidationExceptionSubItems(array $items, string } } - protected function addContext(ValidationException $e, string &$message) + protected function addContext(ValidationException $e, string &$message): void { $contextStack = $e->getContextStack(); if ($contextStack) { diff --git a/bundles/AdminBundle/src/EventListener/AdminSecurityListener.php b/bundles/AdminBundle/src/EventListener/AdminSecurityListener.php index caf684e43be..88875cde970 100644 --- a/bundles/AdminBundle/src/EventListener/AdminSecurityListener.php +++ b/bundles/AdminBundle/src/EventListener/AdminSecurityListener.php @@ -49,7 +49,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (!$this->config['admin_csp_header']['enabled']) { return; diff --git a/bundles/AdminBundle/src/EventListener/AdminSessionBagListener.php b/bundles/AdminBundle/src/EventListener/AdminSessionBagListener.php index 8b917b862eb..3f9f9f58fee 100644 --- a/bundles/AdminBundle/src/EventListener/AdminSessionBagListener.php +++ b/bundles/AdminBundle/src/EventListener/AdminSessionBagListener.php @@ -43,7 +43,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; @@ -59,7 +59,7 @@ public function onKernelRequest(RequestEvent $event) $this->configure($session); } - public function configure(SessionInterface $session) + public function configure(SessionInterface $session): void { foreach ($this->config['session']['attribute_bags'] as $name => $config) { $bag = new LockableAttributeBag($config['storage_key']); diff --git a/bundles/AdminBundle/src/EventListener/CsrfProtectionListener.php b/bundles/AdminBundle/src/EventListener/CsrfProtectionListener.php index c52859d0fc3..f125f7a5761 100644 --- a/bundles/AdminBundle/src/EventListener/CsrfProtectionListener.php +++ b/bundles/AdminBundle/src/EventListener/CsrfProtectionListener.php @@ -53,7 +53,7 @@ public static function getSubscribedEvents(): array ]; } - public function handleRequest(RequestEvent $event) + public function handleRequest(RequestEvent $event): void { $request = $event->getRequest(); if (!$this->matchesPimcoreContext($request, PimcoreContextResolver::CONTEXT_ADMIN)) { diff --git a/bundles/AdminBundle/src/EventListener/CustomAdminEntryPointCheckListener.php b/bundles/AdminBundle/src/EventListener/CustomAdminEntryPointCheckListener.php index 89fed970612..23bf7890972 100644 --- a/bundles/AdminBundle/src/EventListener/CustomAdminEntryPointCheckListener.php +++ b/bundles/AdminBundle/src/EventListener/CustomAdminEntryPointCheckListener.php @@ -48,7 +48,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); if ($event->isMainRequest() && $this->customAdminPathIdentifier && $this->matchesPimcoreContext($request, PimcoreContextResolver::CONTEXT_ADMIN)) { diff --git a/bundles/AdminBundle/src/EventListener/EnablePreviewTimeSliderListener.php b/bundles/AdminBundle/src/EventListener/EnablePreviewTimeSliderListener.php index 118ab0118d5..f9a934f52ff 100644 --- a/bundles/AdminBundle/src/EventListener/EnablePreviewTimeSliderListener.php +++ b/bundles/AdminBundle/src/EventListener/EnablePreviewTimeSliderListener.php @@ -59,7 +59,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/AdminBundle/src/EventListener/GridConfigListener.php b/bundles/AdminBundle/src/EventListener/GridConfigListener.php index 58fe991bc90..c4e6e1adb81 100644 --- a/bundles/AdminBundle/src/EventListener/GridConfigListener.php +++ b/bundles/AdminBundle/src/EventListener/GridConfigListener.php @@ -42,7 +42,7 @@ public static function getSubscribedEvents(): array ]; } - public function onObjectDelete(DataObjectEvent $event) + public function onObjectDelete(DataObjectEvent $event): void { $object = $event->getObject(); $objectId = $object->getId(); @@ -50,7 +50,7 @@ public function onObjectDelete(DataObjectEvent $event) $this->cleanupGridConfigFavourites('objectId = ' . $objectId); } - public function onClassDelete(ClassDefinitionEvent $event) + public function onClassDelete(ClassDefinitionEvent $event): void { $class = $event->getClassDefinition(); $classId = $class->getId(); @@ -66,7 +66,7 @@ public function onClassDelete(ClassDefinitionEvent $event) $this->cleanupGridConfigFavourites('classId = ' . $db->quote($classId)); } - public function onUserDelete(UserRoleEvent $event) + public function onUserDelete(UserRoleEvent $event): void { $user = $event->getUserRole(); $userId = $user->getId(); @@ -82,13 +82,13 @@ public function onUserDelete(UserRoleEvent $event) $this->cleanupGridConfigFavourites('ownerId = ' . $userId); } - protected function cleanupGridConfigs($condition) + protected function cleanupGridConfigs(string $condition): void { $db = Db::get(); $db->executeQuery('DELETE FROM gridconfigs where ' . $condition); } - protected function cleanupGridConfigFavourites($condition) + protected function cleanupGridConfigFavourites(string $condition): void { $db = Db::get(); $db->executeQuery('DELETE FROM gridconfig_favourites where ' . $condition); diff --git a/bundles/AdminBundle/src/EventListener/HttpCacheListener.php b/bundles/AdminBundle/src/EventListener/HttpCacheListener.php index c589eb3715b..fcc30314afc 100644 --- a/bundles/AdminBundle/src/EventListener/HttpCacheListener.php +++ b/bundles/AdminBundle/src/EventListener/HttpCacheListener.php @@ -51,7 +51,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $request = $event->getRequest(); diff --git a/bundles/AdminBundle/src/EventListener/ImportConfigListener.php b/bundles/AdminBundle/src/EventListener/ImportConfigListener.php index e11434ca403..d4c2c94e64f 100644 --- a/bundles/AdminBundle/src/EventListener/ImportConfigListener.php +++ b/bundles/AdminBundle/src/EventListener/ImportConfigListener.php @@ -39,7 +39,7 @@ public static function getSubscribedEvents(): array ]; } - public function onClassDelete(ClassDefinitionEvent $event) + public function onClassDelete(ClassDefinitionEvent $event): void { $class = $event->getClassDefinition(); $classId = $class->getId(); @@ -54,7 +54,7 @@ public function onClassDelete(ClassDefinitionEvent $event) $this->cleanupImportConfigs('classId = ' . $db->quote($classId)); } - public function onUserDelete(UserRoleEvent $event) + public function onUserDelete(UserRoleEvent $event): void { $user = $event->getUserRole(); $userId = $user->getId(); @@ -69,7 +69,7 @@ public function onUserDelete(UserRoleEvent $event) $this->cleanupImportConfigs('ownerId = ' . $userId); } - protected function cleanupImportConfigs($condition) + protected function cleanupImportConfigs(string $condition): void { $db = Db::get(); $db->executeQuery('DELETE FROM importconfigs where ' . $condition); diff --git a/bundles/AdminBundle/src/EventListener/UsageStatisticsListener.php b/bundles/AdminBundle/src/EventListener/UsageStatisticsListener.php index 0fe0aee65e8..c266a065543 100644 --- a/bundles/AdminBundle/src/EventListener/UsageStatisticsListener.php +++ b/bundles/AdminBundle/src/EventListener/UsageStatisticsListener.php @@ -53,7 +53,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -68,7 +68,7 @@ public function onKernelRequest(RequestEvent $event) $this->logUsageStatistics($request); } - protected function logUsageStatistics(Request $request) + protected function logUsageStatistics(Request $request): void { if (!empty($this->config['general']['disable_usage_statistics'])) { return; diff --git a/bundles/AdminBundle/src/EventListener/UserPerspectiveListener.php b/bundles/AdminBundle/src/EventListener/UserPerspectiveListener.php index e884c3c2d5c..b59d21af4be 100644 --- a/bundles/AdminBundle/src/EventListener/UserPerspectiveListener.php +++ b/bundles/AdminBundle/src/EventListener/UserPerspectiveListener.php @@ -52,7 +52,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -69,7 +69,7 @@ public function onKernelRequest(RequestEvent $event) } } - protected function setRequestedPerspective(User $user, Request $request) + protected function setRequestedPerspective(User $user, Request $request): void { // update perspective settings $requestedPerspective = $request->get('perspective'); diff --git a/bundles/AdminBundle/src/GDPR/DataProvider/DataObjects.php b/bundles/AdminBundle/src/GDPR/DataProvider/DataObjects.php index a792792552c..7399ae773ba 100644 --- a/bundles/AdminBundle/src/GDPR/DataProvider/DataObjects.php +++ b/bundles/AdminBundle/src/GDPR/DataProvider/DataObjects.php @@ -33,10 +33,7 @@ class DataObjects extends Elements implements DataProviderInterface { protected array $exportIds = []; - /** - * @var array - */ - protected $config = []; + protected array $config = []; public function __construct(array $config) { @@ -90,7 +87,7 @@ public function doExportData(AbstractObject $object): array return $exportResult; } - protected function fillIds(ElementInterface $element) + protected function fillIds(ElementInterface $element): void { $this->exportIds[$element->getType()][$element->getId()] = true; diff --git a/bundles/AdminBundle/src/Helper/GridHelperService.php b/bundles/AdminBundle/src/Helper/GridHelperService.php index 947d5258a0a..dd5fee0cc6d 100644 --- a/bundles/AdminBundle/src/Helper/GridHelperService.php +++ b/bundles/AdminBundle/src/Helper/GridHelperService.php @@ -22,6 +22,7 @@ use Pimcore\Model\DataObject; use Pimcore\Model\DataObject\ClassDefinition; use Pimcore\Model\DataObject\Objectbrick; +use Pimcore\Model\User; /** * @internal @@ -162,7 +163,7 @@ public function getFeatureAndSlugFilters(string $filterJson, ClassDefinition $cl return $result; } - public function getFilterCondition(string $filterJson, ClassDefinition $class, $tablePrefix = null): string + public function getFilterCondition(string $filterJson, ClassDefinition $class, ?string $tablePrefix = null): string { $systemFields = Model\DataObject\Service::getSystemFields(); @@ -478,7 +479,7 @@ public function addSlugJoins(DataObject\Listing\Concrete $list, array $slugJoins } } - public function prepareListingForGrid(array $requestParams, string $requestedLanguage, $adminUser): DataObject\Listing\Concrete + public function prepareListingForGrid(array $requestParams, string $requestedLanguage, User $adminUser): DataObject\Listing\Concrete { $folder = Model\DataObject::getById((int) $requestParams['folderId']); $class = ClassDefinition::getById($requestParams['classId']); @@ -666,7 +667,7 @@ public function prepareListingForGrid(array $requestParams, string $requestedLan return $list; } - public function prepareAssetListingForGrid($allParams, $adminUser): Model\Asset\Listing + public function prepareAssetListingForGrid(array $allParams, User $adminUser): Model\Asset\Listing { $db = \Pimcore\Db::get(); $folder = Model\Asset::getById($allParams['folderId']); diff --git a/bundles/AdminBundle/src/HttpFoundation/JsonResponse.php b/bundles/AdminBundle/src/HttpFoundation/JsonResponse.php index dcdf7a2af40..10f1692b174 100644 --- a/bundles/AdminBundle/src/HttpFoundation/JsonResponse.php +++ b/bundles/AdminBundle/src/HttpFoundation/JsonResponse.php @@ -29,7 +29,7 @@ class JsonResponse extends BaseJsonResponse /** * {@inheritdoc} */ - public function setData($data = []): static + public function setData(mixed $data = []): static { $serializer = Serialize::getAdminSerializer(); diff --git a/bundles/AdminBundle/src/PimcoreAdminBundle.php b/bundles/AdminBundle/src/PimcoreAdminBundle.php index 015c10c27d7..6746a8d5e4a 100644 --- a/bundles/AdminBundle/src/PimcoreAdminBundle.php +++ b/bundles/AdminBundle/src/PimcoreAdminBundle.php @@ -36,7 +36,7 @@ class PimcoreAdminBundle extends Bundle /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { // auto-tag GDPR data providers $container diff --git a/bundles/AdminBundle/src/Security/Authenticator/AdminAbstractAuthenticator.php b/bundles/AdminBundle/src/Security/Authenticator/AdminAbstractAuthenticator.php index 6e2f86bbe87..acefd6da6c2 100644 --- a/bundles/AdminBundle/src/Security/Authenticator/AdminAbstractAuthenticator.php +++ b/bundles/AdminBundle/src/Security/Authenticator/AdminAbstractAuthenticator.php @@ -80,7 +80,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio /** * {@inheritdoc} */ - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response { $securityUser = $token->getUser(); if (!$securityUser instanceof User) { diff --git a/bundles/AdminBundle/src/Security/ContentSecurityPolicyHandler.php b/bundles/AdminBundle/src/Security/ContentSecurityPolicyHandler.php index e0e6151edee..50f33a6bff2 100644 --- a/bundles/AdminBundle/src/Security/ContentSecurityPolicyHandler.php +++ b/bundles/AdminBundle/src/Security/ContentSecurityPolicyHandler.php @@ -64,7 +64,7 @@ public function __construct(protected Config $config, protected array $cspHeader $this->cspHeaderOptions = $resolver->resolve($cspHeaderOptions); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ self::DEFAULT_OPT => "'self'", diff --git a/bundles/AdminBundle/src/Security/CsrfProtectionHandler.php b/bundles/AdminBundle/src/Security/CsrfProtectionHandler.php index 3583e833234..984e0dc869b 100644 --- a/bundles/AdminBundle/src/Security/CsrfProtectionHandler.php +++ b/bundles/AdminBundle/src/Security/CsrfProtectionHandler.php @@ -43,7 +43,7 @@ public function __construct(array $excludedRoutes, Environment $twig) $this->twig = $twig; } - public function checkCsrfToken(Request $request) + public function checkCsrfToken(Request $request): void { $csrfToken = $this->getCsrfToken(); $requestCsrfToken = $request->headers->get('x_pimcore_csrf_token'); @@ -72,7 +72,7 @@ public function getCsrfToken(): ?string return $this->csrfToken; } - public function regenerateCsrfToken(bool $force = true) + public function regenerateCsrfToken(bool $force = true): void { $this->csrfToken = Session::useSession(function (AttributeBagInterface $adminSession) use ($force) { if ($force || !$adminSession->get('csrfToken')) { @@ -85,7 +85,7 @@ public function regenerateCsrfToken(bool $force = true) $this->twig->addGlobal('csrfToken', $this->csrfToken); } - public function generateCsrfToken() + public function generateCsrfToken(): void { $this->twig->addGlobal('csrfToken', $this->getCsrfToken()); } diff --git a/bundles/AdminBundle/src/Security/Factory/PreAuthenticatedAdminSessionFactory.php b/bundles/AdminBundle/src/Security/Factory/PreAuthenticatedAdminSessionFactory.php index a453031982f..b797e2323cd 100644 --- a/bundles/AdminBundle/src/Security/Factory/PreAuthenticatedAdminSessionFactory.php +++ b/bundles/AdminBundle/src/Security/Factory/PreAuthenticatedAdminSessionFactory.php @@ -43,7 +43,7 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal return $authenticatorId; } - public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint): array + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array { $providerId = 'pimcore.security.authentication.provider.admin_pre_auth.' . $id; $listenerId = 'pimcore.security.authentication.listener.admin_pre_auth.' . $id; @@ -87,7 +87,7 @@ public function getKey(): string return 'pimcore_admin_pre_auth'; } - public function addConfiguration(NodeDefinition $builder) + public function addConfiguration(NodeDefinition $builder): void { // make sure only the pimcore_admin user provider can be used with this authentication provider if ($builder instanceof ArrayNodeDefinition) { diff --git a/bundles/AdminBundle/src/Security/User/User.php b/bundles/AdminBundle/src/Security/User/User.php index 1bc07512b49..47481e01411 100644 --- a/bundles/AdminBundle/src/Security/User/User.php +++ b/bundles/AdminBundle/src/Security/User/User.php @@ -91,7 +91,7 @@ public function getPassword(): ?string /** * {@inheritdoc} */ - public function eraseCredentials() + public function eraseCredentials(): void { // TODO: Implement eraseCredentials() method. // TODO: anything to do here? diff --git a/bundles/AdminBundle/src/Security/User/UserChecker.php b/bundles/AdminBundle/src/Security/User/UserChecker.php index 2620691dd85..2c87e124a48 100644 --- a/bundles/AdminBundle/src/Security/User/UserChecker.php +++ b/bundles/AdminBundle/src/Security/User/UserChecker.php @@ -31,7 +31,7 @@ class UserChecker extends InMemoryUserChecker /** * {@inheritdoc} */ - public function checkPreAuth(UserInterface $user) + public function checkPreAuth(UserInterface $user): void { $this->checkValidUser($user); @@ -41,7 +41,7 @@ public function checkPreAuth(UserInterface $user) /** * {@inheritdoc} */ - public function checkPostAuth(UserInterface $user) + public function checkPostAuth(UserInterface $user): void { $this->checkValidUser($user); diff --git a/bundles/AdminBundle/src/Security/User/UserProvider.php b/bundles/AdminBundle/src/Security/User/UserProvider.php index de8a4283b2a..bb667f5cf2b 100644 --- a/bundles/AdminBundle/src/Security/User/UserProvider.php +++ b/bundles/AdminBundle/src/Security/User/UserProvider.php @@ -40,12 +40,8 @@ public function loadUserByIdentifier(string $identifier): UserInterface /** * {@inheritdoc} - * - * @param UserInterface $user - * - * @return UserInterface */ - public function refreshUser(UserInterface $user): UserInterface|User + public function refreshUser(UserInterface $user): UserInterface { if (!$user instanceof User) { // user is not supported - we only support pimcore users @@ -65,10 +61,8 @@ protected function buildUser(PimcoreUser $pimcoreUser): User /** * {@inheritdoc} - * - * @return bool */ - public function supportsClass($class): bool + public function supportsClass(string $class): bool { return $class === User::class; } diff --git a/bundles/AdminBundle/src/Session/Handler/AdminSessionHandler.php b/bundles/AdminBundle/src/Session/Handler/AdminSessionHandler.php index cc0c51ebcc8..010aca95904 100644 --- a/bundles/AdminBundle/src/Session/Handler/AdminSessionHandler.php +++ b/bundles/AdminBundle/src/Session/Handler/AdminSessionHandler.php @@ -242,7 +242,7 @@ public function loadSession(): SessionInterface /** * {@inheritdoc} */ - public function writeClose() + public function writeClose(): void { if (!$this->shouldWriteAndClose()) { return; diff --git a/bundles/AdminBundle/src/Session/Handler/AdminSessionHandlerInterface.php b/bundles/AdminBundle/src/Session/Handler/AdminSessionHandlerInterface.php index 0ec6ca453e9..aee534bc0fc 100644 --- a/bundles/AdminBundle/src/Session/Handler/AdminSessionHandlerInterface.php +++ b/bundles/AdminBundle/src/Session/Handler/AdminSessionHandlerInterface.php @@ -99,7 +99,7 @@ public function loadAttributeBag(string $name, SessionInterface $session = null) /** * Saves the session if it is the last admin session which was opened */ - public function writeClose(); + public function writeClose(): void; /** * Check if the request has a cookie or a param matching the session name. diff --git a/bundles/AdminBundle/src/Translation/AdminUserTranslator.php b/bundles/AdminBundle/src/Translation/AdminUserTranslator.php index 0c1bd5d7b01..563dbd2746a 100644 --- a/bundles/AdminBundle/src/Translation/AdminUserTranslator.php +++ b/bundles/AdminBundle/src/Translation/AdminUserTranslator.php @@ -59,7 +59,7 @@ public function trans(string $id, array $parameters = [], string $domain = null, /** * {@inheritdoc} */ - public function setLocale($locale) + public function setLocale(string $locale): void { if ($this->translator instanceof LocaleAwareInterface) { $this->translator->setLocale($locale); diff --git a/bundles/CoreBundle/src/Command/Bundle/InstallCommand.php b/bundles/CoreBundle/src/Command/Bundle/InstallCommand.php index 06c2fdbec63..730182918d9 100644 --- a/bundles/CoreBundle/src/Command/Bundle/InstallCommand.php +++ b/bundles/CoreBundle/src/Command/Bundle/InstallCommand.php @@ -33,7 +33,7 @@ public function __construct(PimcoreBundleManager $bundleManager, private PostSta parent::__construct($bundleManager); } - protected function configure() + protected function configure(): void { $this ->setName($this->buildName('install')) diff --git a/bundles/CoreBundle/src/Command/Bundle/ListCommand.php b/bundles/CoreBundle/src/Command/Bundle/ListCommand.php index 7b16f09bc04..48cf1d03f1f 100644 --- a/bundles/CoreBundle/src/Command/Bundle/ListCommand.php +++ b/bundles/CoreBundle/src/Command/Bundle/ListCommand.php @@ -28,7 +28,7 @@ */ class ListCommand extends AbstractBundleCommand { - protected function configure() + protected function configure(): void { $this ->setName($this->buildName('list')) diff --git a/bundles/CoreBundle/src/Command/Bundle/UninstallCommand.php b/bundles/CoreBundle/src/Command/Bundle/UninstallCommand.php index 8fd62c54511..34349748d28 100644 --- a/bundles/CoreBundle/src/Command/Bundle/UninstallCommand.php +++ b/bundles/CoreBundle/src/Command/Bundle/UninstallCommand.php @@ -33,7 +33,7 @@ public function __construct(PimcoreBundleManager $bundleManager, private PostSta parent::__construct($bundleManager); } - protected function configure() + protected function configure(): void { $this ->setName($this->buildName('uninstall')) diff --git a/bundles/CoreBundle/src/Command/CacheClearCommand.php b/bundles/CoreBundle/src/Command/CacheClearCommand.php index d6fcb19ab25..e7d2aedbe46 100644 --- a/bundles/CoreBundle/src/Command/CacheClearCommand.php +++ b/bundles/CoreBundle/src/Command/CacheClearCommand.php @@ -38,7 +38,7 @@ public function __construct(private EventDispatcherInterface $eventDispatcher) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setDescription('Clear caches') diff --git a/bundles/CoreBundle/src/Command/CacheWarmingCommand.php b/bundles/CoreBundle/src/Command/CacheWarmingCommand.php index b71ea1ce6a8..7404fd254cd 100644 --- a/bundles/CoreBundle/src/Command/CacheWarmingCommand.php +++ b/bundles/CoreBundle/src/Command/CacheWarmingCommand.php @@ -57,7 +57,7 @@ class CacheWarmingCommand extends AbstractCommand 'variant', ]; - protected function configure() + protected function configure(): void { $this ->setName('pimcore:cache:warming') @@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - protected function writeWarmingMessage(string $type, array $types, $extra = '') + protected function writeWarmingMessage(string $type, array $types, string $extra = ''): void { $output = sprintf('Warming %s cache', $type); if (null !== $types && count($types) > 0) { diff --git a/bundles/CoreBundle/src/Command/ClassesDefinitionsBuildCommand.php b/bundles/CoreBundle/src/Command/ClassesDefinitionsBuildCommand.php index 15e38b69468..86db39a5824 100644 --- a/bundles/CoreBundle/src/Command/ClassesDefinitionsBuildCommand.php +++ b/bundles/CoreBundle/src/Command/ClassesDefinitionsBuildCommand.php @@ -39,7 +39,7 @@ public function __construct( parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('pimcore:build:classes') diff --git a/bundles/CoreBundle/src/Command/ClassesRebuildCommand.php b/bundles/CoreBundle/src/Command/ClassesRebuildCommand.php index c10f2e83bdc..39bed14f14c 100644 --- a/bundles/CoreBundle/src/Command/ClassesRebuildCommand.php +++ b/bundles/CoreBundle/src/Command/ClassesRebuildCommand.php @@ -32,7 +32,7 @@ class ClassesRebuildCommand extends AbstractCommand { protected ClassDefinitionManager $classDefinitionManager; - protected function configure() + protected function configure(): void { $this ->setName('pimcore:deployment:classes-rebuild') diff --git a/bundles/CoreBundle/src/Command/Definition/Import/AbstractStructureImportCommand.php b/bundles/CoreBundle/src/Command/Definition/Import/AbstractStructureImportCommand.php index 17b9a9d8647..6dc8711892b 100644 --- a/bundles/CoreBundle/src/Command/Definition/Import/AbstractStructureImportCommand.php +++ b/bundles/CoreBundle/src/Command/Definition/Import/AbstractStructureImportCommand.php @@ -33,7 +33,7 @@ abstract class AbstractStructureImportCommand extends AbstractCommand { use DryRun; - protected function configure() + protected function configure(): void { $type = $this->getType(); diff --git a/bundles/CoreBundle/src/Command/Definition/Import/CustomLayoutCommand.php b/bundles/CoreBundle/src/Command/Definition/Import/CustomLayoutCommand.php index 51b87fa846e..a8024665480 100644 --- a/bundles/CoreBundle/src/Command/Definition/Import/CustomLayoutCommand.php +++ b/bundles/CoreBundle/src/Command/Definition/Import/CustomLayoutCommand.php @@ -27,7 +27,7 @@ */ class CustomLayoutCommand extends AbstractStructureImportCommand { - protected function configure() + protected function configure(): void { parent::configure(); diff --git a/bundles/CoreBundle/src/Command/DeleteClassificationStoreCommand.php b/bundles/CoreBundle/src/Command/DeleteClassificationStoreCommand.php index 5df73a6e44a..d9f7f05d553 100644 --- a/bundles/CoreBundle/src/Command/DeleteClassificationStoreCommand.php +++ b/bundles/CoreBundle/src/Command/DeleteClassificationStoreCommand.php @@ -28,7 +28,7 @@ */ class DeleteClassificationStoreCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:classificationstore:delete-store') diff --git a/bundles/CoreBundle/src/Command/DeleteUnusedLocaleDataCommand.php b/bundles/CoreBundle/src/Command/DeleteUnusedLocaleDataCommand.php index 59472c0ed09..efe7110e361 100644 --- a/bundles/CoreBundle/src/Command/DeleteUnusedLocaleDataCommand.php +++ b/bundles/CoreBundle/src/Command/DeleteUnusedLocaleDataCommand.php @@ -31,7 +31,7 @@ class DeleteUnusedLocaleDataCommand extends AbstractCommand { use DryRun; - protected function configure() + protected function configure(): void { $this ->setName('pimcore:locale:delete-unused-tables') diff --git a/bundles/CoreBundle/src/Command/Document/GeneratePagePreviews.php b/bundles/CoreBundle/src/Command/Document/GeneratePagePreviews.php index 56636c7e2e8..7d7e72f09a9 100644 --- a/bundles/CoreBundle/src/Command/Document/GeneratePagePreviews.php +++ b/bundles/CoreBundle/src/Command/Document/GeneratePagePreviews.php @@ -33,7 +33,7 @@ class GeneratePagePreviews extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setName('pimcore:documents:generate-page-previews') diff --git a/bundles/CoreBundle/src/Command/Document/MigrateElementsCommand.php b/bundles/CoreBundle/src/Command/Document/MigrateElementsCommand.php index 66304b97022..34bdc28f56b 100644 --- a/bundles/CoreBundle/src/Command/Document/MigrateElementsCommand.php +++ b/bundles/CoreBundle/src/Command/Document/MigrateElementsCommand.php @@ -29,7 +29,7 @@ class MigrateElementsCommand extends AbstractCommand { private bool $runCommand = true; - protected function configure() + protected function configure(): void { $this ->setName('pimcore:documents:migrate-elements') @@ -64,7 +64,7 @@ private function processVersionRow(array $row): void $this->output->writeln(sprintf('saved version %d, document id: %d, document key: %s', $vId, $documentId, $dKey)); } - protected function interact(InputInterface $input, OutputInterface $output) + protected function interact(InputInterface $input, OutputInterface $output): void { /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); diff --git a/bundles/CoreBundle/src/Command/EmailLogsCleanupCommand.php b/bundles/CoreBundle/src/Command/EmailLogsCleanupCommand.php index 4c9233be3c8..34a9b4d2e67 100644 --- a/bundles/CoreBundle/src/Command/EmailLogsCleanupCommand.php +++ b/bundles/CoreBundle/src/Command/EmailLogsCleanupCommand.php @@ -27,7 +27,7 @@ */ class EmailLogsCleanupCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:email:cleanup') diff --git a/bundles/CoreBundle/src/Command/ExtJSCommand.php b/bundles/CoreBundle/src/Command/ExtJSCommand.php index a22afc58aed..db324567ce2 100644 --- a/bundles/CoreBundle/src/Command/ExtJSCommand.php +++ b/bundles/CoreBundle/src/Command/ExtJSCommand.php @@ -36,7 +36,7 @@ public function __construct() parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('pimcore:extjs') @@ -135,7 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - public function populate($loadOrder, &$list, $item) + public function populate(array $loadOrder, array &$list, array $item): void { $depth = count(debug_backtrace()); if ($depth > 100) { diff --git a/bundles/CoreBundle/src/Command/GenerateStaticPagesCommand.php b/bundles/CoreBundle/src/Command/GenerateStaticPagesCommand.php index 244aa6a7495..ac8ddbb35b3 100644 --- a/bundles/CoreBundle/src/Command/GenerateStaticPagesCommand.php +++ b/bundles/CoreBundle/src/Command/GenerateStaticPagesCommand.php @@ -34,7 +34,7 @@ public function __construct(protected StaticPageGenerator $staticPageGenerator) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('pimcore:documents:generate-static-pages') diff --git a/bundles/CoreBundle/src/Command/InternalMigrationHelpersCommand.php b/bundles/CoreBundle/src/Command/InternalMigrationHelpersCommand.php index 0f508fcee57..563c4552d74 100644 --- a/bundles/CoreBundle/src/Command/InternalMigrationHelpersCommand.php +++ b/bundles/CoreBundle/src/Command/InternalMigrationHelpersCommand.php @@ -33,7 +33,7 @@ public function __construct(private DependencyFactory $dependencyFactory, privat parent::__construct($name); } - protected function configure() + protected function configure(): void { $this ->setHidden(true) diff --git a/bundles/CoreBundle/src/Command/InternalModelDaoMappingGeneratorCommand.php b/bundles/CoreBundle/src/Command/InternalModelDaoMappingGeneratorCommand.php index 963bb2cb575..3c24fd60410 100644 --- a/bundles/CoreBundle/src/Command/InternalModelDaoMappingGeneratorCommand.php +++ b/bundles/CoreBundle/src/Command/InternalModelDaoMappingGeneratorCommand.php @@ -28,7 +28,7 @@ */ class InternalModelDaoMappingGeneratorCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setHidden(true) diff --git a/bundles/CoreBundle/src/Command/InternalUnicodeCldrLanguageTerritoryGeneratorCommand.php b/bundles/CoreBundle/src/Command/InternalUnicodeCldrLanguageTerritoryGeneratorCommand.php index 5152aa58737..603ea7301cb 100644 --- a/bundles/CoreBundle/src/Command/InternalUnicodeCldrLanguageTerritoryGeneratorCommand.php +++ b/bundles/CoreBundle/src/Command/InternalUnicodeCldrLanguageTerritoryGeneratorCommand.php @@ -32,7 +32,7 @@ public function __construct(private LocaleServiceInterface $localeService) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setHidden(true) diff --git a/bundles/CoreBundle/src/Command/LowQualityImagePreviewCommand.php b/bundles/CoreBundle/src/Command/LowQualityImagePreviewCommand.php index 8354f52edbf..b82ce679e8d 100644 --- a/bundles/CoreBundle/src/Command/LowQualityImagePreviewCommand.php +++ b/bundles/CoreBundle/src/Command/LowQualityImagePreviewCommand.php @@ -29,7 +29,7 @@ */ class LowQualityImagePreviewCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:image:low-quality-preview') diff --git a/bundles/CoreBundle/src/Command/MaintenanceCommand.php b/bundles/CoreBundle/src/Command/MaintenanceCommand.php index 9b91f130596..4f32f5aa2bd 100644 --- a/bundles/CoreBundle/src/Command/MaintenanceCommand.php +++ b/bundles/CoreBundle/src/Command/MaintenanceCommand.php @@ -33,7 +33,7 @@ public function __construct(private ExecutorInterface $maintenanceExecutor, priv parent::__construct(); } - protected function configure() + protected function configure(): void { $description = 'Asynchronous maintenance jobs of pimcore (needs to be set up as cron job)'; diff --git a/bundles/CoreBundle/src/Command/MaintenanceModeCommand.php b/bundles/CoreBundle/src/Command/MaintenanceModeCommand.php index fc73ef88350..4863ef070cb 100644 --- a/bundles/CoreBundle/src/Command/MaintenanceModeCommand.php +++ b/bundles/CoreBundle/src/Command/MaintenanceModeCommand.php @@ -31,7 +31,7 @@ class MaintenanceModeCommand extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setName('pimcore:maintenance-mode') @@ -44,7 +44,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { $input->setOption('ignore-maintenance-mode', true); parent::initialize($input, $output); diff --git a/bundles/CoreBundle/src/Command/Migrate/StorageCommand.php b/bundles/CoreBundle/src/Command/Migrate/StorageCommand.php index 5bff1918347..b2467e0b324 100644 --- a/bundles/CoreBundle/src/Command/Migrate/StorageCommand.php +++ b/bundles/CoreBundle/src/Command/Migrate/StorageCommand.php @@ -34,7 +34,7 @@ public function __construct(private ContainerInterface $locator) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('pimcore:migrate:storage') diff --git a/bundles/CoreBundle/src/Command/Migrate/ThumbnailsFolderStructureCommand.php b/bundles/CoreBundle/src/Command/Migrate/ThumbnailsFolderStructureCommand.php index 3402f2e5a94..d758e0dfac5 100644 --- a/bundles/CoreBundle/src/Command/Migrate/ThumbnailsFolderStructureCommand.php +++ b/bundles/CoreBundle/src/Command/Migrate/ThumbnailsFolderStructureCommand.php @@ -29,7 +29,7 @@ */ class ThumbnailsFolderStructureCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:migrate:thumbnails-folder-structure') @@ -56,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - protected function doMigrateStorage(OutputInterface $output, FilesystemOperator $storage) + protected function doMigrateStorage(OutputInterface $output, FilesystemOperator $storage): void { $thumbnailFiles = $storage->listContents('/', true)->filter(function (StorageAttributes $attributes) { if ($attributes->isDir()) { diff --git a/bundles/CoreBundle/src/Command/MysqlToolsCommand.php b/bundles/CoreBundle/src/Command/MysqlToolsCommand.php index d1ab751773c..f1e67f2f616 100644 --- a/bundles/CoreBundle/src/Command/MysqlToolsCommand.php +++ b/bundles/CoreBundle/src/Command/MysqlToolsCommand.php @@ -27,7 +27,7 @@ */ class MysqlToolsCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:mysql-tools') diff --git a/bundles/CoreBundle/src/Command/OptimizeImageThumbnailsCommand.php b/bundles/CoreBundle/src/Command/OptimizeImageThumbnailsCommand.php index 9b3b3a02016..4e931d46f69 100644 --- a/bundles/CoreBundle/src/Command/OptimizeImageThumbnailsCommand.php +++ b/bundles/CoreBundle/src/Command/OptimizeImageThumbnailsCommand.php @@ -33,7 +33,7 @@ public function __construct(private ImageOptimizerInterface $optimizer) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('pimcore:thumbnails:optimize-images') diff --git a/bundles/CoreBundle/src/Command/RecyclebinCleanupCommand.php b/bundles/CoreBundle/src/Command/RecyclebinCleanupCommand.php index f913c15c9b6..7b6b15abe3e 100644 --- a/bundles/CoreBundle/src/Command/RecyclebinCleanupCommand.php +++ b/bundles/CoreBundle/src/Command/RecyclebinCleanupCommand.php @@ -28,7 +28,7 @@ */ class RecyclebinCleanupCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:recyclebin:cleanup') diff --git a/bundles/CoreBundle/src/Command/RequirementsCheckCommand.php b/bundles/CoreBundle/src/Command/RequirementsCheckCommand.php index e483e34f22c..8436af3359c 100644 --- a/bundles/CoreBundle/src/Command/RequirementsCheckCommand.php +++ b/bundles/CoreBundle/src/Command/RequirementsCheckCommand.php @@ -34,7 +34,7 @@ class RequirementsCheckCommand extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setName('pimcore:system:requirements:check') diff --git a/bundles/CoreBundle/src/Command/ResetPasswordCommand.php b/bundles/CoreBundle/src/Command/ResetPasswordCommand.php index e93505e9535..7ea5e72c03c 100644 --- a/bundles/CoreBundle/src/Command/ResetPasswordCommand.php +++ b/bundles/CoreBundle/src/Command/ResetPasswordCommand.php @@ -31,7 +31,7 @@ */ class ResetPasswordCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:user:reset-password') @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - protected function askForPassword(InputInterface $input, OutputInterface $output) + protected function askForPassword(InputInterface $input, OutputInterface $output): mixed { /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); diff --git a/bundles/CoreBundle/src/Command/RunScriptCommand.php b/bundles/CoreBundle/src/Command/RunScriptCommand.php index adf0c90009c..d21e5ba48c5 100644 --- a/bundles/CoreBundle/src/Command/RunScriptCommand.php +++ b/bundles/CoreBundle/src/Command/RunScriptCommand.php @@ -29,7 +29,7 @@ class RunScriptCommand extends AbstractCommand { use DryRun; - protected function configure() + protected function configure(): void { $this ->setName('pimcore:run-script') diff --git a/bundles/CoreBundle/src/Command/SearchBackendReindexCommand.php b/bundles/CoreBundle/src/Command/SearchBackendReindexCommand.php index d4c58c255f3..171b0cc53a3 100644 --- a/bundles/CoreBundle/src/Command/SearchBackendReindexCommand.php +++ b/bundles/CoreBundle/src/Command/SearchBackendReindexCommand.php @@ -30,7 +30,7 @@ */ class SearchBackendReindexCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:search-backend-reindex') diff --git a/bundles/CoreBundle/src/Command/ThumbnailsClearCommand.php b/bundles/CoreBundle/src/Command/ThumbnailsClearCommand.php index 07b8ddbdead..b7b4d979af6 100644 --- a/bundles/CoreBundle/src/Command/ThumbnailsClearCommand.php +++ b/bundles/CoreBundle/src/Command/ThumbnailsClearCommand.php @@ -27,7 +27,7 @@ */ class ThumbnailsClearCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('pimcore:thumbnails:clear') diff --git a/bundles/CoreBundle/src/Command/ThumbnailsImageCommand.php b/bundles/CoreBundle/src/Command/ThumbnailsImageCommand.php index bdf8f445a70..96d8f6f7101 100644 --- a/bundles/CoreBundle/src/Command/ThumbnailsImageCommand.php +++ b/bundles/CoreBundle/src/Command/ThumbnailsImageCommand.php @@ -31,7 +31,7 @@ class ThumbnailsImageCommand extends AbstractCommand { use Parallelization; - protected function configure() + protected function configure(): void { parent::configure(); self::configureCommand($this); diff --git a/bundles/CoreBundle/src/Command/ThumbnailsVideoCommand.php b/bundles/CoreBundle/src/Command/ThumbnailsVideoCommand.php index 05ce2869abe..f0b16c47b4e 100644 --- a/bundles/CoreBundle/src/Command/ThumbnailsVideoCommand.php +++ b/bundles/CoreBundle/src/Command/ThumbnailsVideoCommand.php @@ -32,7 +32,7 @@ class ThumbnailsVideoCommand extends AbstractCommand { use Parallelization; - protected function configure() + protected function configure(): void { parent::configure(); self::configureCommand($this); @@ -132,7 +132,7 @@ protected function runSingleCommand(string $item, InputInterface $input, OutputI } } - protected function waitTillFinished(int $videoId, string|Asset\Video\Thumbnail\Config $thumbnail) + protected function waitTillFinished(int $videoId, string|Asset\Video\Thumbnail\Config $thumbnail): void { $finished = false; diff --git a/bundles/CoreBundle/src/Command/WorkflowDumpCommand.php b/bundles/CoreBundle/src/Command/WorkflowDumpCommand.php index df158fde548..28971de54ac 100644 --- a/bundles/CoreBundle/src/Command/WorkflowDumpCommand.php +++ b/bundles/CoreBundle/src/Command/WorkflowDumpCommand.php @@ -35,7 +35,7 @@ class WorkflowDumpCommand extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setDefinition([ diff --git a/bundles/CoreBundle/src/DataCollector/PimcoreDataCollector.php b/bundles/CoreBundle/src/DataCollector/PimcoreDataCollector.php index ac669d6b990..47f063640c7 100644 --- a/bundles/CoreBundle/src/DataCollector/PimcoreDataCollector.php +++ b/bundles/CoreBundle/src/DataCollector/PimcoreDataCollector.php @@ -33,7 +33,7 @@ public function __construct( ) { } - public function collect(Request $request, Response $response, ?\Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->data = [ 'version' => Version::getVersion(), @@ -42,7 +42,7 @@ public function collect(Request $request, Response $response, ?\Throwable $excep ]; } - public function reset() + public function reset(): void { $this->data = []; } diff --git a/bundles/CoreBundle/src/DataCollector/PimcoreTargetingDataCollector.php b/bundles/CoreBundle/src/DataCollector/PimcoreTargetingDataCollector.php index 3cce058cd87..51f65f010ae 100644 --- a/bundles/CoreBundle/src/DataCollector/PimcoreTargetingDataCollector.php +++ b/bundles/CoreBundle/src/DataCollector/PimcoreTargetingDataCollector.php @@ -42,7 +42,7 @@ public function getName(): string return 'pimcore_targeting'; } - public function collect(Request $request, Response $response, ?\Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->data = []; @@ -66,37 +66,37 @@ public function collect(Request $request, Response $response, ?\Throwable $excep $this->data = $this->cloneVar($data); } - public function reset() + public function reset(): void { $this->data = []; } - public function getVisitorInfo() + public function getVisitorInfo(): array { return $this->data['visitor_info']; } - public function getStorage() + public function getStorage(): array { return $this->data['storage']; } - public function getRules() + public function getRules(): array { return $this->data['rules']; } - public function getTargetGroups() + public function getTargetGroups(): array { return $this->data['target_groups']; } - public function getDocumentTargetGroup() + public function getDocumentTargetGroup(): ?array { return $this->data['document_target_group']; } - public function getDocumentTargetGroups() + public function getDocumentTargetGroups(): array { return $this->data['document_target_groups']; } diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/AreabrickPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/AreabrickPass.php index 8c8b3c63c9b..4e88c52c298 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/AreabrickPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/AreabrickPass.php @@ -46,7 +46,7 @@ public function __construct() /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $config = $container->getParameter('pimcore.config'); @@ -176,7 +176,7 @@ private function handleEditableRendererCall(Definition $definition): void * @param Definition $definition * @param \ReflectionClass|null $reflector */ - protected function handleContainerAwareDefinition(ContainerBuilder $container, Definition $definition, \ReflectionClass $reflector = null) + protected function handleContainerAwareDefinition(ContainerBuilder $container, Definition $definition, \ReflectionClass $reflector = null): void { if (null === $reflector) { $reflector = new \ReflectionClass($definition->getClass()); diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/CacheFallbackPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/CacheFallbackPass.php index c6b96ea17c4..f9d03e0a272 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/CacheFallbackPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/CacheFallbackPass.php @@ -27,7 +27,7 @@ */ final class CacheFallbackPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('pimcore.cache.pool')) { $alias = new Alias('pimcore.cache.adapter.doctrine_dbal_tag_aware', true); diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/DebugStopwatchPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/DebugStopwatchPass.php index 6cdc70b7bc0..40582e36b03 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/DebugStopwatchPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/DebugStopwatchPass.php @@ -34,7 +34,7 @@ */ final class DebugStopwatchPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $debug = $container->getParameter('kernel.debug'); if (!$debug) { diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/LongRunningHelperPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/LongRunningHelperPass.php index 8a743f1f36c..e6ebbf96fbb 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/LongRunningHelperPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/LongRunningHelperPass.php @@ -32,7 +32,7 @@ final class LongRunningHelperPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $helperDefinition = $container->getDefinition(LongRunningHelper::class); foreach ($container->getDefinitions() as $serviceId => $definition) { diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/MessageBusPublicPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/MessageBusPublicPass.php index 4a7ed8a9ed2..85260955b8c 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/MessageBusPublicPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/MessageBusPublicPass.php @@ -25,7 +25,7 @@ */ final class MessageBusPublicPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $container->getDefinition('messenger.bus.pimcore-core')->setPublic(true); } diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPsrLogMessageProcessorPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPsrLogMessageProcessorPass.php index dca8bf454f4..201b76a946b 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPsrLogMessageProcessorPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPsrLogMessageProcessorPass.php @@ -30,7 +30,7 @@ */ class MonologPsrLogMessageProcessorPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $processorId = 'monolog.processor.psr_log_message'; diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPublicLoggerPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPublicLoggerPass.php index cea6f21f0c2..fb0c0375731 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPublicLoggerPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/MonologPublicLoggerPass.php @@ -25,7 +25,7 @@ */ final class MonologPublicLoggerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $loggerPrefix = 'monolog.logger.'; $serviceIds = array_filter($container->getServiceIds(), function (string $id) use ($loggerPrefix) { diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/NavigationRendererPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/NavigationRendererPass.php index 00873a908ff..4848f8afdab 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/NavigationRendererPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/NavigationRendererPass.php @@ -32,7 +32,7 @@ final class NavigationRendererPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $taggedServices = $container->findTaggedServiceIds('pimcore.navigation.renderer'); diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/ProfilerAliasPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/ProfilerAliasPass.php index 0e14bdf3b1f..c01924aebb7 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/ProfilerAliasPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/ProfilerAliasPass.php @@ -28,7 +28,7 @@ final class ProfilerAliasPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('profiler')) { return; diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterImageOptimizersPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterImageOptimizersPass.php index a21fefa9db7..393022ba630 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterImageOptimizersPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterImageOptimizersPass.php @@ -29,7 +29,7 @@ final class RegisterImageOptimizersPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(Optimizer::class)) { return; diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterMaintenanceTaskPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterMaintenanceTaskPass.php index 20b15afed67..b6d696331cc 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterMaintenanceTaskPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/RegisterMaintenanceTaskPass.php @@ -29,7 +29,7 @@ final class RegisterMaintenanceTaskPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(Executor::class)) { return; diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/RoutingLoaderPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/RoutingLoaderPass.php index 0cf351c3666..627b8b89554 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/RoutingLoaderPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/RoutingLoaderPass.php @@ -33,7 +33,7 @@ final class RoutingLoaderPass implements CompilerPassInterface * * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('routing.loader.annotation')) { return; diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/ServiceControllersPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/ServiceControllersPass.php index 7537f64ec1d..f999e0a5555 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/ServiceControllersPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/ServiceControllersPass.php @@ -33,7 +33,7 @@ */ final class ServiceControllersPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $serviceControllers = []; diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/TargetingOverrideHandlersPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/TargetingOverrideHandlersPass.php index fd2d2dc073e..cf90f5ff258 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/TargetingOverrideHandlersPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/TargetingOverrideHandlersPass.php @@ -29,7 +29,7 @@ final class TargetingOverrideHandlersPass implements CompilerPassInterface { use PriorityTaggedServiceTrait; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $handlers = $this->findAndSortTaggedServices('pimcore.targeting.override_handler', $container); diff --git a/bundles/CoreBundle/src/DependencyInjection/Compiler/WorkflowPass.php b/bundles/CoreBundle/src/DependencyInjection/Compiler/WorkflowPass.php index ec25a02eec5..bf7f85a568f 100644 --- a/bundles/CoreBundle/src/DependencyInjection/Compiler/WorkflowPass.php +++ b/bundles/CoreBundle/src/DependencyInjection/Compiler/WorkflowPass.php @@ -39,7 +39,7 @@ final class WorkflowPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $loader = new YamlFileLoader( $container, diff --git a/bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php b/bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php index a2c006195a6..98e8cf99d22 100644 --- a/bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php +++ b/bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php @@ -54,7 +54,7 @@ public function getAlias(): string /** * {@inheritdoc} */ - public function loadInternal(array $config, ContainerBuilder $container) + public function loadInternal(array $config, ContainerBuilder $container): void { // on container build the shutdown handler shouldn't be called // for details please see https://github.com/pimcore/pimcore/issues/4709 @@ -395,7 +395,7 @@ private function addContextRoutes(ContainerBuilder $container, array $config): v * * {@inheritdoc} */ - public function prepend(ContainerBuilder $container) + public function prepend(ContainerBuilder $container): void { /*$securityConfigs = $container->getExtensionConfig('security'); diff --git a/bundles/CoreBundle/src/EventListener/DumpTranslationEntriesListener.php b/bundles/CoreBundle/src/EventListener/DumpTranslationEntriesListener.php index 66fdd731694..1abaf1cfd9d 100644 --- a/bundles/CoreBundle/src/EventListener/DumpTranslationEntriesListener.php +++ b/bundles/CoreBundle/src/EventListener/DumpTranslationEntriesListener.php @@ -47,12 +47,12 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelTerminate(TerminateEvent $event) + public function onKernelTerminate(TerminateEvent $event): void { $this->dumper->dumpToDb(); } - public function onConsoleTerminate(ConsoleTerminateEvent $event) + public function onConsoleTerminate(ConsoleTerminateEvent $event): void { $this->dumper->dumpToDb(); } diff --git a/bundles/CoreBundle/src/EventListener/ElementTagsListener.php b/bundles/CoreBundle/src/EventListener/ElementTagsListener.php index 1c8419417d2..09b64e84652 100644 --- a/bundles/CoreBundle/src/EventListener/ElementTagsListener.php +++ b/bundles/CoreBundle/src/EventListener/ElementTagsListener.php @@ -43,7 +43,7 @@ public static function getSubscribedEvents(): array ]; } - public function onPostCopy(ElementEventInterface $e) + public function onPostCopy(ElementEventInterface $e): void { $elementType = Service::getElementType($e->getElement()); $copiedElement = $e->getElement(); @@ -56,7 +56,7 @@ public function onPostCopy(ElementEventInterface $e) ); } - public function onPostAssetDelete(AssetEvent $e) + public function onPostAssetDelete(AssetEvent $e): void { $asset = $e->getAsset(); \Pimcore\Model\Element\Tag::setTagsForElement('asset', $asset->getId(), []); diff --git a/bundles/CoreBundle/src/EventListener/EventedControllerListener.php b/bundles/CoreBundle/src/EventListener/EventedControllerListener.php index 62e114d6572..713f1837395 100644 --- a/bundles/CoreBundle/src/EventListener/EventedControllerListener.php +++ b/bundles/CoreBundle/src/EventListener/EventedControllerListener.php @@ -39,7 +39,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelController(ControllerEvent $event) + public function onKernelController(ControllerEvent $event): void { $callable = $event->getController(); if (!is_array($callable)) { @@ -56,7 +56,7 @@ public function onKernelController(ControllerEvent $event) } } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $request = $event->getRequest(); $eventController = $request->attributes->get('_event_controller'); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/BlockStateListener.php b/bundles/CoreBundle/src/EventListener/Frontend/BlockStateListener.php index 4a36ff6fdf9..afe5be221a4 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/BlockStateListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/BlockStateListener.php @@ -51,7 +51,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -73,7 +73,7 @@ public function onKernelRequest(RequestEvent $event) $this->blockStateStack->push(); } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $request = $event->getRequest(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/ContentTemplateListener.php b/bundles/CoreBundle/src/EventListener/Frontend/ContentTemplateListener.php index cc6f5125dc9..c39741aaea3 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/ContentTemplateListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/ContentTemplateListener.php @@ -55,7 +55,7 @@ public static function getSubscribedEvents(): array * * @param ViewEvent $event */ - public function onKernelView(ViewEvent $event) + public function onKernelView(ViewEvent $event): void { $request = $event->getRequest(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/DocumentFallbackListener.php b/bundles/CoreBundle/src/EventListener/Frontend/DocumentFallbackListener.php index b041f00f6e3..e04ef6b0d5a 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/DocumentFallbackListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/DocumentFallbackListener.php @@ -59,7 +59,7 @@ public function __construct( $this->options = $optionsResolver->resolve($options); } - protected function configureOptions(OptionsResolver $optionsResolver) + protected function configureOptions(OptionsResolver $optionsResolver): void { $optionsResolver->setDefaults([ 'nearestDocumentTypes' => ['page', 'snippet', 'hardlink', 'link', 'folder'], @@ -87,7 +87,7 @@ public static function getSubscribedEvents(): array * * @param RequestEvent $event */ - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); if (!$this->matchesPimcoreContext($request, PimcoreContextResolver::CONTEXT_DEFAULT)) { @@ -142,7 +142,7 @@ public function onKernelRequest(RequestEvent $event) } } - public function onKernelController(ControllerEvent $event) + public function onKernelController(ControllerEvent $event): void { $controller = $event->getController(); if (is_array($controller) && isset($controller[0]) && $controller[0] instanceof PublicServicesController) { diff --git a/bundles/CoreBundle/src/EventListener/Frontend/DocumentMetaDataListener.php b/bundles/CoreBundle/src/EventListener/Frontend/DocumentMetaDataListener.php index c533d924373..d032fccec64 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/DocumentMetaDataListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/DocumentMetaDataListener.php @@ -55,7 +55,7 @@ public static function getSubscribedEvents(): array * * @param RequestEvent $event */ - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/DocumentRendererListener.php b/bundles/CoreBundle/src/EventListener/Frontend/DocumentRendererListener.php index b38b7b7b639..8a28f2c8006 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/DocumentRendererListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/DocumentRendererListener.php @@ -42,13 +42,13 @@ public static function getSubscribedEvents(): array ]; } - public function onPreRender() + public function onPreRender(): void { // when rendering a new document, the index is pushed to create a new, empty context $this->containerService->pushIndex(); } - public function onPostRender() + public function onPostRender(): void { $this->containerService->popIndex(); } diff --git a/bundles/CoreBundle/src/EventListener/Frontend/EditmodeListener.php b/bundles/CoreBundle/src/EventListener/Frontend/EditmodeListener.php index 8c0701e395b..5e966489b2f 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/EditmodeListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/EditmodeListener.php @@ -68,7 +68,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -85,7 +85,7 @@ public function onKernelRequest(RequestEvent $event) $this->editmodeResolver->isEditmode($request); } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $request = $event->getRequest(); $response = $event->getResponse(); @@ -144,7 +144,7 @@ protected function contentTypeMatches(Response $response): bool * @param Document $document * @param Response $response */ - protected function addEditmodeAssets(Document $document, Response $response) + protected function addEditmodeAssets(Document $document, Response $response): void { if (Document\Service::isValidType($document->getType())) { $html = $response->getContent(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/ElementListener.php b/bundles/CoreBundle/src/EventListener/Frontend/ElementListener.php index 6b742e36e0a..09b11bbe06c 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/ElementListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/ElementListener.php @@ -65,7 +65,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelController(ControllerEvent $event) + public function onKernelController(ControllerEvent $event): void { if ($event->isMainRequest()) { $request = $event->getRequest(); @@ -128,7 +128,7 @@ protected function handleVersion(Request $request, Document $document): Document return $document; } - protected function applyTargetGroups(Request $request, Document $document) + protected function applyTargetGroups(Request $request, Document $document): void { if (!$document instanceof Document\Targeting\TargetingDocumentInterface || null !== Staticroute::getCurrentRoute()) { return; @@ -230,7 +230,7 @@ protected function handleEditmode(Document $document, User $user): Document return $document; } - protected function handleObjectParams(Request $request) + protected function handleObjectParams(Request $request): void { // object preview if ($objectId = $request->get('pimcore_object_preview')) { diff --git a/bundles/CoreBundle/src/EventListener/Frontend/GlobalTemplateVariablesListener.php b/bundles/CoreBundle/src/EventListener/Frontend/GlobalTemplateVariablesListener.php index 30941da417e..3fc915f35cc 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/GlobalTemplateVariablesListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/GlobalTemplateVariablesListener.php @@ -58,7 +58,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { // set the variables as soon as possible, so that we're not getting troubles in // onKernelController() if the twig environment was already initialized before @@ -70,7 +70,7 @@ public function onKernelRequest(RequestEvent $event) } } - public function onKernelController(ControllerEvent $event) + public function onKernelController(ControllerEvent $event): void { $request = $event->getRequest(); if (!$this->matchesPimcoreContext($request, PimcoreContextResolver::CONTEXT_DEFAULT)) { @@ -90,7 +90,7 @@ public function onKernelController(ControllerEvent $event) } } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (count($this->globalsStack)) { $globals = array_pop($this->globalsStack); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/GoogleSearchConsoleVerificationListener.php b/bundles/CoreBundle/src/EventListener/Frontend/GoogleSearchConsoleVerificationListener.php index 58c50a37f6a..420513a1249 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/GoogleSearchConsoleVerificationListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/GoogleSearchConsoleVerificationListener.php @@ -37,7 +37,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); if (!$event->isMainRequest()) { diff --git a/bundles/CoreBundle/src/EventListener/Frontend/HardlinkCanonicalListener.php b/bundles/CoreBundle/src/EventListener/Frontend/HardlinkCanonicalListener.php index 4a1b6401b78..f25d1377388 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/HardlinkCanonicalListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/HardlinkCanonicalListener.php @@ -53,7 +53,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $request = $event->getRequest(); @@ -75,7 +75,7 @@ public function onKernelResponse(ResponseEvent $event) } } - protected function handleHardlink(Request $request, Response $response, Document $document) + protected function handleHardlink(Request $request, Response $response, Document $document): void { $canonical = null; diff --git a/bundles/CoreBundle/src/EventListener/Frontend/InternalWysiwygHtmlAttributeFilterListener.php b/bundles/CoreBundle/src/EventListener/Frontend/InternalWysiwygHtmlAttributeFilterListener.php index f59b71588a2..7ee46cd07f9 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/InternalWysiwygHtmlAttributeFilterListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/InternalWysiwygHtmlAttributeFilterListener.php @@ -41,7 +41,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $request = $event->getRequest(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/LocaleListener.php b/bundles/CoreBundle/src/EventListener/Frontend/LocaleListener.php index 9b52ef16ab2..eee1f2e77a2 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/LocaleListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/LocaleListener.php @@ -42,7 +42,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -74,7 +74,7 @@ public function onKernelRequest(RequestEvent $event) } } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if ($this->lastLocale && $event->isMainRequest()) { $response = $event->getResponse(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/OutputTimestampListener.php b/bundles/CoreBundle/src/EventListener/Frontend/OutputTimestampListener.php index b501222fff7..26a1643b8f3 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/OutputTimestampListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/OutputTimestampListener.php @@ -44,7 +44,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/CoreBundle/src/EventListener/Frontend/RoutingListener.php b/bundles/CoreBundle/src/EventListener/Frontend/RoutingListener.php index 75bd67872ff..361f36ac4fd 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/RoutingListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/RoutingListener.php @@ -64,7 +64,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; @@ -109,7 +109,7 @@ public function onKernelRequest(RequestEvent $event) } } - public function onKernelException(ExceptionEvent $event) + public function onKernelException(ExceptionEvent $event): void { // in case routing didn't find a matching route, check for redirects without override $exception = $event->getThrowable(); @@ -150,7 +150,7 @@ protected function resolveSite(Request $request, string $path): string return $path; } - protected function handleFrontControllerRedirect(RequestEvent $event, string $path) + protected function handleFrontControllerRedirect(RequestEvent $event, string $path): void { $request = $event->getRequest(); @@ -171,7 +171,7 @@ protected function handleFrontControllerRedirect(RequestEvent $event, string $pa * @param RequestEvent $event * @param bool $adminContext */ - protected function handleMainDomainRedirect(RequestEvent $event, bool $adminContext = false) + protected function handleMainDomainRedirect(RequestEvent $event, bool $adminContext = false): void { $request = $event->getRequest(); diff --git a/bundles/CoreBundle/src/EventListener/Frontend/StaticPageGeneratorListener.php b/bundles/CoreBundle/src/EventListener/Frontend/StaticPageGeneratorListener.php index 441a44042ae..9402538d4a2 100644 --- a/bundles/CoreBundle/src/EventListener/Frontend/StaticPageGeneratorListener.php +++ b/bundles/CoreBundle/src/EventListener/Frontend/StaticPageGeneratorListener.php @@ -64,7 +64,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; @@ -118,7 +118,7 @@ public function onKernelRequest(RequestEvent $event) } } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (!$event->isMainRequest()) { return; @@ -148,7 +148,7 @@ public function onKernelResponse(ResponseEvent $event) } } - public function onPostAddUpdateDeleteDocument(DocumentEvent $e) + public function onPostAddUpdateDeleteDocument(DocumentEvent $e): void { $document = $e->getDocument(); diff --git a/bundles/CoreBundle/src/EventListener/MessengerClearRuntimeCacheListener.php b/bundles/CoreBundle/src/EventListener/MessengerClearRuntimeCacheListener.php index bdc6558a657..d2ed8782c10 100644 --- a/bundles/CoreBundle/src/EventListener/MessengerClearRuntimeCacheListener.php +++ b/bundles/CoreBundle/src/EventListener/MessengerClearRuntimeCacheListener.php @@ -36,7 +36,7 @@ public static function getSubscribedEvents(): array ]; } - public function handle(WorkerMessageReceivedEvent $event) + public function handle(WorkerMessageReceivedEvent $event): void { RuntimeCache::clear(); } diff --git a/bundles/CoreBundle/src/EventListener/PimcoreContextListener.php b/bundles/CoreBundle/src/EventListener/PimcoreContextListener.php index 968ebf7a143..5871ba9cb8c 100644 --- a/bundles/CoreBundle/src/EventListener/PimcoreContextListener.php +++ b/bundles/CoreBundle/src/EventListener/PimcoreContextListener.php @@ -54,7 +54,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -82,7 +82,7 @@ public function onKernelRequest(RequestEvent $event) * @param string $context * @param Request $request */ - protected function initializeContext(string $context, Request $request) + protected function initializeContext(string $context, Request $request): void { if ($context == PimcoreContextResolver::CONTEXT_ADMIN) { \Pimcore::setAdminMode(); diff --git a/bundles/CoreBundle/src/EventListener/PimcoreHeaderListener.php b/bundles/CoreBundle/src/EventListener/PimcoreHeaderListener.php index e779975c693..5a8ef81c324 100644 --- a/bundles/CoreBundle/src/EventListener/PimcoreHeaderListener.php +++ b/bundles/CoreBundle/src/EventListener/PimcoreHeaderListener.php @@ -32,7 +32,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if ($event->isMainRequest()) { $response = $event->getResponse(); diff --git a/bundles/CoreBundle/src/EventListener/ResponseExceptionListener.php b/bundles/CoreBundle/src/EventListener/ResponseExceptionListener.php index d5f8bd47e43..abe43e6d7cd 100644 --- a/bundles/CoreBundle/src/EventListener/ResponseExceptionListener.php +++ b/bundles/CoreBundle/src/EventListener/ResponseExceptionListener.php @@ -60,7 +60,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelException(ExceptionEvent $event) + public function onKernelException(ExceptionEvent $event): void { $exception = $event->getThrowable(); @@ -79,7 +79,7 @@ public function onKernelException(ExceptionEvent $event) } } - protected function handleErrorPage(ExceptionEvent $event) + protected function handleErrorPage(ExceptionEvent $event): void { if (\Pimcore::inDebugMode()) { return; diff --git a/bundles/CoreBundle/src/EventListener/ResponseHeaderListener.php b/bundles/CoreBundle/src/EventListener/ResponseHeaderListener.php index b365ea817fc..8415e1c8053 100644 --- a/bundles/CoreBundle/src/EventListener/ResponseHeaderListener.php +++ b/bundles/CoreBundle/src/EventListener/ResponseHeaderListener.php @@ -41,7 +41,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $headers = $this->responseHeaderResolver->getResponseHeaders($event->getRequest()); diff --git a/bundles/CoreBundle/src/EventListener/ResponseStackListener.php b/bundles/CoreBundle/src/EventListener/ResponseStackListener.php index 4db02829d86..fec83d0e761 100644 --- a/bundles/CoreBundle/src/EventListener/ResponseStackListener.php +++ b/bundles/CoreBundle/src/EventListener/ResponseStackListener.php @@ -41,7 +41,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/CoreBundle/src/EventListener/SearchBackendListener.php b/bundles/CoreBundle/src/EventListener/SearchBackendListener.php index 42a3729670a..8c73ce67f6b 100644 --- a/bundles/CoreBundle/src/EventListener/SearchBackendListener.php +++ b/bundles/CoreBundle/src/EventListener/SearchBackendListener.php @@ -57,7 +57,7 @@ public static function getSubscribedEvents(): array ]; } - public function onPostAddUpdateElement(ElementEventInterface $e) + public function onPostAddUpdateElement(ElementEventInterface $e): void { //do not update index when auto save or only saving version if ( @@ -74,7 +74,7 @@ public function onPostAddUpdateElement(ElementEventInterface $e) ); } - public function onPreDeleteElement(ElementEventInterface $e) + public function onPreDeleteElement(ElementEventInterface $e): void { $searchEntry = Data::getForElement($e->getElement()); if ($searchEntry instanceof Data && $searchEntry->getId() instanceof Data\Id) { diff --git a/bundles/CoreBundle/src/EventListener/Traits/ResponseInjectionTrait.php b/bundles/CoreBundle/src/EventListener/Traits/ResponseInjectionTrait.php index de4950a6fd6..50e6956afad 100644 --- a/bundles/CoreBundle/src/EventListener/Traits/ResponseInjectionTrait.php +++ b/bundles/CoreBundle/src/EventListener/Traits/ResponseInjectionTrait.php @@ -39,7 +39,7 @@ protected function isHtmlResponse(Response $response): bool return $this->responseHelper->isHtmlResponse($response); } - protected function injectBeforeHeadEnd(Response $response, $code): void + protected function injectBeforeHeadEnd(Response $response, string $code): void { $content = $response->getContent(); diff --git a/bundles/CoreBundle/src/EventListener/TranslationDebugListener.php b/bundles/CoreBundle/src/EventListener/TranslationDebugListener.php index b74100a049a..abb9023562c 100644 --- a/bundles/CoreBundle/src/EventListener/TranslationDebugListener.php +++ b/bundles/CoreBundle/src/EventListener/TranslationDebugListener.php @@ -44,7 +44,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/CoreBundle/src/EventListener/UUIDListener.php b/bundles/CoreBundle/src/EventListener/UUIDListener.php index 91d52900cbe..f0138c812d0 100644 --- a/bundles/CoreBundle/src/EventListener/UUIDListener.php +++ b/bundles/CoreBundle/src/EventListener/UUIDListener.php @@ -49,7 +49,7 @@ public static function getSubscribedEvents(): array ]; } - public function onPostAdd(Event $e) + public function onPostAdd(Event $e): void { if ($this->isEnabled()) { $element = $this->extractElement($e); @@ -60,7 +60,7 @@ public function onPostAdd(Event $e) } } - public function onPostDelete(Event $e) + public function onPostDelete(Event $e): void { if ($this->isEnabled()) { $element = $this->extractElement($e); diff --git a/bundles/CoreBundle/src/EventListener/WebDebugToolbarListener.php b/bundles/CoreBundle/src/EventListener/WebDebugToolbarListener.php index 6afab637059..c66b78bc32e 100644 --- a/bundles/CoreBundle/src/EventListener/WebDebugToolbarListener.php +++ b/bundles/CoreBundle/src/EventListener/WebDebugToolbarListener.php @@ -56,7 +56,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelResponse(RequestEvent $event) + public function onKernelResponse(RequestEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/bundles/CoreBundle/src/EventListener/WorkflowManagementListener.php b/bundles/CoreBundle/src/EventListener/WorkflowManagementListener.php index 6285b3fcfac..c6bf1099e7f 100644 --- a/bundles/CoreBundle/src/EventListener/WorkflowManagementListener.php +++ b/bundles/CoreBundle/src/EventListener/WorkflowManagementListener.php @@ -99,7 +99,7 @@ public function onElementPostAdd(ElementEventInterface $e): void * * @param ElementEventInterface $e */ - public function onElementPostDelete(ElementEventInterface $e) + public function onElementPostDelete(ElementEventInterface $e): void { /** * @var Asset|Document|ConcreteObject $element @@ -121,7 +121,7 @@ public function onElementPostDelete(ElementEventInterface $e) * * @throws \Exception */ - public function onAdminElementGetPreSendData(GenericEvent $e) + public function onAdminElementGetPreSendData(GenericEvent $e): void { $element = self::extractElementFromEvent($e); $data = $e->getArgument('data'); @@ -238,12 +238,12 @@ private static function extractElementFromEvent(GenericEvent $e): ElementInterfa return $element; } - public function enable() + public function enable(): void { $this->enabled = true; } - public function disable() + public function disable(): void { $this->enabled = false; } diff --git a/bundles/CoreBundle/src/Migrations/Version20221028115803.php b/bundles/CoreBundle/src/Migrations/Version20221028115803.php index 8e69d1cccad..04598475790 100644 --- a/bundles/CoreBundle/src/Migrations/Version20221028115803.php +++ b/bundles/CoreBundle/src/Migrations/Version20221028115803.php @@ -41,7 +41,7 @@ public function down(Schema $schema): void /** * @throws \Exception */ - private function regenerateClassesWithFieldCollections() + private function regenerateClassesWithFieldCollections(): void { $listing = new Listing(); foreach ($listing->getClasses() as $class) { diff --git a/bundles/CoreBundle/src/Migrations/Version20221129084031.php b/bundles/CoreBundle/src/Migrations/Version20221129084031.php index 4a68ea45bbd..c669c1b8698 100644 --- a/bundles/CoreBundle/src/Migrations/Version20221129084031.php +++ b/bundles/CoreBundle/src/Migrations/Version20221129084031.php @@ -41,7 +41,7 @@ public function down(Schema $schema): void /** * @throws \Exception */ - private function regenerateObjectBricks() + private function regenerateObjectBricks(): void { $list = new Listing(); foreach ($list->load() as $brickDefinition) { diff --git a/bundles/CoreBundle/src/PimcoreCoreBundle.php b/bundles/CoreBundle/src/PimcoreCoreBundle.php index b10e1a44dce..cf227daa7ee 100644 --- a/bundles/CoreBundle/src/PimcoreCoreBundle.php +++ b/bundles/CoreBundle/src/PimcoreCoreBundle.php @@ -66,7 +66,7 @@ public function getContainerExtension(): ?ExtensionInterface /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new AreabrickPass()); $container->addCompilerPass(new NavigationRendererPass()); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCart.php b/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCart.php index d1c2cf2f6c0..4eb7213a049 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCart.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCart.php @@ -459,7 +459,7 @@ public function getGiftItem(string $itemKey): ?CartItemInterface /** * @param CartItemInterface[]|null $items */ - public function setItems(?array $items) + public function setItems(?array $items): void { $this->items = $items; @@ -499,7 +499,7 @@ public function getIsBookable(): bool return true; } - public function setId(int|string $id) + public function setId(int|string $id): void { $this->id = $id; } @@ -532,7 +532,7 @@ public function setCreationDate(\DateTime $creationDate = null): void } } - public function setCreationDateTimestamp(int $creationDateTimestamp) + public function setCreationDateTimestamp(int $creationDateTimestamp): void { $this->creationDateTimestamp = $creationDateTimestamp; $this->creationDate = null; @@ -566,7 +566,7 @@ public function setModificationDate(\DateTime $modificationDate = null): void } } - public function setModificationDateTimestamp(int $modificationDateTimestamp) + public function setModificationDateTimestamp(int $modificationDateTimestamp): void { $this->modificationDateTimestamp = $modificationDateTimestamp; $this->modificationDate = null; @@ -582,7 +582,7 @@ public function getUserId(): int return $this->userId ?: Factory::getInstance()->getEnvironment()->getCurrentUserId(); } - public function setUserId(int $userId) + public function setUserId(int $userId): void { $this->userId = (int)$userId; } @@ -601,7 +601,7 @@ public function getCheckoutData(string $key): ?string return null; } - public function setCheckoutData(string $key, string $data) + public function setCheckoutData(string $key, string $data): void { $className = $this->getCartCheckoutDataClassName(); $value = new $className(); @@ -620,7 +620,7 @@ public function getPriceCalculator(): CartPriceCalculatorInterface return $this->priceCalculator; } - public function setPriceCalculator(CartPriceCalculatorInterface $priceCalculator) + public function setPriceCalculator(CartPriceCalculatorInterface $priceCalculator): void { $this->priceCalculator = $priceCalculator; } @@ -704,14 +704,7 @@ public function addVoucherToken(string $code): bool return false; } - /** - * Checks if an error code is a defined Voucher Error Code. - * - * @param int $errorCode - * - * @return bool - */ - public function isVoucherErrorCode($errorCode): bool + public function isVoucherErrorCode(int $errorCode): bool { return $errorCode > 0 && $errorCode < 10; } @@ -721,7 +714,7 @@ public function isVoucherErrorCode($errorCode): bool * * @throws InvalidConfigException */ - public function removeAllVoucherTokens() + public function removeAllVoucherTokens(): void { foreach ($this->getVoucherTokenCodes() as $code) { $this->removeVoucherToken($code); @@ -789,7 +782,7 @@ public function getPricingManagerTokenInformationDetails(): array /** * Checks if checkout data voucher tokens are valid reservations */ - protected function validateVoucherTokenReservations() + protected function validateVoucherTokenReservations(): void { if ($this->getVoucherTokenCodes()) { $order = Factory::getInstance()->getOrderManager()->getOrderFromCart($this); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartCheckoutData.php b/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartCheckoutData.php index 4b372e2c828..ffd7c11523b 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartCheckoutData.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartCheckoutData.php @@ -24,7 +24,7 @@ abstract class AbstractCartCheckoutData extends \Pimcore\Model\AbstractModel protected ?CartInterface $cart = null; - public function setCart(CartInterface $cart) + public function setCart(CartInterface $cart): void { $this->cart = $cart; } @@ -39,25 +39,19 @@ public function getCartId(): int|string|null return $this->getCart()->getId(); } - abstract public function save(); + abstract public function save(): void; - /** - * @param string $key - * @param int|string $cartId - * - * @return AbstractCartCheckoutData|null - */ - public static function getByKeyCartId($key, $cartId) + public static function getByKeyCartId(string $key, int|string $cartId): ?self { throw new \Exception('Not implemented.'); } - public static function removeAllFromCart(int|string $cartId) + public static function removeAllFromCart(int|string $cartId): void { throw new \Exception('Not implemented.'); } - public function setKey(string $key) + public function setKey(string $key): void { $this->key = $key; } @@ -67,7 +61,7 @@ public function getKey(): string return $this->key; } - public function setData(array|string|null $data) + public function setData(array|string|null $data): void { $this->data = $data; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartItem.php b/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartItem.php index 0da562bc47d..883e72fa224 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartItem.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/AbstractCartItem.php @@ -121,7 +121,7 @@ public function getCartId(): int|string|null return $this->cartId; } - public function setCartId(int|string|null $cartId) + public function setCartId(int|string|null $cartId): void { $this->cartId = $cartId; } @@ -135,7 +135,7 @@ public function getProductId(): ?int return $this->getProduct()->getId(); } - public function setProductId(int $productId) + public function setProductId(int $productId): void { if ($this->productId !== $productId && !$this->isLoading && $this->getCart()) { $this->getCart()->modified(); @@ -144,7 +144,7 @@ public function setProductId(int $productId) $this->product = null; } - public function setParentItemKey(string $parentItemKey) + public function setParentItemKey(string $parentItemKey): void { $this->parentItemKey = $parentItemKey; } @@ -154,7 +154,7 @@ public function getParentItemKey(): string return $this->parentItemKey; } - public function setItemKey(string $itemKey) + public function setItemKey(string $itemKey): void { $this->itemKey = $itemKey; } @@ -294,7 +294,7 @@ public function getName(): string * * @internal */ - public function setIsLoading(bool $isLoading) + public function setIsLoading(bool $isLoading): void { $this->isLoading = $isLoading; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Dao.php b/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Dao.php index b9181db5032..6d46c28e5dd 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Dao.php @@ -51,7 +51,7 @@ public function init(): void * * @throws NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE id=' . $this->db->quote($id)); if (empty($classRaw['id'])) { @@ -105,7 +105,7 @@ public function delete(): void $this->db->delete(self::TABLE_NAME, ['id' => $this->model->getId()]); } - public function setFieldsToSave(array $fields) + public function setFieldsToSave(array $fields): void { $this->fieldsToSave = $fields; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Listing/Dao.php b/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Listing/Dao.php index 59411554d34..0f1e083dff1 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Listing/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/Cart/Listing/Dao.php @@ -48,7 +48,7 @@ public function getTotalCount(): int } } - public function setCartClass($cartClass) + public function setCartClass(string $cartClass): void { $this->cartClass = $cartClass; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData.php index 6b8df006cb8..498a1b3ae60 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData.php @@ -26,18 +26,12 @@ */ class CartCheckoutData extends AbstractCartCheckoutData { - public function save() + public function save(): void { $this->getDao()->save(); } - /** - * @param string $key - * @param int|string $cartId - * - * @return AbstractCartCheckoutData|null - */ - public static function getByKeyCartId($key, $cartId) + public static function getByKeyCartId(string $key, int|string $cartId): ?AbstractCartCheckoutData { $cacheKey = CartCheckoutData\Dao::TABLE_NAME . '_' . $key . '_' . $cartId; @@ -58,7 +52,7 @@ public static function getByKeyCartId($key, $cartId) return $checkoutDataItem; } - public static function removeAllFromCart(int|string $cartId) + public static function removeAllFromCart(int|string $cartId): void { $checkoutDataItem = new self(); $checkoutDataItem->getDao()->removeAllFromCart($cartId); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData/Dao.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData/Dao.php index 289c1adb947..fb174facf31 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartCheckoutData/Dao.php @@ -53,7 +53,7 @@ public function init(): void * * @throws NotFoundException */ - public function getByKeyCartId(string $key, int|string $cartId) + public function getByKeyCartId(string $key, int|string $cartId): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE `key`=' . $this->db->quote($key). ' AND cartId = ' . $this->db->quote($cartId)); if (empty($classRaw)) { @@ -65,7 +65,7 @@ public function getByKeyCartId(string $key, int|string $cartId) /** * Save object to database */ - public function save() + public function save(): void { $this->update(); } @@ -104,7 +104,7 @@ public function delete(): void $this->db->delete(self::TABLE_NAME, ['key' => $this->model->getKey(), 'cartId' => $this->model->getCartId()]); } - public function removeAllFromCart(int|string $cartId) + public function removeAllFromCart(int|string $cartId): void { $this->db->delete(self::TABLE_NAME, ['cartId' => $cartId]); } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartFactory.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartFactory.php index 0470c1cc4d2..839f49c391c 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartFactory.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartFactory.php @@ -32,7 +32,7 @@ public function __construct(array $options = []) $this->options = $resolver->resolve($options); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired(['cart_class_name']); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartInterface.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartInterface.php index 8050da860da..617f2b90544 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartInterface.php @@ -42,7 +42,7 @@ interface CartInterface public function getId(): int|string|null; - public function setId(int|string $id); + public function setId(int|string $id): void; /** * @return CartItemInterface[] @@ -52,7 +52,7 @@ public function getItems(): array; /** * @param CartItemInterface[]|null $items */ - public function setItems(?array $items); + public function setItems(?array $items): void; public function isEmpty(): bool; @@ -184,7 +184,7 @@ public function modified(): static; * @param string $key * @param string $data */ - public function setCheckoutData(string $key, string $data); + public function setCheckoutData(string $key, string $data): void; /** * Get custom checkout data for cart with given key. @@ -303,5 +303,8 @@ public function getVoucherTokenCodes(): array; */ public function getPricingManagerTokenInformationDetails(): array; - public function isVoucherErrorCode($errorCode): bool; + /** + * Checks if an error code is a defined Voucher Error Code. + */ + public function isVoucherErrorCode(int $errorCode): bool; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem.php index b510c4f089a..37bedcf33ea 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem.php @@ -29,7 +29,7 @@ class CartItem extends AbstractCartItem implements CartItemInterface { protected int $sortIndex = 0; - public function setSortIndex(int $sortIndex) + public function setSortIndex(int $sortIndex): void { $this->sortIndex = (int)$sortIndex; } @@ -82,7 +82,7 @@ public static function getByCartIdItemKey(int|string $cartId, string $itemKey, s return $cartItem; } - public static function removeAllFromCart(int|string $cartId) + public static function removeAllFromCart(int|string $cartId): void { $cartItem = new static(); $cartItem->getDao()->removeAllFromCart($cartId); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Dao.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Dao.php index 1e69f19d480..2f827e435c0 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Dao.php @@ -53,7 +53,7 @@ public function init(): void * * @throws NotFoundException */ - public function getByCartIdItemKey(int|string $cartId, string $itemKey, string $parentKey = '') + public function getByCartIdItemKey(int|string $cartId, string $itemKey, string $parentKey = ''): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE itemKey=' . $this->db->quote($itemKey). ' AND cartId = ' . $this->db->quote($cartId) . ' AND parentItemKey = ' . $this->db->quote($parentKey)); if (empty($classRaw)) { @@ -70,7 +70,7 @@ public function getByCartIdItemKey(int|string $cartId, string $itemKey, string $ /** * Save object to database */ - public function save() + public function save(): void { $this->update(); } @@ -109,7 +109,7 @@ public function delete(): void $this->db->delete(self::TABLE_NAME, ['itemKey' => $this->model->getItemKey(), 'cartId' => $this->model->getCartId(), 'parentItemKey' => $this->model->getParentItemKey()]); } - public function removeAllFromCart(int|string $cartId) + public function removeAllFromCart(int|string $cartId): void { $this->db->delete(self::TABLE_NAME, ['cartId' => $cartId]); } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing.php index 49726fa924c..22a12d64485 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing.php @@ -58,7 +58,7 @@ public function setCartItems(array $cartItems): static return $this->setData($cartItems); } - public function setCartItemClassName(string $className) + public function setCartItemClassName(string $className): void { $this->getDao()->setClassName($className); } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing/Dao.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing/Dao.php index 5a91f755803..9ada6981b16 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItem/Listing/Dao.php @@ -52,7 +52,7 @@ public function getTotalAmount(): int return (int)$this->db->fetchOne('SELECT SUM(count) FROM `' . \Pimcore\Bundle\EcommerceFrameworkBundle\CartManager\CartItem\Dao::TABLE_NAME . '`' . $this->getCondition()); } - public function setClassName(string $className) + public function setClassName(string $className): void { $this->className = $className; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItemInterface.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItemInterface.php index 155b723c2b4..2c1c8a62769 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartItemInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartItemInterface.php @@ -86,7 +86,7 @@ public static function getByCartIdItemKey(int|string $cartId, string $itemKey, s * * @param int|string $cartId */ - public static function removeAllFromCart(int|string $cartId); + public static function removeAllFromCart(int|string $cartId): void; public function save(): void; diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculator.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculator.php index 9ae04b78279..35fbf5e7dd9 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculator.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculator.php @@ -82,7 +82,7 @@ public function __construct(EnvironmentInterface $environment, CartInterface $ca * (Re-)initialize standard price modificators, e.g. after removing an item from a cart * within the same request, such as an AJAX-call. */ - public function initModificators() + public function initModificators(): void { $this->reset(); @@ -107,7 +107,7 @@ protected function buildModificator(array $config): CartPriceModificatorInterfac return $modificator; } - protected function setModificatorConfig(array $modificatorConfig) + protected function setModificatorConfig(array $modificatorConfig): void { $resolver = new OptionsResolver(); $this->configureModificatorResolver($resolver); @@ -117,7 +117,7 @@ protected function setModificatorConfig(array $modificatorConfig) } } - protected function configureModificatorResolver(OptionsResolver $resolver) + protected function configureModificatorResolver(OptionsResolver $resolver): void { $resolver->setDefined(['class', 'options']); $resolver->setAllowedTypes('class', 'string'); @@ -134,7 +134,7 @@ protected function configureModificatorResolver(OptionsResolver $resolver) * * @throws UnsupportedException */ - public function calculate($ignorePricingRules = false): void + public function calculate(bool $ignorePricingRules = false): void { // sum up all item prices $subTotalNet = Decimal::zero(); @@ -249,7 +249,7 @@ public function calculate($ignorePricingRules = false): void } } - public function setPricingManager(PricingManagerInterface $pricingManager) + public function setPricingManager(PricingManagerInterface $pricingManager): void { $this->pricingManager = $pricingManager; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorFactory.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorFactory.php index 7304f984c61..bca0682bd42 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorFactory.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorFactory.php @@ -38,7 +38,7 @@ public function __construct(array $modificatorConfig, array $options = []) $this->options = $resolver->resolve($options); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('class'); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorInterface.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorInterface.php index 5091171491d..1c77a3fe81f 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceCalculatorInterface.php @@ -37,13 +37,12 @@ public function __construct(EnvironmentInterface $environment, CartInterface $ca * (Re-)initialize standard price modificators, e.g. after removing an item from a cart * within the same request, such as an AJAX-call. */ - public function initModificators(); + public function initModificators(): void; /** * Calculates cart sums and saves results - * */ - public function calculate($ignorePricingRules = false): void; + public function calculate(bool $ignorePricingRules = false): void; /** * Reset calculations diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceModificator/Shipping.php b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceModificator/Shipping.php index 01619150514..15554b9e5f1 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceModificator/Shipping.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/CartPriceModificator/Shipping.php @@ -40,12 +40,12 @@ public function __construct(array $options = []) $this->processOptions($resolver->resolve($options)); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $this->charge = Decimal::create($options['charge']); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'charge' => 0, @@ -93,7 +93,7 @@ public function getTaxClass(): ?OnlineShopTaxClass return $this->taxClass; } - public function setTaxClass(OnlineShopTaxClass $taxClass) + public function setTaxClass(OnlineShopTaxClass $taxClass): void { $this->taxClass = $taxClass; } diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/MultiCartManager.php b/bundles/EcommerceFrameworkBundle/src/CartManager/MultiCartManager.php index 7dee2f68b03..bab0c63eeeb 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/MultiCartManager.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/MultiCartManager.php @@ -64,7 +64,7 @@ public function getCartClassName(): string /** * checks if cart manager is initialized and if not, do so */ - protected function checkForInit() + protected function checkForInit(): void { if (!$this->initialized) { $this->initSavedCarts(); @@ -72,7 +72,7 @@ protected function checkForInit() } } - protected function initSavedCarts() + protected function initSavedCarts(): void { $carts = $this->getAllCartsForCurrentUser(); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCart.php b/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCart.php index 3e03726be60..5ca521ecae0 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCart.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCart.php @@ -135,7 +135,7 @@ public static function getAllCartsForUser(int $userId): array * * @internal */ - public function __sleep() + public function __sleep(): array { $vars = parent::__sleep(); @@ -156,7 +156,7 @@ public function __sleep() * * @internal */ - public function __wakeup() + public function __wakeup(): void { $timestampBackup = $this->getModificationDate(); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartCheckoutData.php b/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartCheckoutData.php index e6befd98c4c..bce12c16773 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartCheckoutData.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartCheckoutData.php @@ -20,17 +20,17 @@ class SessionCartCheckoutData extends AbstractCartCheckoutData { protected string|int|null $cartId; - public function save() + public function save(): void { throw new \Exception('Not implemented, should not be needed for this cart type.'); } - public static function getByKeyCartId($key, $cartId) + public static function getByKeyCartId(string $key, int|string $cartId): ?AbstractCartCheckoutData { throw new \Exception('Not implemented, should not be needed for this cart type.'); } - public static function removeAllFromCart(int|string $cartId) + public static function removeAllFromCart(int|string $cartId): void { $checkoutDataItem = new self(); $cart = $checkoutDataItem->getCart(); @@ -39,7 +39,7 @@ public static function removeAllFromCart(int|string $cartId) } } - public function setCart(CartInterface $cart) + public function setCart(CartInterface $cart): void { $this->cart = $cart; $this->cartId = $cart->getId(); @@ -59,7 +59,7 @@ public function getCartId(): int|string|null return $this->cartId; } - public function setCartId($cartId) + public function setCartId(int|string|null $cartId): void { $this->cartId = $cartId; } @@ -69,7 +69,7 @@ public function setCartId($cartId) * * @internal */ - public function __sleep() + public function __sleep(): array { $vars = parent::__sleep(); diff --git a/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartItem.php b/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartItem.php index 0065e08c8d5..2d7ebabcd36 100644 --- a/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartItem.php +++ b/bundles/EcommerceFrameworkBundle/src/CartManager/SessionCartItem.php @@ -37,7 +37,7 @@ public static function getByCartIdItemKey(int|string $cartId, string $itemKey, s throw new \Exception('Not implemented, should not be needed for this cart type.'); } - public static function removeAllFromCart(int|string $cartId) + public static function removeAllFromCart(int|string $cartId): void { $cartItem = new self(); $cart = $cartItem->getCart(); @@ -58,7 +58,7 @@ public function getSubItems(): array * * @internal */ - public function __sleep() + public function __sleep(): array { $vars = parent::__sleep(); diff --git a/bundles/EcommerceFrameworkBundle/src/CheckoutManager/CheckoutManagerFactory.php b/bundles/EcommerceFrameworkBundle/src/CheckoutManager/CheckoutManagerFactory.php index e5df6f0a6fd..4ed994feaae 100644 --- a/bundles/EcommerceFrameworkBundle/src/CheckoutManager/CheckoutManagerFactory.php +++ b/bundles/EcommerceFrameworkBundle/src/CheckoutManager/CheckoutManagerFactory.php @@ -80,7 +80,7 @@ public function __construct( $this->processCheckoutStepDefinitions($checkoutStepDefinitions); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $resolver = new OptionsResolver(); $this->configureOptions($resolver); @@ -96,7 +96,7 @@ protected function processOptions(array $options) } } - protected function processCheckoutStepDefinitions(array $checkoutStepDefinitions) + protected function processCheckoutStepDefinitions(array $checkoutStepDefinitions): void { $stepResolver = new OptionsResolver(); $this->configureStepOptions($stepResolver); @@ -106,12 +106,12 @@ protected function processCheckoutStepDefinitions(array $checkoutStepDefinitions } } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $this->configureClassOptions($resolver); } - protected function configureStepOptions(OptionsResolver $resolver) + protected function configureStepOptions(OptionsResolver $resolver): void { $resolver->setDefined('class'); $resolver->setAllowedTypes('class', 'string'); @@ -121,7 +121,7 @@ protected function configureStepOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('options', ['array', 'null']); } - protected function configureClassOptions(OptionsResolver $resolver) + protected function configureClassOptions(OptionsResolver $resolver): void { $resolver->setDefined('class'); $resolver->setAllowedTypes('class', 'string'); diff --git a/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CheckoutManager.php b/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CheckoutManager.php index 010cdf07341..6af149c8914 100644 --- a/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CheckoutManager.php +++ b/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CheckoutManager.php @@ -109,7 +109,7 @@ public function __construct( /** * @param CheckoutStepInterface[] $checkoutSteps */ - protected function setCheckoutSteps(array $checkoutSteps) + protected function setCheckoutSteps(array $checkoutSteps): void { if (empty($checkoutSteps)) { return; @@ -122,13 +122,13 @@ protected function setCheckoutSteps(array $checkoutSteps) $this->initializeStepState(); } - protected function addCheckoutStep(CheckoutStepInterface $checkoutStep) + protected function addCheckoutStep(CheckoutStepInterface $checkoutStep): void { $this->checkoutStepOrder[] = $checkoutStep; $this->checkoutSteps[$checkoutStep->getName()] = $checkoutStep; } - protected function initializeStepState() + protected function initializeStepState(): void { // getting state information for checkout from custom environment items $this->finished = (bool) ($this->environment->getCustomItem(self::FINISHED . '_' . $this->cart->getId(), false)); @@ -282,7 +282,7 @@ public function getOrder(): AbstractOrder * * @param AbstractOrder|null $order */ - protected function updateEnvironmentAfterOrderCommit(?AbstractOrder $order) + protected function updateEnvironmentAfterOrderCommit(?AbstractOrder $order): void { $this->validateCheckoutSteps(); @@ -345,7 +345,7 @@ public function handlePaymentResponseAndCommitOrderPayment(StatusInterface|array * * @throws \Exception */ - protected function verifyRecurringPayment(RecurringPaymentInterface $provider, AbstractOrder $sourceOrder, string $customerId) + protected function verifyRecurringPayment(RecurringPaymentInterface $provider, AbstractOrder $sourceOrder, string $customerId): void { $orderManager = $this->orderManagers->getOrderManager(); @@ -532,7 +532,7 @@ public function getCurrentStep(): CheckoutStepInterface return $this->currentStep; } - protected function validateCheckoutSteps() + protected function validateCheckoutSteps(): void { if (empty($this->checkoutSteps)) { throw new \RuntimeException('Checkout manager does not define any checkout steps'); diff --git a/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CommitOrderProcessor.php b/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CommitOrderProcessor.php index fcf28c0acec..ada7249ff53 100644 --- a/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CommitOrderProcessor.php +++ b/bundles/EcommerceFrameworkBundle/src/CheckoutManager/V7/CommitOrderProcessor.php @@ -73,19 +73,19 @@ public function __construct(LockFactory $lockFactory, OrderManagerLocatorInterfa $this->lockFactory = $lockFactory; } - protected function processOptions(array $options) + protected function processOptions(array $options): void { if (isset($options['confirmation_mail'])) { $this->confirmationMail = $options['confirmation_mail']; } } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setDefined('confirmation_mail'); } - public function setConfirmationMail(string $confirmationMail) + public function setConfirmationMail(string $confirmationMail): void { if (!empty($confirmationMail)) { $this->confirmationMail = $confirmationMail; @@ -256,7 +256,7 @@ public function commitOrderPayment(StatusInterface $paymentStatus, PaymentInterf * @param StatusInterface $paymentStatus * @param PaymentInterface $paymentProvider */ - protected function applyAdditionalDataToOrder(AbstractOrder $order, StatusInterface $paymentStatus, PaymentInterface $paymentProvider) + protected function applyAdditionalDataToOrder(AbstractOrder $order, StatusInterface $paymentStatus, PaymentInterface $paymentProvider): void { // nothing to do by default } @@ -289,12 +289,12 @@ public function commitOrder(AbstractOrder $order): AbstractOrder * * @param AbstractOrder $order */ - protected function processOrder(AbstractOrder $order) + protected function processOrder(AbstractOrder $order): void { // nothing to do } - protected function sendConfirmationMail(AbstractOrder $order) + protected function sendConfirmationMail(AbstractOrder $order): void { $event = new SendConfirmationMailEvent($this, $order, $this->confirmationMail); $this->eventDispatcher->dispatch($event, CommitOrderProcessorEvents::SEND_CONFIRMATION_MAILS); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/CleanupPendingOrdersCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/CleanupPendingOrdersCommand.php index fba34022a5c..072c4b3653a 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/CleanupPendingOrdersCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/CleanupPendingOrdersCommand.php @@ -27,7 +27,7 @@ */ class CleanupPendingOrdersCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this->setName('ecommerce:cleanup-pending-orders'); $this->setDescription('Cleans up orders with state pending payment after 1h -> delegates this to commit order processor'); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/BootstrapCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/BootstrapCommand.php index fddbe4c86c8..e01d870bae3 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/BootstrapCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/BootstrapCommand.php @@ -50,7 +50,7 @@ public function __construct(IndexService $indexService, string $name = null) /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); self::configureCommand($this); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/EsSyncCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/EsSyncCommand.php index b5fcadb7a37..2ae347f077b 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/EsSyncCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/EsSyncCommand.php @@ -32,7 +32,7 @@ class EsSyncCommand extends AbstractIndexServiceCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); $this diff --git a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessPreparationQueueCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessPreparationQueueCommand.php index e429d5b3a42..8ea706ea852 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessPreparationQueueCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessPreparationQueueCommand.php @@ -58,7 +58,7 @@ public function __construct(IndexUpdateService $indexUpdateService, IndexService /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessUpdateIndexQueueCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessUpdateIndexQueueCommand.php index e2dd04a246b..198d8d18e61 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessUpdateIndexQueueCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ProcessUpdateIndexQueueCommand.php @@ -62,7 +62,7 @@ public function __construct(IndexUpdateService $indexUpdateService, IndexService /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ResetQueueCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ResetQueueCommand.php index 617ee18dd5f..2d616446dc1 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ResetQueueCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/IndexService/ResetQueueCommand.php @@ -31,7 +31,7 @@ class ResetQueueCommand extends AbstractIndexServiceCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupReservationsCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupReservationsCommand.php index 8a1dfa33ab8..d34c5556801 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupReservationsCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupReservationsCommand.php @@ -26,7 +26,7 @@ */ class CleanupReservationsCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this->setName('ecommerce:voucher:cleanup-reservations'); $this->setDescription('Cleans the token reservations due to sysConfig duration settings'); diff --git a/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupStatisticsCommand.php b/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupStatisticsCommand.php index d6eb1b0f6a2..7bfce33686b 100644 --- a/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupStatisticsCommand.php +++ b/bundles/EcommerceFrameworkBundle/src/Command/Voucher/CleanupStatisticsCommand.php @@ -26,7 +26,7 @@ */ class CleanupStatisticsCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this->setName('ecommerce:voucher:cleanup-statistics'); $this->setDescription('House keeping for Voucher Usage Statistics - cleans up all old data.'); diff --git a/bundles/EcommerceFrameworkBundle/src/Controller/AdminOrderController.php b/bundles/EcommerceFrameworkBundle/src/Controller/AdminOrderController.php index e52c848ed62..bbaf4e5e3dc 100644 --- a/bundles/EcommerceFrameworkBundle/src/Controller/AdminOrderController.php +++ b/bundles/EcommerceFrameworkBundle/src/Controller/AdminOrderController.php @@ -61,7 +61,7 @@ class AdminOrderController extends AdminController implements KernelControllerEv protected PaymentManagerInterface $paymentManager; - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { // set language $user = $this->tokenResolver->getUser(); diff --git a/bundles/EcommerceFrameworkBundle/src/Controller/PricingController.php b/bundles/EcommerceFrameworkBundle/src/Controller/PricingController.php index 8ad77b15315..745757ca1bb 100644 --- a/bundles/EcommerceFrameworkBundle/src/Controller/PricingController.php +++ b/bundles/EcommerceFrameworkBundle/src/Controller/PricingController.php @@ -36,7 +36,7 @@ */ class PricingController extends AdminController implements KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { // permission check $access = $this->getAdminUser()->isAllowed('bundle_ecommerce_pricing_rules'); diff --git a/bundles/EcommerceFrameworkBundle/src/Controller/VoucherController.php b/bundles/EcommerceFrameworkBundle/src/Controller/VoucherController.php index 55535ea5466..0b0e328b3a9 100644 --- a/bundles/EcommerceFrameworkBundle/src/Controller/VoucherController.php +++ b/bundles/EcommerceFrameworkBundle/src/Controller/VoucherController.php @@ -55,7 +55,7 @@ public function __construct(TokenStorageUserResolver $tokenStorageUserResolver, $this->translator = $translator; } - public function onKernelControllerEvent(ControllerEvent $event) + public function onKernelControllerEvent(ControllerEvent $event): void { // set language $user = $this->tokenResolver->getUser(); @@ -163,7 +163,7 @@ public function exportTokensAction(Request $request): Response * * @Route("/generate", name="pimcore_ecommerce_backend_voucher_generate", methods={"GET"}) */ - public function generateAction(Request $request) + public function generateAction(Request $request): Response { $onlineShopVoucherSeries = OnlineShopVoucherSeries::getById((int) $request->get('id')); @@ -187,6 +187,8 @@ public function generateAction(Request $request) $params ); } + + throw $this->createNotFoundException(); } /** @@ -194,7 +196,7 @@ public function generateAction(Request $request) * * @Route("/cleanup", name="pimcore_ecommerce_backend_voucher_cleanup", methods={"POST"}) */ - public function cleanupAction(Request $request) + public function cleanupAction(Request $request): Response { $onlineShopVoucherSeries = OnlineShopVoucherSeries::getById((int) $request->get('id')); @@ -220,6 +222,8 @@ public function cleanupAction(Request $request) $params ); } + + throw $this->createNotFoundException(); } /** diff --git a/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelection.php b/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelection.php index 961d5f97062..4080f76ab24 100644 --- a/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelection.php +++ b/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelection.php @@ -72,7 +72,7 @@ public function __construct() { } - public function setConsiderTenants($considerTenants) + public function setConsiderTenants(bool $considerTenants): void { $this->considerTenants = $considerTenants; } @@ -82,7 +82,7 @@ public function getConsiderTenants(): bool return $this->considerTenants; } - public function setFilterGroups(array $filterGroups) + public function setFilterGroups(array $filterGroups): void { $this->filterGroups = $filterGroups; } @@ -92,7 +92,7 @@ public function getFilterGroups(): array return $this->filterGroups; } - public function setMultiPreSelect(string $multiPreSelect) + public function setMultiPreSelect(string $multiPreSelect): void { $this->multiPreSelect = $multiPreSelect; } @@ -102,7 +102,7 @@ public function getMultiPreSelect(): string return $this->multiPreSelect; } - public function setPredefinedPreSelectOptions(array $predefinedPreSelectOptions) + public function setPredefinedPreSelectOptions(array $predefinedPreSelectOptions): void { $this->predefinedPreSelectOptions = $predefinedPreSelectOptions; } @@ -239,7 +239,7 @@ public function getVersionPreview(mixed $data, $object = null, array $params = [ /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && ($data === null || $data->getField() === null)) { @@ -291,7 +291,7 @@ public function getWidth(): mixed return $this->width; } - public function setWidth(mixed $width) + public function setWidth(mixed $width): void { $this->width = (int)$width; } diff --git a/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php b/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php index ba8fe1d695a..14a6f748ae0 100644 --- a/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php +++ b/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php @@ -73,7 +73,7 @@ protected function buildOptions(): array return $options; } - public function setSpecificPriceField($specificPriceField) + public function setSpecificPriceField(bool $specificPriceField): void { $this->specificPriceField = $specificPriceField; } @@ -83,7 +83,7 @@ public function getSpecificPriceField(): bool return $this->specificPriceField; } - public function setShowAllFields($showAllFields) + public function setShowAllFields(bool $showAllFields): void { $this->showAllFields = $showAllFields; } @@ -93,7 +93,7 @@ public function getShowAllFields(): bool return $this->showAllFields; } - public function setConsiderTenants($considerTenants) + public function setConsiderTenants(bool $considerTenants): void { $this->considerTenants = $considerTenants; } diff --git a/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionField.php b/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionField.php index faf88086af6..93e58d35803 100644 --- a/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionField.php +++ b/bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionField.php @@ -33,7 +33,7 @@ class IndexFieldSelectionField extends Textarea public bool $considerTenants = false; - public function setSpecificPriceField($specificPriceField) + public function setSpecificPriceField(bool $specificPriceField): void { $this->specificPriceField = $specificPriceField; } @@ -43,7 +43,7 @@ public function getSpecificPriceField(): bool return $this->specificPriceField; } - public function setShowAllFields($showAllFields) + public function setShowAllFields(bool $showAllFields): void { $this->showAllFields = $showAllFields; } @@ -53,7 +53,7 @@ public function getShowAllFields(): bool return $this->showAllFields; } - public function setConsiderTenants($considerTenants) + public function setConsiderTenants(bool $considerTenants): void { $this->considerTenants = $considerTenants; } diff --git a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/Compiler/RegisterConfiguredServicesPass.php b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/Compiler/RegisterConfiguredServicesPass.php index a451e538f7a..2bf07ff9b15 100644 --- a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/Compiler/RegisterConfiguredServicesPass.php +++ b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/Compiler/RegisterConfiguredServicesPass.php @@ -27,14 +27,14 @@ */ final class RegisterConfiguredServicesPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $this->registerIndexServiceWorkers($container); $this->registerTrackingManagerTrackers($container); $this->registerPaymentManagerConfiguration($container); } - public function registerIndexServiceWorkers(ContainerBuilder $container) + public function registerIndexServiceWorkers(ContainerBuilder $container): void { $workers = []; foreach ($container->findTaggedServiceIds('pimcore_ecommerce.index_service.worker') as $id => $tags) { @@ -45,7 +45,7 @@ public function registerIndexServiceWorkers(ContainerBuilder $container) $indexService->setArgument('$tenantWorkers', $workers); } - public function registerTrackingManagerTrackers(ContainerBuilder $container) + public function registerTrackingManagerTrackers(ContainerBuilder $container): void { $trackers = []; diff --git a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/IndexService/DefaultWorkerConfigMapper.php b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/IndexService/DefaultWorkerConfigMapper.php index 59b8f7bd649..e446716b942 100644 --- a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/IndexService/DefaultWorkerConfigMapper.php +++ b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/IndexService/DefaultWorkerConfigMapper.php @@ -34,6 +34,7 @@ */ class DefaultWorkerConfigMapper { + /** @var array */ private array $mapping = [ OptimizedMysqlConfig::class => OptimizedMysql::class, DefaultMysqlConfig::class => DefaultMysql::class, @@ -42,7 +43,7 @@ class DefaultWorkerConfigMapper DefaultFindologicConfig::class => DefaultFindologic::class, ]; - public function getWorkerForConfig(string $config) + public function getWorkerForConfig(string $config): ?string { // we can only try to guess a worker if config is a class name we can resolve if (!class_exists($config)) { @@ -55,9 +56,11 @@ public function getWorkerForConfig(string $config) return $workerClass; } } + + return null; } - public function getConfigForWorker(string $worker) + public function getConfigForWorker(string $worker): ?string { // we can only try to guess a config if worker is a class name we can resolve if (!class_exists($worker)) { @@ -70,5 +73,7 @@ public function getConfigForWorker(string $worker) return $configClass; } } + + return null; } } diff --git a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/PimcoreEcommerceFrameworkExtension.php b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/PimcoreEcommerceFrameworkExtension.php index 3fc86f7f020..2cce2a5be91 100644 --- a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/PimcoreEcommerceFrameworkExtension.php +++ b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/PimcoreEcommerceFrameworkExtension.php @@ -69,7 +69,7 @@ final class PimcoreEcommerceFrameworkExtension extends ConfigurableExtension * * {@inheritdoc} */ - protected function loadInternal(array $config, ContainerBuilder $container) + protected function loadInternal(array $config, ContainerBuilder $container): void { $loader = new YamlFileLoader( $container, diff --git a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/NameServiceLocator.php b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/NameServiceLocator.php index 20f17b18862..323b3a6be70 100644 --- a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/NameServiceLocator.php +++ b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/NameServiceLocator.php @@ -31,10 +31,7 @@ public function __construct(PsrContainerInterface $locator) $this->locator = $locator; } - /** - * @return mixed - */ - protected function locate(string $name = null) + protected function locate(string $name = null): mixed { $name = $this->resolveName($name); diff --git a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/TenantAwareServiceLocator.php b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/TenantAwareServiceLocator.php index badbab07ed7..7d88f1a3092 100644 --- a/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/TenantAwareServiceLocator.php +++ b/bundles/EcommerceFrameworkBundle/src/DependencyInjection/ServiceLocator/TenantAwareServiceLocator.php @@ -46,10 +46,7 @@ public function __construct( $this->strictTenants = $strictTenants; } - /** - * @return mixed - */ - protected function locate(string $tenant = null) + protected function locate(string $tenant = null): mixed { $tenant = $this->resolveTenant($tenant); @@ -81,8 +78,5 @@ protected function resolveTenant(string $tenant = null): string return $this->defaultTenant; } - /** - * @return string|null - */ - abstract protected function getEnvironmentTenant(); + abstract protected function getEnvironmentTenant(): ?string; } diff --git a/bundles/EcommerceFrameworkBundle/src/Environment.php b/bundles/EcommerceFrameworkBundle/src/Environment.php index 569375fed0e..0875d4bdcfa 100644 --- a/bundles/EcommerceFrameworkBundle/src/Environment.php +++ b/bundles/EcommerceFrameworkBundle/src/Environment.php @@ -61,19 +61,19 @@ public function __construct(LocaleServiceInterface $localeService, array $option $this->processOptions($resolver->resolve($options)); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $this->defaultCurrency = new Currency((string)$options['defaultCurrency']); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired(['defaultCurrency']); $resolver->setAllowedTypes('defaultCurrency', 'string'); $resolver->setDefaults(['defaultCurrency' => 'EUR']); } - protected function load() + protected function load(): void { } @@ -100,7 +100,7 @@ public function getCustomItem(string $key, mixed $defaultValue = null): mixed return $defaultValue; } - public function setCustomItem(string $key, mixed $value) + public function setCustomItem(string $key, mixed $value): void { $this->load(); @@ -133,14 +133,14 @@ public function hasCurrentUserId(): bool return $this->getCurrentUserId() !== self::USER_ID_NOT_SET; } - public function removeCustomItem(string $key) + public function removeCustomItem(string $key): void { $this->load(); unset($this->customItems[$key]); } - public function clearEnvironment() + public function clearEnvironment(): void { $this->load(); @@ -153,7 +153,7 @@ public function clearEnvironment() $this->useGuestCart = null; } - public function setDefaultCurrency(Currency $currency) + public function setDefaultCurrency(Currency $currency): void { $this->defaultCurrency = $currency; } @@ -172,7 +172,7 @@ public function getUseGuestCart(): bool return $this->useGuestCart; } - public function setUseGuestCart(bool $useGuestCart) + public function setUseGuestCart(bool $useGuestCart): void { $this->load(); @@ -184,7 +184,7 @@ public function setUseGuestCart(bool $useGuestCart) * * @param string|null $tenant */ - public function setCurrentAssortmentTenant(?string $tenant) + public function setCurrentAssortmentTenant(?string $tenant): void { $this->load(); @@ -208,7 +208,7 @@ public function getCurrentAssortmentTenant(): ?string * * @param string|null $subTenant */ - public function setCurrentAssortmentSubTenant(?string $subTenant) + public function setCurrentAssortmentSubTenant(?string $subTenant): void { $this->load(); @@ -233,7 +233,7 @@ public function getCurrentAssortmentSubTenant(): ?string * @param string $tenant * @param bool $persistent - if set to false, tenant is not stored to session and only valid for current process */ - public function setCurrentCheckoutTenant(string $tenant, bool $persistent = true) + public function setCurrentCheckoutTenant(string $tenant, bool $persistent = true): void { $this->load(); diff --git a/bundles/EcommerceFrameworkBundle/src/EnvironmentInterface.php b/bundles/EcommerceFrameworkBundle/src/EnvironmentInterface.php index 017f45f66a7..8bec345de74 100644 --- a/bundles/EcommerceFrameworkBundle/src/EnvironmentInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/EnvironmentInterface.php @@ -53,7 +53,7 @@ public function hasCurrentUserId(): bool; * @param string $key * @param mixed $value */ - public function setCustomItem(string $key, mixed $value); + public function setCustomItem(string $key, mixed $value): void; /** * Removes custom item from the environment @@ -61,7 +61,7 @@ public function setCustomItem(string $key, mixed $value); * * @param string $key */ - public function removeCustomItem(string $key); + public function removeCustomItem(string $key): void; /** * Returns custom saved item from environment @@ -84,14 +84,14 @@ public function getAllCustomItems(): array; * Resets environment * save()-call is needed to save changes */ - public function clearEnvironment(); + public function clearEnvironment(): void; /** * Sets current assortment tenant which is used for indexing and product lists * * @param string|null $tenant */ - public function setCurrentAssortmentTenant(?string $tenant); + public function setCurrentAssortmentTenant(?string $tenant): void; /** * Returns current assortment tenant which is used for indexing and product lists @@ -105,7 +105,7 @@ public function getCurrentAssortmentTenant(): ?string; * * @param string|null $subTenant */ - public function setCurrentAssortmentSubTenant(?string $subTenant); + public function setCurrentAssortmentSubTenant(?string $subTenant): void; /** * Returns current sub assortment tenant which is used for indexing and product lists @@ -120,7 +120,7 @@ public function getCurrentAssortmentSubTenant(): ?string; * @param string $tenant * @param bool $persistent - if set to false, tenant is not stored to session and only valid for current process */ - public function setCurrentCheckoutTenant(string $tenant, bool $persistent = true); + public function setCurrentCheckoutTenant(string $tenant, bool $persistent = true): void; /** * Returns current assortment tenant which is used for cart and checkout manager @@ -134,7 +134,7 @@ public function getCurrentCheckoutTenant(): ?string; * * @param Currency $currency */ - public function setDefaultCurrency(Currency $currency); + public function setDefaultCurrency(Currency $currency): void; /** * Returns instance of default currency @@ -145,7 +145,7 @@ public function getDefaultCurrency(): Currency; public function getUseGuestCart(): bool; - public function setUseGuestCart(bool $useGuestCart); + public function setUseGuestCart(bool $useGuestCart): void; /** * Returns current system locale diff --git a/bundles/EcommerceFrameworkBundle/src/EventListener/Frontend/TrackingCodeFlashMessageListener.php b/bundles/EcommerceFrameworkBundle/src/EventListener/Frontend/TrackingCodeFlashMessageListener.php index c851ef517ba..02d8e1c27ad 100644 --- a/bundles/EcommerceFrameworkBundle/src/EventListener/Frontend/TrackingCodeFlashMessageListener.php +++ b/bundles/EcommerceFrameworkBundle/src/EventListener/Frontend/TrackingCodeFlashMessageListener.php @@ -57,7 +57,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); @@ -98,7 +98,7 @@ private function getSession(): ?SessionInterface return $session; } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { $response = $event->getResponse(); $request = $event->getRequest(); diff --git a/bundles/EcommerceFrameworkBundle/src/EventListener/IndexUpdateListener.php b/bundles/EcommerceFrameworkBundle/src/EventListener/IndexUpdateListener.php index cfcee083c65..631c8c9e85d 100644 --- a/bundles/EcommerceFrameworkBundle/src/EventListener/IndexUpdateListener.php +++ b/bundles/EcommerceFrameworkBundle/src/EventListener/IndexUpdateListener.php @@ -33,7 +33,7 @@ public static function getSubscribedEvents(): array ]; } - public function onObjectUpdate(DataObjectEvent $event) + public function onObjectUpdate(DataObjectEvent $event): void { $object = $event->getObject(); @@ -43,7 +43,7 @@ public function onObjectUpdate(DataObjectEvent $event) } } - public function onObjectDelete(DataObjectEvent $event) + public function onObjectDelete(DataObjectEvent $event): void { $object = $event->getObject(); diff --git a/bundles/EcommerceFrameworkBundle/src/EventListener/SessionBagListener.php b/bundles/EcommerceFrameworkBundle/src/EventListener/SessionBagListener.php index 6201e76aa3f..b3d56726e42 100644 --- a/bundles/EcommerceFrameworkBundle/src/EventListener/SessionBagListener.php +++ b/bundles/EcommerceFrameworkBundle/src/EventListener/SessionBagListener.php @@ -53,7 +53,7 @@ protected function getBagNames(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; @@ -69,7 +69,7 @@ public function onKernelRequest(RequestEvent $event) $this->configure($session); } - public function configure(SessionInterface $session) + public function configure(SessionInterface $session): void { $bagNames = $this->getBagNames(); @@ -86,7 +86,7 @@ public function configure(SessionInterface $session) * * @param SessionInterface $session */ - public function clearSession(SessionInterface $session) + public function clearSession(SessionInterface $session): void { $bagNames = $this->getBagNames(); diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/ElasticSearch/SelectRelation.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/ElasticSearch/SelectRelation.php index 28681a708bf..f44f39219a2 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/ElasticSearch/SelectRelation.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/ElasticSearch/SelectRelation.php @@ -28,19 +28,6 @@ public function prepareGroupByValues(AbstractFilterDefinitionType $filterDefinit $productList->prepareGroupByValues($this->getField($filterDefinition), true); } - protected function loadAllAvailableRelations($availableRelations, $availableRelationsArray = []) - { - foreach ($availableRelations as $rel) { - if ($rel instanceof Folder) { - $availableRelationsArray = $this->loadAllAvailableRelations($rel->getChildren(), $availableRelationsArray); - } else { - $availableRelationsArray[$rel->getId()] = true; - } - } - - return $availableRelationsArray; - } - public function addCondition(AbstractFilterDefinitionType $filterDefinition, ProductListInterface $productList, array $currentFilter, array $params, bool $isPrecondition = false): array { $field = $this->getField($filterDefinition); diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/MultiSelectRelation.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/MultiSelectRelation.php index 96968af5f3e..8755645acdd 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/MultiSelectRelation.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/MultiSelectRelation.php @@ -67,7 +67,7 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, } foreach ($values as $v) { - if (empty($availableRelations) || $availableRelations[$v['value']] === true) { + if (empty($availableRelations) || ($availableRelations[$v['value']] ?? false)) { $objects[$v['value']] = DataObject::getById($v['value']); } } diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/SelectRelation.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/SelectRelation.php index 07f93b0ab86..aa6a38355c4 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/SelectRelation.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/SelectRelation.php @@ -55,7 +55,7 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, } foreach ($values as $v) { - if (empty($availableRelations) || $availableRelations[$v['label']] === true) { + if (empty($availableRelations) || ($availableRelations[$v['label']] ?? false)) { $objects[$v['label']] = DataObject::getById($v['label']); } } diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectCategory.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectCategory.php index 5136b5c2787..3e4d023464f 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectCategory.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectCategory.php @@ -39,20 +39,22 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, if (method_exists($filterDefinition, 'getAvailableCategories') && $filterDefinition->getAvailableCategories()) { /** @var ElementInterface $rel */ foreach ($filterDefinition->getAvailableCategories() as $rel) { - $availableRelations[(string) $rel->getId()] = true; + $availableRelations[$rel->getId()] = true; } } foreach ($rawValues as $v) { - $explode = explode(',', $v['value']); - foreach ($explode as $e) { - if (!empty($e) && (empty($availableRelations) || $availableRelations[$e] === true)) { - if (!empty($values[$e])) { - $count = $values[$e]['count'] + $v['count']; - } else { - $count = $v['count']; + if ($v['value']) { + $explode = array_map('intval', explode(',', $v['value'])); + foreach ($explode as $e) { + if (empty($availableRelations) || ($availableRelations[$e] ?? false)) { + if (!empty($values[$e])) { + $count = $values[$e]['count'] + $v['count']; + } else { + $count = $v['count']; + } + $values[$e] = ['value' => $e, 'count' => $count]; } - $values[$e] = ['value' => $e, 'count' => $count]; } } } diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectRelation.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectRelation.php index 477eaa721d3..f233756d215 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectRelation.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/MultiSelectRelation.php @@ -48,7 +48,7 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, } foreach ($values as $v) { - if (empty($availableRelations) || $availableRelations[$v['value']] === true) { + if (empty($availableRelations) || ($availableRelations[$v['value']] ?? false)) { $objects[$v['value']] = DataObject::getById($v['value']); } } @@ -66,11 +66,17 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, ]; } - protected function loadAllAvailableRelations($availableRelations, $availableRelationsArray = []) + /** + * @param DataObject\AbstractObject[] $availableRelations + * @param array $availableRelationsArray + * + * @return array + */ + protected function loadAllAvailableRelations(array $availableRelations, array $availableRelationsArray = []): array { foreach ($availableRelations as $rel) { if ($rel instanceof Folder) { - $availableRelationsArray = $this->loadAllAvailableRelations($rel->getChildren(), $availableRelationsArray); + $availableRelationsArray = $this->loadAllAvailableRelations($rel->getChildren()->load(), $availableRelationsArray); } else { $availableRelationsArray[$rel->getId()] = true; } diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectCategory.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectCategory.php index 90d2b8f09ba..c2d3a39a8b9 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectCategory.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectCategory.php @@ -48,16 +48,17 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, } foreach ($rawValues as $v) { - $explode = explode(',', $v['value']); - /** @var int $e */ - foreach ($explode as $e) { - if (!empty($e) && (empty($availableRelations) || $availableRelations[$e] === true)) { - if (!empty($values[$e])) { - $count = $values[$e]['count'] + $v['count']; - } else { - $count = $v['count']; + if ($v['value']) { + $explode = array_map('intval', explode(',', $v['value'])); + foreach ($explode as $e) { + if (empty($availableRelations) || ($availableRelations[$e] ?? false)) { + if (!empty($values[$e])) { + $count = $values[$e]['count'] + $v['count']; + } else { + $count = $v['count']; + } + $values[$e] = ['value' => $e, 'count' => $count]; } - $values[$e] = ['value' => $e, 'count' => $count]; } } } diff --git a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectRelation.php b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectRelation.php index 947ec11df28..c5eea915b13 100644 --- a/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectRelation.php +++ b/bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectRelation.php @@ -50,7 +50,7 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, } foreach ($values as $v) { - if (empty($availableRelations) || $availableRelations[$v['value']] === true) { + if (empty($availableRelations) || ($availableRelations[$v['value']] ?? false)) { $objects[$v['value']] = DataObject::getById($v['value']); } } @@ -68,11 +68,17 @@ public function getFilterValues(AbstractFilterDefinitionType $filterDefinition, ]; } - protected function loadAllAvailableRelations($availableRelations, $availableRelationsArray = []) + /** + * @param DataObject\AbstractObject[] $availableRelations + * @param array $availableRelationsArray + * + * @return array + */ + protected function loadAllAvailableRelations(array $availableRelations, array $availableRelationsArray = []): array { foreach ($availableRelations as $rel) { if ($rel instanceof Folder) { - $availableRelationsArray = $this->loadAllAvailableRelations($rel->getChildren(), $availableRelationsArray); + $availableRelationsArray = $this->loadAllAvailableRelations($rel->getChildren()->load(), $availableRelationsArray); } else { $availableRelationsArray[$rel->getId()] = true; } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/AbstractConfig.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/AbstractConfig.php index 91e3874e051..876eff8f2d7 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/AbstractConfig.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/AbstractConfig.php @@ -106,7 +106,7 @@ public function setAttributeFactory(AttributeFactory $attributeFactory): void } } - protected function buildAttributes(array $attributes) + protected function buildAttributes(array $attributes): void { foreach ($attributes as $attribute) { if ($attribute instanceof Attribute) { @@ -123,12 +123,12 @@ protected function buildAttributes(array $attributes) } } - protected function addAttribute(Attribute $attribute) + protected function addAttribute(Attribute $attribute): void { $this->attributes[$attribute->getName()] = $attribute; } - protected function addSearchAttribute(string $searchAttribute) + protected function addSearchAttribute(string $searchAttribute): void { if (!isset($this->attributes[$searchAttribute])) { throw new \InvalidArgumentException(sprintf( @@ -141,7 +141,7 @@ protected function addSearchAttribute(string $searchAttribute) $this->searchAttributes[] = $searchAttribute; } - protected function processOptions(array $options) + protected function processOptions(array $options): void { // noop - to implemented by configs supporting options } @@ -149,7 +149,7 @@ protected function processOptions(array $options) /** * {@inheritdoc} */ - public function setTenantWorker(WorkerInterface $tenantWorker) + public function setTenantWorker(WorkerInterface $tenantWorker): void { $this->checkTenantWorker($tenantWorker); $this->tenantWorker = $tenantWorker; @@ -161,7 +161,7 @@ public function setTenantWorker(WorkerInterface $tenantWorker) * * @param WorkerInterface $tenantWorker */ - protected function checkTenantWorker(WorkerInterface $tenantWorker) + protected function checkTenantWorker(WorkerInterface $tenantWorker): void { if (null !== $this->tenantWorker) { throw new \LogicException(sprintf('Worker for tenant "%s" is already set', $this->tenantName)); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ConfigInterface.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ConfigInterface.php index 23f6cd1d2b0..7e49c65dab1 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ConfigInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ConfigInterface.php @@ -114,7 +114,7 @@ public function updateSubTenantEntries(mixed $objectId, mixed $subTenantData, mi * @throws \LogicException If the config used from the worker does not match the config object the worker is * about to be set to */ - public function setTenantWorker(WorkerInterface $tenantWorker); + public function setTenantWorker(WorkerInterface $tenantWorker): void; /** * creates and returns tenant worker suitable for this tenant configuration diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultFindologic.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultFindologic.php index cabdac55c6c..d44940f1a5e 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultFindologic.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultFindologic.php @@ -33,7 +33,7 @@ class DefaultFindologic extends AbstractConfig implements FindologicConfigInterf protected array $clientConfig; - protected function processOptions(array $options) + protected function processOptions(array $options): void { $options = $this->resolveOptions($options); @@ -41,7 +41,7 @@ protected function processOptions(array $options) $this->clientConfig = $options['client_config']; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $resolver->setDefaults([ 'client_config' => [], @@ -104,7 +104,7 @@ public function updateSubTenantEntries(mixed $objectId, mixed $subTenantData, mi /** * {@inheritdoc} */ - public function setTenantWorker(WorkerInterface $tenantWorker) + public function setTenantWorker(WorkerInterface $tenantWorker): void { if (!$tenantWorker instanceof DefaultFindologicWorker) { throw new \InvalidArgumentException(sprintf( @@ -151,7 +151,7 @@ public function getSubTenantCondition(): array * * @return DefaultMockup */ - public function createMockupObject(int $objectId, mixed $data, array $relations): DefaultMockup + public function createMockupObject(int $objectId, array $data, array $relations): DefaultMockup { return new DefaultMockup($objectId, $data, $relations); } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultMysql.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultMysql.php index 7c084adf9b9..8a9d18078e4 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultMysql.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/DefaultMysql.php @@ -87,7 +87,7 @@ public function updateSubTenantEntries(mixed $objectId, mixed $subTenantData, mi /** * {@inheritdoc} */ - public function setTenantWorker(WorkerInterface $tenantWorker) + public function setTenantWorker(WorkerInterface $tenantWorker): void { if (!$tenantWorker instanceof DefaultMysqlWorker) { throw new \InvalidArgumentException(sprintf( diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/Definition/Attribute.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/Definition/Attribute.php index d0e3bce0419..aaae101db67 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/Definition/Attribute.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/Definition/Attribute.php @@ -106,13 +106,7 @@ public function getOptions(): array return $this->options; } - /** - * @param string $name - * @param mixed $defaultValue - * - * @return mixed - */ - public function getOption(string $name, $defaultValue = null) + public function getOption(string $name, mixed $defaultValue = null): mixed { return $this->options[$name] ?? $defaultValue; } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ElasticSearch.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ElasticSearch.php index fef337b3eb4..15215cdef64 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ElasticSearch.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/ElasticSearch.php @@ -84,7 +84,7 @@ public function __construct( parent::__construct($tenantName, $attributes, $searchAttributes, $filterTypes, $options); } - protected function addAttribute(Attribute $attribute) + protected function addAttribute(Attribute $attribute): void { parent::addAttribute($attribute); @@ -96,7 +96,7 @@ protected function addAttribute(Attribute $attribute) $this->fieldMapping[$attribute->getName()] = sprintf('%s.%s', $attributeType, $attribute->getName()); } - protected function addSearchAttribute(string $searchAttribute) + protected function addSearchAttribute(string $searchAttribute): void { if (isset($this->attributes[$searchAttribute])) { $this->searchAttributes[] = $searchAttribute; @@ -120,7 +120,7 @@ protected function addSearchAttribute(string $searchAttribute) )); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $options = $this->resolveOptions($options); @@ -129,7 +129,7 @@ protected function processOptions(array $options) $this->indexSettings = $options['index_settings']; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $arrayFields = [ 'client_config', @@ -295,7 +295,7 @@ public function getSubTenantCondition(): array /** * {@inheritdoc} */ - public function setTenantWorker(WorkerInterface $tenantWorker) + public function setTenantWorker(WorkerInterface $tenantWorker): void { if (!$tenantWorker instanceof DefaultElasticSearchWorker) { throw new \InvalidArgumentException(sprintf( @@ -316,7 +316,7 @@ public function setTenantWorker(WorkerInterface $tenantWorker) * * @return DefaultMockup */ - public function createMockupObject(int $objectId, mixed $data, array $relations): DefaultMockup + public function createMockupObject(int $objectId, array $data, array $relations): DefaultMockup { return new DefaultMockup($objectId, $data, $relations); } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/MockupConfigInterface.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/MockupConfigInterface.php index d25d702a31c..f1eb205b030 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/MockupConfigInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/MockupConfigInterface.php @@ -23,12 +23,6 @@ interface MockupConfigInterface { /** * creates object mockup for given data - * - * @param int $objectId - * @param array $data - * @param array $relations - * - * @return mixed */ - public function createMockupObject(int $objectId, mixed $data, array $relations): mixed; + public function createMockupObject(int $objectId, array $data, array $relations): mixed; } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/OptimizedMysql.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/OptimizedMysql.php index 8c0ccf30963..8ac0f257e86 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Config/OptimizedMysql.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Config/OptimizedMysql.php @@ -35,7 +35,7 @@ class OptimizedMysql extends DefaultMysql implements MockupConfigInterface * * @return DefaultMockup */ - public function createMockupObject(int $objectId, mixed $data, array $relations): DefaultMockup + public function createMockupObject(int $objectId, array $data, array $relations): DefaultMockup { return new DefaultMockup($objectId, $data, $relations); } @@ -59,7 +59,7 @@ public function getObjectMockupById(int $objectId): DefaultMockup /** * {@inheritdoc} */ - public function setTenantWorker(WorkerInterface $tenantWorker) + public function setTenantWorker(WorkerInterface $tenantWorker): void { if (!$tenantWorker instanceof OptimizedMysqlWorker) { throw new \InvalidArgumentException(sprintf( diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetter.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetter.php index f16d7c8e96c..4b1fe16ff8c 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetter.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetter.php @@ -23,13 +23,7 @@ class DefaultBrickGetter implements GetterInterface { use OptionsResolverTrait; - /** - * @param object $object - * @param array $config - * - * @return mixed - */ - public function get($object, $config = null) + public function get(object $object, array $config = null): mixed { $config = $this->resolveOptions($config ?? []); @@ -43,14 +37,16 @@ public function get($object, $config = null) return $brick->$fieldGetter(); } + + return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { static::setupBrickGetterOptionsResolver($resolver); } - public static function setupBrickGetterOptionsResolver(OptionsResolver $resolver) + public static function setupBrickGetterOptionsResolver(OptionsResolver $resolver): void { foreach (['brickfield', 'bricktype', 'fieldname'] as $field) { $resolver->setRequired($field); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequence.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequence.php index 902053eca91..6cab76500c3 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequence.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequence.php @@ -23,13 +23,7 @@ class DefaultBrickGetterSequence implements GetterInterface { use OptionsResolverTrait; - /** - * @param object $object - * @param array $config - * - * @return mixed - */ - public function get($object, $config = null) + public function get(object $object, array $config = null): mixed { $config = $this->resolveOptions($config ?? []); $sourceList = $config['source']; @@ -58,9 +52,11 @@ public function get($object, $config = null) } } } + + return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { if ('default' === $resolverName) { $resolver->setRequired('source'); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequenceToMultiselect.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequenceToMultiselect.php index 662e2ad54a8..e8210dcec91 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequenceToMultiselect.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultBrickGetterSequenceToMultiselect.php @@ -23,7 +23,7 @@ class DefaultBrickGetterSequenceToMultiselect implements GetterInterface { use OptionsResolverTrait; - public function get($object, $config = null): array + public function get(object $object, array $config = null): mixed { $config = $this->resolveOptions($config ?? []); $sourceList = $config['source']; @@ -83,7 +83,7 @@ public function get($object, $config = null): array return $values; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { if ('default' === $resolverName) { $resolver diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultClassificationAttributeGetter.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultClassificationAttributeGetter.php index 7d7f0c7a552..7e28946ebd3 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultClassificationAttributeGetter.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/DefaultClassificationAttributeGetter.php @@ -36,7 +36,7 @@ class DefaultClassificationAttributeGetter implements GetterInterface * * @return mixed */ - public function get($object, $config = null): mixed + public function get(object $object, array $config = null): mixed { $config = $this->resolveOptions($config ?? []); $sourceList = $config['source']; @@ -57,7 +57,7 @@ public function get($object, $config = null): mixed return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { if ('default' === $resolverName) { $resolver->setRequired('source'); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/ExtendedGetterInterface.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/ExtendedGetterInterface.php index f032e979520..ab3c821989a 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/ExtendedGetterInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/ExtendedGetterInterface.php @@ -23,13 +23,5 @@ */ interface ExtendedGetterInterface extends GetterInterface { - /** - * @param object $object - * @param array $config - * @param int|null $subObjectId - * @param ConfigInterface|null $tenantConfig - * - * @return mixed - */ - public function get($object, $config = null, $subObjectId = null, ConfigInterface $tenantConfig = null); + public function get(object $object, array $config = null, ?int $subObjectId = null, ?ConfigInterface $tenantConfig = null): mixed; } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/GetterInterface.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/GetterInterface.php index b37c6e0568f..06244cf430c 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/GetterInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/GetterInterface.php @@ -18,11 +18,5 @@ interface GetterInterface { - /** - * @param object $object - * @param array $config - * - * @return mixed - */ - public function get($object, $config = null); + public function get(object $object, array $config = null): mixed; } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/TagsGetter.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/TagsGetter.php index 201a667bbfa..710d6288ae2 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/TagsGetter.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Getter/TagsGetter.php @@ -26,18 +26,18 @@ class TagsGetter implements GetterInterface { use OptionsResolverTrait; - public function get($element, $config = null): array + public function get(object $object, array $config = null): mixed { $config = $this->resolveOptions($config ?? []); $type = 'object'; - if ($element instanceof Asset) { + if ($object instanceof Asset) { $type = 'asset'; - } elseif ($element instanceof Document) { + } elseif ($object instanceof Document) { $type = 'document'; } - $tags = Tag::getTagsForElement($type, $element->getId()); + $tags = Tag::getTagsForElement($type, $object->getId()); if (!$config['includeParentTags']) { return $tags; @@ -57,7 +57,7 @@ public function get($element, $config = null): array return $result; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $resolver->setDefaults([ 'includeParentTags' => false, diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/AssetId.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/AssetId.php index 69d9ebf508d..4b2c2473652 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/AssetId.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/AssetId.php @@ -20,7 +20,7 @@ class AssetId implements InterpreterInterface { - public function interpret($value, $config = null): ?int + public function interpret(mixed $value, ?array $config = null): ?int { if (!empty($value) && $value instanceof Asset) { return $value->getId(); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultClassificationStore.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultClassificationStore.php index e6214267fea..f33d2174d9a 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultClassificationStore.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultClassificationStore.php @@ -28,7 +28,7 @@ class DefaultClassificationStore implements InterpreterInterface * * @throws \Exception */ - public function interpret($value, $config = null): ?array + public function interpret(mixed $value, ?array $config = null): ?array { if (!$value instanceof Classificationstore) { return null; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultObjects.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultObjects.php index b933ce5c387..66788781c31 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultObjects.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultObjects.php @@ -20,7 +20,7 @@ class DefaultObjects implements RelationInterpreterInterface { - public function interpret($value, $config = null): array + public function interpret(mixed $value, ?array $config = null): array { $result = []; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultRelations.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultRelations.php index 6e1fa1f7c4c..146046b00c6 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultRelations.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultRelations.php @@ -22,7 +22,7 @@ class DefaultRelations implements RelationInterpreterInterface { - public function interpret($value, $config = null): array + public function interpret(mixed $value, ?array $config = null): array { $result = []; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultStructuredTable.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultStructuredTable.php index 8e229e0f22d..8bee9993a57 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultStructuredTable.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/DefaultStructuredTable.php @@ -37,7 +37,7 @@ public function interpret(mixed $value, ?array $config = null): mixed return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { foreach (['column', 'row'] as $field) { $resolver diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/IdList.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/IdList.php index 23fde763052..a136e9664d6 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/IdList.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/IdList.php @@ -24,7 +24,7 @@ class IdList implements InterpreterInterface { use OptionsResolverTrait; - public function interpret($value, $config = null): ?string + public function interpret(mixed $value, ?array $config = null): ?string { $config = $this->resolveOptions($config ?? []); @@ -51,7 +51,7 @@ public function interpret($value, $config = null): ?string return $ids ? $delimiter . $ids . $delimiter : null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $resolver ->setDefault('multiSelectEncoded', false) diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Numeric.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Numeric.php index d7713c5f117..8d2f9970bc8 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Numeric.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Numeric.php @@ -18,7 +18,7 @@ class Numeric implements InterpreterInterface { - public function interpret($value, $config = null): float + public function interpret(mixed $value, ?array $config = null): float { return (float)$value; } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectId.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectId.php index 721eec67e32..a24b9a6556e 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectId.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectId.php @@ -20,7 +20,7 @@ class ObjectId implements InterpreterInterface { - public function interpret($value, $config = null): ?int + public function interpret(mixed $value, ?array $config = null): ?int { if (!empty($value) && $value instanceof AbstractObject) { return $value->getId(); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectIdSum.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectIdSum.php index 9dce019b92b..1f12a3334a5 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectIdSum.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectIdSum.php @@ -20,7 +20,7 @@ class ObjectIdSum implements InterpreterInterface { - public function interpret($value, $config = null): ?int + public function interpret(mixed $value, ?array $config = null): ?int { $sum = 0; if (is_array($value)) { diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectValue.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectValue.php index 5ed4a4d28b5..1a6605156b1 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectValue.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/ObjectValue.php @@ -40,7 +40,7 @@ public function interpret(mixed $value, ?array $config = null): mixed return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { if ('default' === $resolverName) { $resolver diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/QuantityValue.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/QuantityValue.php index 0f1c62eff3c..bd2bce0abe8 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/QuantityValue.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/QuantityValue.php @@ -46,7 +46,7 @@ public function interpret(mixed $value, ?array $config = null): float|int|string return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $resolver ->setDefault('onlyValue', false) diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Soundex.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Soundex.php index 9a528d24d1a..fb136e9286d 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Soundex.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/Soundex.php @@ -18,7 +18,7 @@ class Soundex implements InterpreterInterface { - public function interpret($value, $config = null): int + public function interpret(mixed $value, ?array $config = null): int { if (is_array($value)) { sort($value); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/StructuredTable.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/StructuredTable.php index cb3adee0532..d53ae61b1f0 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/StructuredTable.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Interpreter/StructuredTable.php @@ -23,7 +23,7 @@ class StructuredTable implements InterpreterInterface { use OptionsResolverTrait; - public function interpret($value, $config = null): ?string + public function interpret(mixed $value, ?array $config = null): ?string { $config = $this->resolveOptions($config ?? []); @@ -40,7 +40,7 @@ public function interpret($value, $config = null): ?string return null; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $resolver->setDefined('defaultUnit'); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultFindologic.php b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultFindologic.php index 5df1709c79e..27f84b9d8a5 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultFindologic.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultFindologic.php @@ -112,7 +112,7 @@ public function getProducts(): array return $this->products; } - public function addCondition(array|string $condition, string $fieldname = '') + public function addCondition(array|string $condition, string $fieldname = ''): void { $this->products = null; $this->conditions[$fieldname][] = $condition; @@ -132,7 +132,7 @@ public function resetCondition(string $fieldname): void * @param string|array $condition * @param string $fieldname */ - public function addQueryCondition(string|array $condition, string $fieldname = '') + public function addQueryCondition(string|array $condition, string $fieldname = ''): void { $this->products = null; $this->queryConditions[$fieldname][] = $condition; @@ -143,7 +143,7 @@ public function addQueryCondition(string|array $condition, string $fieldname = ' * * @param string $fieldname */ - public function resetQueryCondition(string $fieldname) + public function resetQueryCondition(string $fieldname): void { $this->products = null; unset($this->queryConditions[$fieldname]); @@ -152,7 +152,7 @@ public function resetQueryCondition(string $fieldname) /** * resets all conditions of product list */ - public function resetConditions() + public function resetConditions(): void { $this->conditions = []; $this->queryConditions = []; @@ -161,7 +161,7 @@ public function resetConditions() $this->products = null; } - public function addRelationCondition(string $fieldname, array|string $condition) + public function addRelationCondition(string $fieldname, array|string $condition): void { $this->products = null; $this->addCondition($condition, $fieldname); @@ -171,7 +171,7 @@ public function addRelationCondition(string $fieldname, array|string $condition) * @param float|null $from * @param float|null $to */ - public function addPriceCondition(?float $from = null, ?float $to = null) + public function addPriceCondition(?float $from = null, ?float $to = null): void { $this->products = null; $this->conditionPriceFrom = $from; @@ -189,7 +189,7 @@ public function getInProductList(): bool return $this->inProductList; } - public function setOrder(string $order) + public function setOrder(string $order): void { $this->products = null; $this->order = $order; @@ -203,7 +203,7 @@ public function getOrder(): ?string /** * @param array|string $orderKey either single field name, or array of field names or array of arrays (field name, direction) */ - public function setOrderKey(array|string $orderKey) + public function setOrderKey(array|string $orderKey): void { $this->products = null; $this->orderKey = $orderKey; @@ -214,7 +214,7 @@ public function getOrderKey(): array|string return $this->orderKey; } - public function setLimit(int $limit) + public function setLimit(int $limit): void { if ($this->limit != $limit) { $this->products = null; @@ -227,7 +227,7 @@ public function getLimit(): ?int return $this->limit; } - public function setOffset(int $offset) + public function setOffset(int $offset): void { if ($this->offset != $offset) { $this->products = null; @@ -240,7 +240,7 @@ public function getOffset(): int return $this->offset; } - public function setCategory(AbstractCategory $category) + public function setCategory(AbstractCategory $category): void { $this->products = null; $this->category = $category; @@ -251,7 +251,7 @@ public function getCategory(): ?AbstractCategory return $this->category; } - public function setVariantMode(string $variantMode) + public function setVariantMode(string $variantMode): void { $this->products = null; $this->variantMode = $variantMode; @@ -609,7 +609,7 @@ public function getGroupByRelationValues(string $fieldname, bool $countValues = return $relations; } - protected function doLoadGroupByValues() + protected function doLoadGroupByValues(): void { // init $params = []; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql.php b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql.php index 77e8eba4ac9..f6706b3ac2a 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql.php @@ -88,7 +88,7 @@ public function getProducts(): array protected ?float $conditionPriceTo = null; - public function addCondition(array|string $condition, string $fieldname = '') + public function addCondition(array|string $condition, string $fieldname = ''): void { $this->products = null; $this->conditions[$fieldname][] = $condition; @@ -100,7 +100,7 @@ public function resetCondition(string $fieldname): void unset($this->conditions[$fieldname]); } - public function addRelationCondition(string $fieldname, string|array $condition) + public function addRelationCondition(string $fieldname, string|array $condition): void { $this->products = null; $this->relationConditions[$fieldname][] = '`fieldname` = ' . $this->quote($fieldname) . ' AND ' . $condition; @@ -109,7 +109,7 @@ public function addRelationCondition(string $fieldname, string|array $condition) /** * resets all conditions of product list */ - public function resetConditions() + public function resetConditions(): void { $this->conditions = []; $this->relationConditions = []; @@ -127,7 +127,7 @@ public function resetConditions() * @param string|array $condition * @param string $fieldname */ - public function addQueryCondition(string|array $condition, string $fieldname = '') + public function addQueryCondition(string|array $condition, string $fieldname = ''): void { $this->products = null; $this->queryConditions[$fieldname][] = $condition; @@ -138,7 +138,7 @@ public function addQueryCondition(string|array $condition, string $fieldname = ' * * @param string $fieldname */ - public function resetQueryCondition(string $fieldname) + public function resetQueryCondition(string $fieldname): void { $this->products = null; unset($this->queryConditions[$fieldname]); @@ -148,7 +148,7 @@ public function resetQueryCondition(string $fieldname) * @param float|null $from * @param float|null $to */ - public function addPriceCondition(?float $from = null, ?float $to = null) + public function addPriceCondition(?float $from = null, ?float $to = null): void { $this->products = null; $this->conditionPriceFrom = $from; @@ -172,7 +172,7 @@ public function getInProductList(): bool protected bool $orderByPrice = false; - public function setOrder(string $order) + public function setOrder(string $order): void { $this->products = null; $this->order = $order; @@ -186,7 +186,7 @@ public function getOrder(): ?string /** * @param array|string $orderKey either single field name, or array of field names or array of arrays (field name, direction) */ - public function setOrderKey(array|string $orderKey) + public function setOrderKey(array|string $orderKey): void { $this->products = null; if ($orderKey == ProductListInterface::ORDERKEY_PRICE) { @@ -203,7 +203,7 @@ public function getOrderKey(): array|string return $this->orderKey; } - public function setLimit(int $limit) + public function setLimit(int $limit): void { if ($this->limit != $limit) { $this->products = null; @@ -216,7 +216,7 @@ public function getLimit(): ?int return $this->limit; } - public function setOffset(int $offset) + public function setOffset(int $offset): void { if ($this->offset != $offset) { $this->products = null; @@ -229,7 +229,7 @@ public function getOffset(): int return $this->offset; } - public function setCategory(AbstractCategory $category) + public function setCategory(AbstractCategory $category): void { $this->products = null; $this->category = $category; @@ -240,7 +240,7 @@ public function getCategory(): ?AbstractCategory return $this->category; } - public function setVariantMode(string $variantMode) + public function setVariantMode(string $variantMode): void { $this->products = null; $this->variantMode = $variantMode; @@ -478,7 +478,7 @@ public function getGroupByRelationValues(string $fieldname, bool $countValues = } } - protected function buildQueryFromConditions($excludeConditions = false, $excludedFieldname = null, $variantMode = null): string + protected function buildQueryFromConditions(bool $excludeConditions = false, ?string $excludedFieldname = null, ?string $variantMode = null): string { if ($variantMode == null) { $variantMode = $this->getVariantMode(); @@ -551,7 +551,7 @@ protected function buildQueryFromConditions($excludeConditions = false, $exclude return $condition; } - protected function buildUserspecificConditions($excludedFieldname = null): string + protected function buildUserspecificConditions(?string $excludedFieldname = null): string { $condition = ''; foreach ($this->relationConditions as $fieldname => $condArray) { @@ -633,7 +633,7 @@ protected function buildOrderBy(): ?string return null; } - public function quote($value) + public function quote(mixed $value): mixed { return $this->resource->quote($value); } @@ -739,7 +739,7 @@ public function valid(): bool * * @internal */ - public function __sleep() + public function __sleep(): array { $vars = get_object_vars($this); @@ -752,7 +752,7 @@ public function __sleep() /** * @internal */ - public function __wakeup() + public function __wakeup(): void { if (empty($this->resource)) { $this->resource = new DefaultMysql\Dao($this, $this->logger); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql/Dao.php b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql/Dao.php index d740cc0f193..c5f463dfcad 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/DefaultMysql/Dao.php @@ -41,7 +41,7 @@ public function __construct(DefaultMysql $model, LoggerInterface $logger) $this->logger = $logger; } - public function load($condition, $orderBy = null, $limit = null, $offset = null): array + public function load(string $condition, ?string $orderBy = null, ?int $limit = null, int $offset = 0): array { if ($condition) { $condition = 'WHERE ' . $condition; @@ -85,7 +85,7 @@ public function load($condition, $orderBy = null, $limit = null, $offset = null) return $result; } - public function loadGroupByValues($fieldname, $condition, $countValues = false): array + public function loadGroupByValues(string $fieldname, string $condition, bool $countValues = false): array { if ($condition) { $condition = 'WHERE ' . $condition; @@ -123,7 +123,7 @@ public function loadGroupByValues($fieldname, $condition, $countValues = false): } } - public function loadGroupByRelationValues($fieldname, $condition, $countValues = false): array + public function loadGroupByRelationValues(string $fieldname, string $condition, bool $countValues = false): array { if ($condition) { $condition = 'WHERE ' . $condition; @@ -171,7 +171,7 @@ public function loadGroupByRelationValues($fieldname, $condition, $countValues = } } - public function getCount($condition, $orderBy = null, $limit = null, $offset = null): int + public function getCount(string $condition, ?string $orderBy = null, ?int $limit = null, int $offset = 0): int { if ($condition) { $condition = 'WHERE ' . $condition; @@ -208,7 +208,7 @@ public function getCount($condition, $orderBy = null, $limit = null, $offset = n return is_int($result) ? $result : 0; } - public function quote($value) + public function quote(mixed $value): mixed { return $this->db->quote($value); } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ElasticSearch/AbstractElasticSearch.php b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ElasticSearch/AbstractElasticSearch.php index 7c2fccd48a5..74d112b9901 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ElasticSearch/AbstractElasticSearch.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ElasticSearch/AbstractElasticSearch.php @@ -172,7 +172,7 @@ public function setProductPositionMap(array $productPositionMap): static * @param array|string $condition * @param string $fieldname - must be set for elastic search */ - public function addCondition(array|string $condition, string $fieldname = '') + public function addCondition(array|string $condition, string $fieldname = ''): void { $this->filterConditions[$fieldname][] = $condition; $this->preparedGroupByValuesLoaded = false; @@ -197,7 +197,7 @@ public function resetCondition(string $fieldname): void * @param string $fieldname * @param string|array $condition */ - public function addRelationCondition(string $fieldname, string|array $condition) + public function addRelationCondition(string $fieldname, string|array $condition): void { $this->relationConditions[$fieldname][] = $condition; $this->preparedGroupByValuesLoaded = false; @@ -207,7 +207,7 @@ public function addRelationCondition(string $fieldname, string|array $condition) /** * Resets all conditions of product list */ - public function resetConditions() + public function resetConditions(): void { $this->relationConditions = []; $this->filterConditions = []; @@ -224,7 +224,7 @@ public function resetConditions() * @param string|array $condition * @param string $fieldname - must be set for elastic search */ - public function addQueryCondition(string|array $condition, string $fieldname = '') + public function addQueryCondition(string|array $condition, string $fieldname = ''): void { $this->queryConditions[$fieldname][] = $condition; $this->preparedGroupByValuesLoaded = false; @@ -236,7 +236,7 @@ public function addQueryCondition(string|array $condition, string $fieldname = ' * * @param string $fieldname */ - public function resetQueryCondition(string $fieldname) + public function resetQueryCondition(string $fieldname): void { unset($this->queryConditions[$fieldname]); $this->preparedGroupByValuesLoaded = false; @@ -249,7 +249,7 @@ public function resetQueryCondition(string $fieldname) * @param float|null $from * @param float|null $to */ - public function addPriceCondition(float $from = null, float $to = null) + public function addPriceCondition(float $from = null, float $to = null): void { $this->conditionPriceFrom = $from; $this->conditionPriceTo = $to; @@ -798,7 +798,7 @@ public function prepareGroupByValues(string $fieldname, bool $countValues = fals * * @throws \Exception */ - public function prepareGroupByValuesWithConfig(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true, array $aggregationConfig = []) + public function prepareGroupByValuesWithConfig(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true, array $aggregationConfig = []): void { if ($this->getVariantMode() == ProductListInterface::VARIANT_MODE_INCLUDE_PARENT_OBJECT) { throw new \Exception('Custom sub aggregations are not supported for variant mode VARIANT_MODE_INCLUDE_PARENT_OBJECT'); @@ -939,7 +939,7 @@ protected function doGetGroupByValues(string $fieldname, bool $countValues = fal * * @throws \Exception */ - protected function doLoadGroupByValues() + protected function doLoadGroupByValues(): void { // create general filters and queries $toExcludeFieldnames = []; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ProductListInterface.php b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ProductListInterface.php index 907a2472c2e..50c5846e178 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ProductListInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/ProductList/ProductListInterface.php @@ -70,7 +70,7 @@ public function getProducts(): array; * @param array|string $condition * @param string $fieldname */ - public function addCondition(array|string $condition, string $fieldname = ''); + public function addCondition(array|string $condition, string $fieldname = ''): void; /** * Adds query condition to product list for fulltext search @@ -80,7 +80,7 @@ public function addCondition(array|string $condition, string $fieldname = ''); * @param string|array $condition * @param string $fieldname */ - public function addQueryCondition(string|array $condition, string $fieldname = ''); + public function addQueryCondition(string|array $condition, string $fieldname = ''): void; /** * Reset filter condition for fieldname @@ -96,7 +96,7 @@ public function resetCondition(string $fieldname): void; * * @param string $fieldname */ - public function resetQueryCondition(string $fieldname); + public function resetQueryCondition(string $fieldname): void; /** * Adds relation condition to product list @@ -104,12 +104,12 @@ public function resetQueryCondition(string $fieldname); * @param string $fieldname * @param string|array $condition */ - public function addRelationCondition(string $fieldname, string|array $condition); + public function addRelationCondition(string $fieldname, string|array $condition): void; /** * Resets all conditions of product list */ - public function resetConditions(); + public function resetConditions(): void; /** * Adds price condition to product list @@ -117,7 +117,7 @@ public function resetConditions(); * @param float|null $from * @param float|null $to */ - public function addPriceCondition(float $from = null, float $to = null); + public function addPriceCondition(float $from = null, float $to = null): void; public function setInProductList(bool $inProductList): void; @@ -128,7 +128,7 @@ public function getInProductList(): bool; * * @param string $order */ - public function setOrder(string $order); + public function setOrder(string $order): void; /** * gets order direction @@ -142,23 +142,23 @@ public function getOrder(): ?string; * * @param array|string $orderKey either single field name, or array of field names or array of arrays (field name, direction) */ - public function setOrderKey(array|string $orderKey); + public function setOrderKey(array|string $orderKey): void; public function getOrderKey(): array|string; - public function setLimit(int $limit); + public function setLimit(int $limit): void; public function getLimit(): ?int; - public function setOffset(int $offset); + public function setOffset(int $offset): void; public function getOffset(): int; - public function setCategory(AbstractCategory $category); + public function setCategory(AbstractCategory $category): void; public function getCategory(): ?AbstractCategory; - public function setVariantMode(string $variantMode); + public function setVariantMode(string $variantMode): void; public function getVariantMode(): string; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/SynonymProvider/FileSynonymProvider.php b/bundles/EcommerceFrameworkBundle/src/IndexService/SynonymProvider/FileSynonymProvider.php index ef88e7f2672..e8fd231fb4d 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/SynonymProvider/FileSynonymProvider.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/SynonymProvider/FileSynonymProvider.php @@ -39,7 +39,7 @@ public function getSynonyms(): array return $synonymLines; } - protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver) + protected function configureOptionsResolver(string $resolverName, OptionsResolver $resolver): void { $resolver->setRequired(static::SYNONYM_FILE_OPTION); } diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractMockupCacheWorker.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractMockupCacheWorker.php index f6d504dc58c..877d9af4765 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractMockupCacheWorker.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractMockupCacheWorker.php @@ -51,7 +51,7 @@ protected function createMockupCacheKey(int $objectId): string * * @param int $objectId */ - protected function deleteFromMockupCache(int $objectId) + protected function deleteFromMockupCache(int $objectId): void { $key = $this->getMockupCachePrefix() . '_' . $this->name . '_' . $objectId; Cache::remove($key); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractWorker.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractWorker.php index 4509a24414e..0657401c912 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractWorker.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/AbstractWorker.php @@ -109,7 +109,7 @@ protected function getSystemAttributes(): array * @param IndexableInterface $object * @param array $subObjectIds */ - protected function doCleanupOldZombieData(IndexableInterface $object, array $subObjectIds) + protected function doCleanupOldZombieData(IndexableInterface $object, array $subObjectIds): void { $cleanupIds = $this->tenantConfig->getSubIdsToCleanup($object, $subObjectIds); foreach ($cleanupIds as $idToCleanup) { @@ -123,7 +123,7 @@ protected function doCleanupOldZombieData(IndexableInterface $object, array $sub * @param int $subObjectId * @param IndexableInterface|null $object - might be empty (when object doesn't exist any more in pimcore */ - abstract protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null); + abstract protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null): void; /** * Checks if given data is array and returns converted data suitable for search backend. For mysql it is a string with special delimiter. diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/BatchProcessingWorkerInterface.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/BatchProcessingWorkerInterface.php index 41c38c48037..20eb8dea046 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/BatchProcessingWorkerInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/BatchProcessingWorkerInterface.php @@ -28,7 +28,7 @@ interface BatchProcessingWorkerInterface extends WorkerInterface * * @param IndexableInterface $object */ - public function fillupPreparationQueue(IndexableInterface $object); + public function fillupPreparationQueue(IndexableInterface $object): void; /** * prepare data for index creation and store is in store table diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/DefaultFindologic.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/DefaultFindologic.php index f96836ae410..13e07b8f0d6 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/DefaultFindologic.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/DefaultFindologic.php @@ -103,7 +103,7 @@ public function updateIndex(IndexableInterface $object): void * @param array|null $data * @param array|null $metadata */ - protected function doUpdateIndex(int $objectId, array $data = null, array $metadata = null) + protected function doUpdateIndex(int $objectId, array $data = null, array $metadata = null): void { $xml = $this->createXMLElement(); @@ -273,13 +273,13 @@ protected function doUpdateIndex(int $objectId, array $data = null, array $metad * @param int $subObjectId * @param IndexableInterface|null $object */ - protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null) + protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null): void { $this->db->executeQuery(sprintf('DELETE FROM %1$s WHERE id = %2$d', $this->getExportTableName(), $subObjectId)); $this->db->executeQuery(sprintf('DELETE FROM %1$s WHERE id = %2$d', $this->getStoreTableName(), $subObjectId)); } - protected function updateExportItem(int $objectId, \SimpleXMLElement $item) + protected function updateExportItem(int $objectId, \SimpleXMLElement $item): void { // save $query = <<doCleanupOldZombieData($object, $subObjectIds); } - protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null) + protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null): void { $this->db->delete($this->tenantConfig->getTablename(), ['id' => $subObjectId]); $this->db->delete($this->tenantConfig->getRelationTablename(), ['src' => $subObjectId]); @@ -232,11 +232,17 @@ public function updateIndex(IndexableInterface $object): void $this->doCleanupOldZombieData($object, $subObjectIds); } - protected function getValidTableColumns($table) + /** + * @return string[] + */ + protected function getValidTableColumns(string $table): array { return $this->mySqlHelper->getValidTableColumns($table); } + /** + * @return string[] + */ protected function getSystemAttributes(): array { return $this->mySqlHelper->getSystemAttributes(); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ElasticSearch/AbstractElasticSearch.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ElasticSearch/AbstractElasticSearch.php index cd634d124ff..bdf390d1b7d 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ElasticSearch/AbstractElasticSearch.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ElasticSearch/AbstractElasticSearch.php @@ -106,7 +106,7 @@ public function getStoreCustomAttributes(): bool * * @param bool $storeCustomAttributes */ - public function setStoreCustomAttributes(bool $storeCustomAttributes) + public function setStoreCustomAttributes(bool $storeCustomAttributes): void { $this->storeCustomAttributes = $storeCustomAttributes; } @@ -358,7 +358,7 @@ public function updateIndex(IndexableInterface $object): void $this->fillupPreparationQueue($object); } - protected function doUpdateIndex(int $objectId, array $data = null, array $metadata = null) + protected function doUpdateIndex(int $objectId, array $data = null, array $metadata = null): void { $isLocked = $this->checkIndexLock(false); @@ -511,7 +511,7 @@ protected function getStoreTableName(): string * * @throws \Exception */ - public function switchIndexAlias() + public function switchIndexAlias(): void { Logger::info('Index-Actions - Switching Alias'); $esClient = $this->getElasticSearchClient(); @@ -579,7 +579,7 @@ protected function convertArray(array|string $data): array|string * * @throws \Exception */ - protected function doDeleteFromIndex(int $objectId, IndexableInterface $object = null) + protected function doDeleteFromIndex(int $objectId, IndexableInterface $object = null): void { $esClient = $this->getElasticSearchClient(); @@ -609,7 +609,7 @@ protected function doDeleteFromIndex(int $objectId, IndexableInterface $object = } } - protected function doCreateOrUpdateIndexStructures() + protected function doCreateOrUpdateIndexStructures(): void { $this->checkIndexLock(true); @@ -703,7 +703,7 @@ public function fetchEsActiveIndex(): ?string * * @throws \Exception if alias could not be created. */ - protected function createEsAliasIfMissing() + protected function createEsAliasIfMissing(): void { $esClient = $this->getElasticSearchClient(); //create alias for new index if alias doesn't exist so far @@ -734,7 +734,7 @@ protected function createEsAliasIfMissing() * * @throws \Exception is thrown if index cannot be created, for instance if connection fails or index is already existing. */ - protected function createEsIndex(string $indexName) + protected function createEsIndex(string $indexName): void { $esClient = $this->getElasticSearchClient(); @@ -763,7 +763,7 @@ protected function createEsIndex(string $indexName) * * @throws \Exception */ - protected function putIndexMapping(string $indexName) + protected function putIndexMapping(string $indexName): void { $esClient = $this->getElasticSearchClient(); @@ -783,7 +783,7 @@ protected function putIndexMapping(string $indexName) * * @param string $indexName the name of the index. */ - protected function deleteEsIndexIfExisting(string $indexName) + protected function deleteEsIndexIfExisting(string $indexName): void { $esClient = $this->getElasticSearchClient(); $result = $esClient->indices()->exists(['index' => $indexName])->asBool(); @@ -801,7 +801,7 @@ protected function deleteEsIndexIfExisting(string $indexName) * * @param string $indexName the name of the index. */ - protected function blockIndexWrite(string $indexName) + protected function blockIndexWrite(string $indexName): void { $esClient = $this->getElasticSearchClient(); $result = $esClient->indices()->exists(['index' => $indexName])->asBool(); @@ -825,7 +825,7 @@ protected function blockIndexWrite(string $indexName) * * @param string $indexName the name of the index. */ - protected function unblockIndexWrite(string $indexName) + protected function unblockIndexWrite(string $indexName): void { $esClient = $this->getElasticSearchClient(); $result = $esClient->indices()->exists(['index' => $indexName])->asBool(); @@ -862,7 +862,7 @@ protected function getNextIndexVersion(): int * @param string $targetIndexName the name of the target index in ES. If existing, will be deleted * */ - protected function performReindex(string $sourceIndexName, string $targetIndexName) + protected function performReindex(string $sourceIndexName, string $targetIndexName): void { $esClient = $this->getElasticSearchClient(); @@ -907,7 +907,7 @@ protected function performReindex(string $sourceIndexName, string $targetIndexNa * * @throws \Exception */ - public function startReindexMode() + public function startReindexMode(): void { try { $this->activateIndexLock(); //lock all other processes @@ -945,7 +945,7 @@ public function startReindexMode() * * @throws \Exception is thrown if the synonym transmission fails. */ - public function updateSynonyms(string $indexNameOverride = '', bool $skipComparison = false, bool $skipLocking = true) + public function updateSynonyms(string $indexNameOverride = '', bool $skipComparison = false, bool $skipLocking = true): void { try { if (!$skipLocking) { @@ -1093,12 +1093,12 @@ protected function checkIndexLock(bool $throwException = true): bool return false; } - protected function activateIndexLock() + protected function activateIndexLock(): void { TmpStore::set(self::REINDEXING_LOCK_KEY, 1, null, 60 * 10); } - protected function releaseIndexLock() + protected function releaseIndexLock(): void { TmpStore::delete(self::REINDEXING_LOCK_KEY); $this->lastLockLogTimestamp = 0; diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/Helper/MySql.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/Helper/MySql.php index 7caf5832eb1..4d99ffec408 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/Helper/MySql.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/Helper/MySql.php @@ -25,6 +25,9 @@ class MySql { + /** + * @var string[] + */ protected array $_sqlChangeLog = []; protected MysqlConfigInterface $tenantConfig; @@ -37,7 +40,10 @@ public function __construct(MysqlConfigInterface $tenantConfig, Connection $db) $this->db = $db; } - public function getValidTableColumns($table) + /** + * @return string[] + */ + public function getValidTableColumns(string $table): array { $cacheKey = 'plugin_ecommerce_productindex_columns_' . $table; @@ -54,7 +60,7 @@ public function getValidTableColumns($table) return Cache\RuntimeCache::load($cacheKey); } - public function doInsertData($data): void + public function doInsertData(array $data): void { $validColumns = $this->getValidTableColumns($this->tenantConfig->getTablename()); foreach ($data as $column => $value) { @@ -66,6 +72,9 @@ public function doInsertData($data): void Helper::insertOrUpdate($this->db, $this->tenantConfig->getTablename(), $data); } + /** + * @return string[] + */ public function getSystemAttributes(): array { return ['id', 'classId', 'parentId', 'virtualProductId', 'virtualProductActive', 'type', 'categoryIds', 'parentCategoryIds', 'priceSystemName', 'active', 'inProductList']; @@ -168,13 +177,13 @@ public function createOrUpdateIndexStructures(): void } } - protected function dbexec($sql): void + protected function dbexec(string $sql): void { $this->logSql($sql); $this->db->executeQuery($sql); } - protected function logSql($sql): void + protected function logSql(string $sql): void { Logger::info($sql); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/OptimizedMysql.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/OptimizedMysql.php index fcc67cece71..1017b0096ad 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/OptimizedMysql.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/OptimizedMysql.php @@ -69,7 +69,7 @@ public function deleteFromIndex(IndexableInterface $object): void $this->doCleanupOldZombieData($object, $subObjectIds); } - protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null) + protected function doDeleteFromIndex(int $subObjectId, IndexableInterface $object = null): void { try { $this->db->beginTransaction(); @@ -115,7 +115,7 @@ public function updateIndex(IndexableInterface $object): void * @param array|null $data * @param array|null $metadata */ - public function doUpdateIndex(int $objectId, array $data = null, array $metadata = null) + public function doUpdateIndex(int $objectId, array $data = null, array $metadata = null): void { if (empty($data)) { $data = $this->db->fetchOne('SELECT data FROM ' . self::STORE_TABLE_NAME . ' WHERE id = ? AND tenant = ?', [$objectId, $this->name]); @@ -148,11 +148,17 @@ public function doUpdateIndex(int $objectId, array $data = null, array $metadata } } - protected function getValidTableColumns($table) + /** + * @return string[] + */ + protected function getValidTableColumns(string $table): array { return $this->mySqlHelper->getValidTableColumns($table); } + /** + * @return string[] + */ protected function getSystemAttributes(): array { return $this->mySqlHelper->getSystemAttributes(); diff --git a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ProductCentricBatchProcessingWorker.php b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ProductCentricBatchProcessingWorker.php index 5f0790cce59..b1b97f275c2 100644 --- a/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ProductCentricBatchProcessingWorker.php +++ b/bundles/EcommerceFrameworkBundle/src/IndexService/Worker/ProductCentricBatchProcessingWorker.php @@ -37,8 +37,6 @@ abstract class ProductCentricBatchProcessingWorker extends AbstractWorker implem /** * returns name for store table - * - * @return string */ abstract protected function getStoreTableName(): string; @@ -47,17 +45,9 @@ public function getBatchProcessingStoreTableName(): string return $this->getStoreTableName(); } - /** - * @param int $objectId - * @param array|null $data - * @param array|null $metadata - */ - abstract protected function doUpdateIndex(int $objectId, array $data = null, array $metadata = null); + abstract protected function doUpdateIndex(int $objectId, array $data = null, array $metadata = null): void; - /** - * @param int $objectId - */ - public function updateItemInIndex($objectId): void + public function updateItemInIndex(int $objectId): void { $this->doUpdateIndex($objectId); } @@ -70,7 +60,7 @@ public function commitBatchToIndex(): void /** * creates store table */ - protected function createOrUpdateStoreTable() + protected function createOrUpdateStoreTable(): void { $primaryIdColumnType = $this->tenantConfig->getIdColumnType(true); $idColumnType = $this->tenantConfig->getIdColumnType(false); @@ -98,11 +88,8 @@ protected function createOrUpdateStoreTable() /** * Inserts the data do the store table - * - * @param array $data - * @param int $subObjectId */ - protected function insertDataToIndex(array $data, int $subObjectId) + protected function insertDataToIndex(array $data, int $subObjectId): void { $currentEntry = $this->db->fetchAssociative('SELECT crc_current, in_preparation_queue FROM ' . $this->getStoreTableName() . ' WHERE id = ? AND tenant = ?', [$subObjectId, $this->name]); if (!$currentEntry) { @@ -126,10 +113,8 @@ protected function getWorkerTimeout(): int /** * deletes element from store table - * - * @param int $objectId */ - protected function deleteFromStoreTable(int $objectId) + protected function deleteFromStoreTable(int $objectId): void { $this->db->delete($this->getStoreTableName(), ['id' => (string)$objectId, 'tenant' => $this->name]); } @@ -137,11 +122,9 @@ protected function deleteFromStoreTable(int $objectId) /** * fills queue based on path * - * @param IndexableInterface $object - * * @throws \Exception */ - public function fillupPreparationQueue(IndexableInterface $object) + public function fillupPreparationQueue(IndexableInterface $object): void { if ($object instanceof Concrete) { //need check, if there are sub objects because update on empty result set is too slow @@ -157,11 +140,6 @@ public function fillupPreparationQueue(IndexableInterface $object) /** * prepare data for index creation and store is in store table - * - * @param IndexableInterface $object - * @param int $subObjectId - * - * @return array */ protected function getDefaultDataForIndex(IndexableInterface $object, int $subObjectId): array { @@ -426,12 +404,6 @@ public function resetIndexingQueue(): void } /** - * @param \Closure $fn - * @param int $maxTries - * @param float $sleep - * - * @return bool - * * @throws \Exception */ protected function executeTransactionalQuery(\Closure $fn, int $maxTries = 3, float $sleep = .5): bool diff --git a/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupPendingOrdersTask.php b/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupPendingOrdersTask.php index c2cebaf0195..058bf54aee2 100644 --- a/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupPendingOrdersTask.php +++ b/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupPendingOrdersTask.php @@ -25,7 +25,7 @@ */ class CleanupPendingOrdersTask implements TaskInterface { - public function execute() + public function execute(): void { $checkoutManager = Factory::getInstance()->getCheckoutManager(new Cart()); $checkoutManager->cleanUpPendingOrders(); diff --git a/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupVouchersTask.php b/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupVouchersTask.php index fe856ec22fe..78ed664bf4c 100644 --- a/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupVouchersTask.php +++ b/bundles/EcommerceFrameworkBundle/src/Maintenance/CleanupVouchersTask.php @@ -24,7 +24,7 @@ */ class CleanupVouchersTask implements TaskInterface { - public function execute() + public function execute(): void { Factory::getInstance()->getVoucherService()->cleanUpReservations(); Factory::getInstance()->getVoucherService()->cleanUpStatistics(); diff --git a/bundles/EcommerceFrameworkBundle/src/Model/AbstractOrderItem.php b/bundles/EcommerceFrameworkBundle/src/Model/AbstractOrderItem.php index 77042b2641c..699c5d2cb6b 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/AbstractOrderItem.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/AbstractOrderItem.php @@ -27,31 +27,52 @@ abstract class AbstractOrderItem extends Concrete { abstract public function getProduct(): ?AbstractElement; - abstract public function setProduct(?AbstractElement $product); + /** + * @return $this + */ + abstract public function setProduct(?AbstractElement $product): static; abstract public function getProductNumber(): ?string; - abstract public function setProductNumber(?string $productNumber); + /** + * @return $this + */ + abstract public function setProductNumber(?string $productNumber): static; abstract public function getProductName(): ?string; - abstract public function setProductName(?string $productName); + /** + * @return $this + */ + abstract public function setProductName(?string $productName): static; abstract public function getAmount(): ?float; - abstract public function setAmount(?float $amount): mixed; + /** + * @return $this + */ + abstract public function setAmount(?float $amount): static; abstract public function getTotalPrice(): ?string; - abstract public function setTotalPrice(?string $totalPrice); + /** + * @return $this + */ + abstract public function setTotalPrice(?string $totalPrice): static; abstract public function getTotalNetPrice(): ?string; - abstract public function setTotalNetPrice(?string $totalNetPrice); + /** + * @return $this + */ + abstract public function setTotalNetPrice(?string $totalNetPrice): static; abstract public function getTaxInfo(): array; - abstract public function setTaxInfo(?array $taxInfo); + /** + * @return $this + */ + abstract public function setTaxInfo(?array $taxInfo): static; /** * @return AbstractOrderItem[] @@ -60,19 +81,30 @@ abstract public function getSubItems(): array; /** * @param AbstractOrderItem[] $subItems + * + * @return $this */ - abstract public function setSubItems(?array $subItems); + abstract public function setSubItems(?array $subItems): static; abstract public function getPricingRules(): ?Fieldcollection; + /** + * @return $this + */ abstract public function setPricingRules(?Fieldcollection $pricingRules): static; abstract public function getOrderState(): ?string; + /** + * @return $this + */ abstract public function setOrderState(?string $orderState): static; abstract public function getComment(): ?string; + /** + * @return $this + */ abstract public function setComment(?string $comment): static; /** diff --git a/bundles/EcommerceFrameworkBundle/src/Model/AbstractProduct.php b/bundles/EcommerceFrameworkBundle/src/Model/AbstractProduct.php index acfdee06bf4..7d0d59943ce 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/AbstractProduct.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/AbstractProduct.php @@ -137,7 +137,7 @@ public function getAvailabilitySystemName(): string * may be overwritten in subclasses for additional logic * */ - public function getOSIsBookable($quantityScale = 1): bool + public function getOSIsBookable(int $quantityScale = 1): bool { $price = $this->getOSPrice($quantityScale); diff --git a/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProduct.php b/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProduct.php index 79ab7091ac9..69350c63329 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProduct.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProduct.php @@ -54,7 +54,7 @@ abstract public function getOptionalProductEntries(): ?array; * * @return bool */ - public function getOSIsBookable($quantityScale = 1, array $products = null): bool + public function getOSIsBookable(int $quantityScale = 1, array $products = null): bool { if ($this->isActive()) { if (empty($products)) { diff --git a/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProductEntry.php b/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProductEntry.php index 7bbbee8c50b..9188267ab2a 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProductEntry.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/AbstractSetProductEntry.php @@ -21,18 +21,11 @@ */ class AbstractSetProductEntry { - /** - * @var int - */ - private mixed $quantity = null; + private int $quantity; private CheckoutableInterface $product; - /** - * @param CheckoutableInterface $product - * @param int $quantity - */ - public function __construct(CheckoutableInterface $product, $quantity = 1) + public function __construct(CheckoutableInterface $product, int $quantity = 1) { $this->product = $product; $this->quantity = $quantity; diff --git a/bundles/EcommerceFrameworkBundle/src/Model/CheckoutableInterface.php b/bundles/EcommerceFrameworkBundle/src/Model/CheckoutableInterface.php index cfe425e80c8..72206eb50b8 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/CheckoutableInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/CheckoutableInterface.php @@ -44,7 +44,7 @@ public function getAvailabilitySystemName(): string; /** * checks if product is bookable */ - public function getOSIsBookable($quantityScale = 1): bool; + public function getOSIsBookable(int $quantityScale = 1): bool; /** * returns instance of price system implementation based on result of getPriceSystemName() diff --git a/bundles/EcommerceFrameworkBundle/src/Model/DefaultMockup.php b/bundles/EcommerceFrameworkBundle/src/Model/DefaultMockup.php index 267e3d77596..3e4bdac498d 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/DefaultMockup.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/DefaultMockup.php @@ -32,12 +32,7 @@ class DefaultMockup implements ProductInterface, LinkGeneratorAwareInterface, In */ protected static array $linkGenerators = []; - /** - * @param int $id - * @param array $params - * @param array $relations - */ - public function __construct($id, $params, $relations) + public function __construct(int $id, array $params, array $relations) { $this->id = $id; $this->params = $params; @@ -93,12 +88,7 @@ public function getId(): int return $this->id; } - /** - * @param string $attributeName - * - * @return mixed - */ - public function getRelationAttribute($attributeName) + public function getRelationAttribute(string $attributeName): mixed { $relationObjectArray = []; if ($this->relations[$attributeName]) { @@ -119,13 +109,7 @@ public function getRelationAttribute($attributeName) } } - /** - * @param string $method - * @param array $args - * - * @return mixed - */ - public function __call($method, $args) + public function __call(string $method, array $args): mixed { $attributeName = $method; if (substr($method, 0, 3) == 'get') { diff --git a/bundles/EcommerceFrameworkBundle/src/Model/MockProduct.php b/bundles/EcommerceFrameworkBundle/src/Model/MockProduct.php index 62b2e15c76b..7a5949f51df 100644 --- a/bundles/EcommerceFrameworkBundle/src/Model/MockProduct.php +++ b/bundles/EcommerceFrameworkBundle/src/Model/MockProduct.php @@ -37,10 +37,7 @@ public function getAvailabilitySystemName(): string return 'default'; } - /** - * @param int $quantityScale - */ - public function getOSIsBookable($quantityScale = 1): bool + public function getOSIsBookable(int $quantityScale = 1): bool { return false; } @@ -118,7 +115,7 @@ public function getPrice(): int return 0; } - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { return null; } diff --git a/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOffer.php b/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOffer.php index 80b27564f87..2019a502d2e 100644 --- a/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOffer.php +++ b/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOffer.php @@ -27,30 +27,51 @@ abstract class AbstractOffer extends Concrete { abstract public function getOffernumber(): ?string; - abstract public function setOffernumber(?string $offernumber); + /** + * @return $this + */ + abstract public function setOffernumber(?string $offernumber): static; abstract public function getTotalPrice(): ?string; + /** + * @return $this + */ abstract public function setTotalPriceBeforeDiscount(?string $totalPriceBeforeDiscount): static; abstract public function getTotalPriceBeforeDiscount(): ?string; + /** + * @return $this + */ abstract public function setTotalPrice(?string $totalPrice): static; abstract public function getDiscount(): ?string; + /** + * @return $this + */ abstract public function setDiscount(?string $discount): static; abstract public function getDiscountType(): ?string; + /** + * @return $this + */ abstract public function setDiscountType(?string $discountType): static; abstract public function getDateCreated(): ?\Carbon\Carbon; + /** + * @return $this + */ abstract public function setDateCreated(?\Carbon\Carbon $dateCreated): static; abstract public function getDateValidUntil(): ?\Carbon\Carbon; + /** + * @return $this + */ abstract public function setDateValidUntil(?\Carbon\Carbon $dateValidUntil): static; /** @@ -60,8 +81,10 @@ abstract public function getItems(): array; /** * @param AbstractOfferItem[] $items + * + * @return $this */ - abstract public function setItems(?array $items); + abstract public function setItems(?array $items): static; /** * @return AbstractOfferItem[] @@ -70,8 +93,10 @@ abstract public function getCustomItems(): array; /** * @param AbstractOfferItem[] $customItems + * + * @return $this */ - abstract public function setCustomItems(?array $customItems); + abstract public function setCustomItems(?array $customItems): static; /** * @throws UnsupportedException @@ -87,14 +112,19 @@ public function getCustomer(): mixed * @throws UnsupportedException * * @param mixed $customer + * + * @return $this */ - public function setCustomer(mixed $customer) + public function setCustomer(mixed $customer): static { throw new UnsupportedException('setCustomer is not implemented for ' . get_class($this)); } abstract public function getCartId(): ?string; + /** + * @return $this + */ abstract public function setCartId(?string $cartId): static; public function addCustomItemFromProduct(AbstractOfferToolProduct $product, int $amount = 1): ?AbstractOfferItem diff --git a/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferItem.php b/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferItem.php index 1da8fbd661c..91aebd72887 100644 --- a/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferItem.php +++ b/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferItem.php @@ -29,10 +29,16 @@ abstract class AbstractOfferItem extends Concrete */ abstract public function getProduct(): ?\Pimcore\Model\Element\AbstractElement; - abstract public function setProduct(?\Pimcore\Model\Element\AbstractElement $product); + /** + * @return $this + */ + abstract public function setProduct(?\Pimcore\Model\Element\AbstractElement $product): static; abstract public function getProductNumber(): ?string; + /** + * @return $this + */ abstract public function setProductNumber(?string $productNumber): static; abstract public function getProductName(): ?string; @@ -40,9 +46,11 @@ abstract public function getProductName(): ?string; /** * @param string|null $productName * + * @return $this + * * @throws UnsupportedException */ - abstract public function setProductName(?string $productName); + abstract public function setProductName(?string $productName): static; /** * @return float|null @@ -51,33 +59,57 @@ abstract public function setProductName(?string $productName); */ abstract public function getAmount(): ?float; + /** + * @return $this + */ abstract public function setAmount(?float $amount): static; abstract public function getOriginalTotalPrice(): ?string; + /** + * @return $this + */ abstract public function setOriginalTotalPrice(?string $originalTotalPrice): static; abstract public function getFinalTotalPrice(): ?string; + /** + * @return $this + */ abstract public function setFinalTotalPrice(?string $finalTotalPrice): static; abstract public function getDiscount(): ?string; + /** + * @return $this + */ abstract public function setDiscount(?string $discount): static; abstract public function getDiscountType(): ?string; + /** + * @return $this + */ abstract public function setDiscountType(?string $discountType): static; abstract public function getSubItems(): array; + /** + * @return $this + */ abstract public function setSubItems(?array $subItems): static; abstract public function getComment(): ?string; + /** + * @return $this + */ abstract public function setComment(?string $comment): static; abstract public function getCartItemKey(): ?string; + /** + * @return $this + */ abstract public function setCartItemKey(?string $cartItemKey): static; } diff --git a/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferToolProduct.php b/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferToolProduct.php index 45c6e7ad796..0e09c08c679 100644 --- a/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferToolProduct.php +++ b/bundles/EcommerceFrameworkBundle/src/OfferTool/AbstractOfferToolProduct.php @@ -64,7 +64,7 @@ public function getAvailabilitySystemName(): string * checks if product is bookable * returns always true in default implementation */ - public function getOSIsBookable($quantityScale = 1): bool + public function getOSIsBookable(int $quantityScale = 1): bool { return true; } diff --git a/bundles/EcommerceFrameworkBundle/src/OfferTool/DefaultService.php b/bundles/EcommerceFrameworkBundle/src/OfferTool/DefaultService.php index b1157c243b7..ef3208bb70c 100644 --- a/bundles/EcommerceFrameworkBundle/src/OfferTool/DefaultService.php +++ b/bundles/EcommerceFrameworkBundle/src/OfferTool/DefaultService.php @@ -21,6 +21,7 @@ use Pimcore\Bundle\EcommerceFrameworkBundle\CartManager\CartItemInterface; use Pimcore\Bundle\EcommerceFrameworkBundle\Factory; use Pimcore\Bundle\EcommerceFrameworkBundle\Model\CheckoutableInterface; +use Pimcore\Bundle\EcommerceFrameworkBundle\Model\ProductInterface; use Pimcore\Bundle\EcommerceFrameworkBundle\Type\Decimal; use Pimcore\Model\DataObject\AbstractObject; use Pimcore\Model\DataObject\Folder; @@ -104,13 +105,11 @@ public function createNewOfferFromCart(CartInterface $cart, array $excludeItems return $offer; } - protected function getExcludedItemKeys($excludeItems): array + protected function getExcludedItemKeys(array $excludeItems): array { $excludedItemKeys = []; - if ($excludeItems) { - foreach ($excludeItems as $item) { - $excludedItemKeys[$item->getItemKey()] = $item->getItemKey(); - } + foreach ($excludeItems as $item) { + $excludedItemKeys[$item->getItemKey()] = $item->getItemKey(); } return $excludedItemKeys; @@ -246,7 +245,7 @@ protected function setCurrentCustomer(AbstractOffer $offer): AbstractOffer return $offer; } - public function updateOfferFromCart(AbstractOffer $offer, CartInterface $cart, array $excludeItems = [], $save = true): AbstractOffer + public function updateOfferFromCart(AbstractOffer $offer, CartInterface $cart, array $excludeItems = [], bool $save = true): AbstractOffer { $excludedItemKeys = $this->getExcludedItemKeys($excludeItems); @@ -325,7 +324,7 @@ public function getOffersForCart(CartInterface $cart): array return $list->load(); } - public function createCustomOfferToolItem($product, $offer) + public function createCustomOfferToolItem(ProductInterface $product, AbstractOffer $offer): void { } } diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/AgentFactory.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/AgentFactory.php index afc2e37a7ac..b040376f36d 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/AgentFactory.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/AgentFactory.php @@ -51,7 +51,7 @@ public function __construct( $this->processOptions($resolver->resolve($options)); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { if (isset($options['agent_class'])) { if (!class_exists($options['agent_class'])) { @@ -65,7 +65,7 @@ protected function processOptions(array $options) } } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setDefined('agent_class'); $resolver->setAllowedTypes('agent_class', 'string'); diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/AbstractSearch.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/AbstractSearch.php index 1c8f35657ce..21afb9cd066 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/AbstractSearch.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/AbstractSearch.php @@ -76,7 +76,7 @@ public function apply(OrderListInterface $orderList): static * * @param OrderListInterface $orderList */ - protected function prepareApply(OrderListInterface $orderList) + protected function prepareApply(OrderListInterface $orderList): void { } } diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/OrderDateTime.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/OrderDateTime.php index 19c29edb4c9..295699564ef 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/OrderDateTime.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/OrderDateTime.php @@ -72,7 +72,7 @@ public function getColumn(): string return $this->column; } - public function setColumn(string $column) + public function setColumn(string $column): void { $this->column = $column; } diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/Search/PaymentReference.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/Search/PaymentReference.php index 1c14917f9a5..2fd47329bb7 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/Search/PaymentReference.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Filter/Search/PaymentReference.php @@ -39,7 +39,7 @@ protected function getConditionValue(): string * * @param OrderListInterface $orderList */ - protected function prepareApply(OrderListInterface $orderList) + protected function prepareApply(OrderListInterface $orderList): void { $orderList->joinPaymentInfo(); } diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Item.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Item.php index dfcea8076fc..0a5b20de447 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Item.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/Order/Listing/Item.php @@ -30,14 +30,9 @@ public function getId(): int } /** - * @param string $method - * @param array $args - * - * @return mixed - * * @throws \Exception */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { $field = substr($method, 3); if (substr($method, 0, 3) == 'get' && array_key_exists($field, $this->resultRow)) { diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderAgent.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderAgent.php index 1ac5d0f002a..bf263791c9c 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderAgent.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderAgent.php @@ -628,7 +628,7 @@ public function updatePayment(StatusInterface $status): static * @param StatusInterface $status * @param AbstractPaymentInformation $currentPaymentInformation */ - protected function extractAdditionalPaymentInformation(StatusInterface $status, AbstractPaymentInformation $currentPaymentInformation) + protected function extractAdditionalPaymentInformation(StatusInterface $status, AbstractPaymentInformation $currentPaymentInformation): void { } diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManager.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManager.php index b04273bddcb..137090055eb 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManager.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManager.php @@ -95,7 +95,7 @@ public function __construct( $this->processOptions($resolver->resolve($options)); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $this->customerClassName = $options['customer_class']; $this->orderClassName = $options['order_class']; @@ -103,7 +103,7 @@ protected function processOptions(array $options) $this->options = $options; } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $classProperties = ['customer_class', 'order_class', 'order_item_class', 'list_class', 'list_item_class']; @@ -477,7 +477,7 @@ protected function createOrderItem(CartItemInterface $item, AbstractObject $pare return $event->getOrderItem(); } - protected function buildOrderItemKey(CartItemInterface $item, bool $isGiftItem = false) + protected function buildOrderItemKey(CartItemInterface $item, bool $isGiftItem = false): string { $itemKey = File::getValidFilename(sprintf( '%s_%s%s', @@ -492,13 +492,7 @@ protected function buildOrderItemKey(CartItemInterface $item, bool $isGiftItem = return $event->getArgument('itemKey'); } - /** - * @param string $className - * @param array $params - * - * @return mixed - */ - protected function buildModelClass($className, array $params = []) + protected function buildModelClass(string $className, array $params = []): mixed { if (null === $this->modelFactory) { throw new \RuntimeException('Model factory is not set. Please either configure the order manager service to be autowired or add a call to setModelFactory'); @@ -521,7 +515,7 @@ public function createOrderAgent(AbstractOrder $order): OrderAgentInterface return $this->orderAgentFactory->createAgent($order); } - public function setCustomerClass(string $classname) + public function setCustomerClass(string $classname): void { $this->customerClassName = $classname; } @@ -534,7 +528,7 @@ protected function getCustomerClassName(): string return $this->customerClassName; } - public function setOrderClass(string $classname) + public function setOrderClass(string $classname): void { $this->orderClassName = $classname; } @@ -544,7 +538,7 @@ protected function getOrderClassName(): string return $this->orderClassName; } - public function setOrderItemClass(string $classname) + public function setOrderItemClass(string $classname): void { $this->orderItemClassName = $classname; } @@ -559,7 +553,7 @@ protected function getOrderItemClassName(): string * * @throws \Exception */ - public function setParentOrderFolder(int|Folder $orderParentFolder) + public function setParentOrderFolder(int|Folder $orderParentFolder): void { if ($orderParentFolder instanceof Folder) { $this->orderParentFolder = $orderParentFolder; @@ -621,7 +615,7 @@ protected function createCartId(CartInterface $cart): string * * @throws \Exception */ - protected function cleanupZombieOrderItems(AbstractOrder $order) + protected function cleanupZombieOrderItems(AbstractOrder $order): void { $validItemIds = []; foreach ($order->getItems() ?: [] as $item) { @@ -680,7 +674,7 @@ protected function applyOrderItems(array $items, AbstractOrder $order, bool $gif return $orderItems; } - protected function applyVoucherTokens(AbstractOrder $order, CartInterface $cart) + protected function applyVoucherTokens(AbstractOrder $order, CartInterface $cart): void { $voucherTokens = $cart->getVoucherTokenCodes(); if (is_array($voucherTokens)) { diff --git a/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManagerInterface.php b/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManagerInterface.php index f36ca199580..7a3b1fdebda 100644 --- a/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManagerInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/OrderManager/V7/OrderManagerInterface.php @@ -30,11 +30,11 @@ public function createOrderList(): OrderListInterface; public function createOrderAgent(AbstractOrder $order): OrderAgentInterface; - public function setParentOrderFolder(int|Folder $orderParentFolder); + public function setParentOrderFolder(int|Folder $orderParentFolder): void; - public function setOrderClass(string $classname); + public function setOrderClass(string $classname): void; - public function setOrderItemClass(string $classname); + public function setOrderItemClass(string $classname): void; /** * Looks if order object for given cart already exists, otherwise creates it diff --git a/bundles/EcommerceFrameworkBundle/src/PaymentManager/Payment/AbstractPayment.php b/bundles/EcommerceFrameworkBundle/src/PaymentManager/Payment/AbstractPayment.php index 917288aab0a..16ba1042448 100644 --- a/bundles/EcommerceFrameworkBundle/src/PaymentManager/Payment/AbstractPayment.php +++ b/bundles/EcommerceFrameworkBundle/src/PaymentManager/Payment/AbstractPayment.php @@ -27,7 +27,7 @@ abstract class AbstractPayment implements PaymentInterface protected string $configurationKey; - protected function processOptions(array $options) + protected function processOptions(array $options): void { if (isset($options['recurring_payment_enabled'])) { $this->recurringPaymentEnabled = (bool) $options['recurring_payment_enabled']; @@ -48,26 +48,14 @@ public function isRecurringPaymentEnabled(): bool return $this->recurringPaymentEnabled; } - /** - * @param AbstractOrder $sourceOrder - * @param object $paymentBrick - * - * @return void - */ - public function setRecurringPaymentSourceOrderData(AbstractOrder $sourceOrder, $paymentBrick) + public function setRecurringPaymentSourceOrderData(AbstractOrder $sourceOrder, object $paymentBrick): void { - throw new \RuntimeException('getRecurringPaymentDataProperties not implemented for ' . get_class($this)); + throw new \RuntimeException('setRecurringPaymentSourceOrderData not implemented for ' . get_class($this)); } - /** - * @param Concrete $orderListing - * @param array $additionalParameters - * - * @return void - */ - public function applyRecurringPaymentCondition(Concrete $orderListing, $additionalParameters = []) + public function applyRecurringPaymentCondition(Concrete $orderListing, array $additionalParameters = []): void { - throw new \RuntimeException('getRecurringPaymentDataProperties not implemented for ' . get_class($this)); + throw new \RuntimeException('applyRecurringPaymentCondition not implemented for ' . get_class($this)); } /** @@ -78,7 +66,7 @@ public function getConfigurationKey(): string return $this->configurationKey; } - public function setConfigurationKey(string $configurationKey) + public function setConfigurationKey(string $configurationKey): void { $this->configurationKey = $configurationKey; } diff --git a/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/PaymentInterface.php b/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/PaymentInterface.php index 60e82da8113..df81e12e234 100644 --- a/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/PaymentInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/PaymentInterface.php @@ -28,12 +28,6 @@ public function getName(): string; /** * Starts payment - * - * @param OrderAgentInterface $orderAgent - * @param PriceInterface $price - * @param AbstractRequest $config - * - * @return StartPaymentResponseInterface */ public function startPayment(OrderAgentInterface $orderAgent, PriceInterface $price, AbstractRequest $config): StartPaymentResponseInterface; @@ -44,43 +38,26 @@ public function handleResponse(StatusInterface|array $response): StatusInterface /** * Returns the authorized data from payment provider - * - * @return array */ public function getAuthorizedData(): array; /** * Set authorized data from payment provider - * - * @param array $authorizedData */ - public function setAuthorizedData(array $authorizedData); + public function setAuthorizedData(array $authorizedData): void; /** * Executes payment - * - * @param PriceInterface|null $price - * @param string|null $reference - * - * @return StatusInterface */ public function executeDebit(PriceInterface $price = null, string $reference = null): StatusInterface; /** * Executes credit - * - * @param PriceInterface $price - * @param string $reference - * @param string $transactionId - * - * @return StatusInterface */ public function executeCredit(PriceInterface $price, string $reference, string $transactionId): StatusInterface; /** * returns configuration key in yml configuration file - * - * @return string */ public function getConfigurationKey(): string; } diff --git a/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/RecurringPaymentInterface.php b/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/RecurringPaymentInterface.php index cc7164a7b58..8ec43098527 100644 --- a/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/RecurringPaymentInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/RecurringPaymentInterface.php @@ -23,12 +23,10 @@ interface RecurringPaymentInterface extends PaymentInterface { /** * Payment supports recurring payment - * - * @return bool */ public function isRecurringPaymentEnabled(): bool; - public function setRecurringPaymentSourceOrderData(AbstractOrder $sourceOrder, object $paymentBrick): mixed; + public function setRecurringPaymentSourceOrderData(AbstractOrder $sourceOrder, object $paymentBrick): void; - public function applyRecurringPaymentCondition(Concrete $orderListing, $additionalParameters = []): Concrete; + public function applyRecurringPaymentCondition(Concrete $orderListing, array $additionalParameters = []): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/StartPaymentRequest/AbstractRequest.php b/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/StartPaymentRequest/AbstractRequest.php index 77ba2236d0b..d433475f196 100644 --- a/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/StartPaymentRequest/AbstractRequest.php +++ b/bundles/EcommerceFrameworkBundle/src/PaymentManager/V7/Payment/StartPaymentRequest/AbstractRequest.php @@ -18,17 +18,14 @@ class AbstractRequest implements \ArrayAccess { - /** - * @param array $data - */ - public function __construct($data = []) + public function __construct(array $data = []) { foreach ($data as $key => $value) { $this->{$key} = $value; } } - public function set(string $name, mixed $value) + public function set(string $name, mixed $value): void { $this->{$name} = $value; } diff --git a/bundles/EcommerceFrameworkBundle/src/PimcoreEcommerceFrameworkBundle.php b/bundles/EcommerceFrameworkBundle/src/PimcoreEcommerceFrameworkBundle.php index 2b71c7feeb8..f0171d3f25e 100644 --- a/bundles/EcommerceFrameworkBundle/src/PimcoreEcommerceFrameworkBundle.php +++ b/bundles/EcommerceFrameworkBundle/src/PimcoreEcommerceFrameworkBundle.php @@ -36,7 +36,7 @@ public function getVersion(): string /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new RegisterConfiguredServicesPass()); } @@ -68,7 +68,7 @@ public function getJsPaths(): array ]; } - public function boot() + public function boot(): void { $container = $this->container; // set default decimal scale from config diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/AbstractPriceInfo.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/AbstractPriceInfo.php index d256c3786be..68bffc3dfd3 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/AbstractPriceInfo.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/AbstractPriceInfo.php @@ -33,7 +33,7 @@ class AbstractPriceInfo implements PriceInfoInterface */ protected array $products; - public static function getInstance(): AbstractPriceInfo + public static function getInstance(): static { return new static(func_get_args()); } @@ -41,7 +41,7 @@ public static function getInstance(): AbstractPriceInfo /** * {@inheritdoc} */ - public function setQuantity(int|string $quantity) + public function setQuantity(int|string $quantity): void { $this->quantity = $quantity; } @@ -111,7 +111,7 @@ public function getProduct(): ?CheckoutableInterface return $this->product; } - public function setProducts($products) + public function setProducts(array $products): void { $this->products = $products; } diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceInfo.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceInfo.php index 3f48e4edc8b..36f7ec40b56 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceInfo.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceInfo.php @@ -26,12 +26,7 @@ class AttributePriceInfo extends AbstractPriceInfo implements PriceInfoInterface protected PriceInterface $totalPrice; - /** - * @param PriceInterface $price - * @param int $quantity - * @param PriceInterface $totalPrice - */ - public function __construct(PriceInterface $price, $quantity, PriceInterface $totalPrice) + public function __construct(PriceInterface $price, int $quantity, PriceInterface $totalPrice) { $this->price = $price; $this->totalPrice = $totalPrice; @@ -50,13 +45,8 @@ public function getTotalPrice(): PriceInterface /** * Try to delegate all other functions to the product - * - * @param string $name - * @param array $arguments - * - * @return mixed */ - public function __call(string $name, array $arguments) + public function __call(string $name, array $arguments): mixed { return $this->product->$name($arguments); } diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceSystem.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceSystem.php index 0438cd047ea..a5831e6c9f1 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceSystem.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/AttributePriceSystem.php @@ -49,14 +49,14 @@ public function __construct(PricingManagerLocatorInterface $pricingManagers, Env $this->processOptions($resolver->resolve($options)); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $this->attributeName = $options['attribute_name']; $this->priceClass = $options['price_class']; $this->priceType = $options['price_type']; } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired([ 'attribute_name', diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/LazyLoadingPriceInfo.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/LazyLoadingPriceInfo.php index af0798d0410..72c572c245b 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/LazyLoadingPriceInfo.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/LazyLoadingPriceInfo.php @@ -27,12 +27,12 @@ class LazyLoadingPriceInfo extends AbstractPriceInfo implements PriceInfoInterfa */ protected array $priceRegistry = []; - public static function getInstance(): AbstractPriceInfo + public static function getInstance(): static { return parent::getInstance(); } - public function __call($name, $arg) + public function __call(string $name, array $arg): mixed { if (array_key_exists($name, $this->priceRegistry)) { return $this->priceRegistry[$name]; diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/ModificatedPrice.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/ModificatedPrice.php index 057b79032ff..e32c7137e56 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/ModificatedPrice.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/ModificatedPrice.php @@ -51,7 +51,7 @@ public function getDescription(): string return $this->description ?? ''; } - public function setDescription(?string $description = null) + public function setDescription(?string $description = null): void { $this->description = $description; } diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/Price.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/Price.php index 8a083cf0722..62aa1f8844c 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/Price.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/Price.php @@ -61,7 +61,7 @@ public function isMinPrice(): bool /** * {@inheritdoc} */ - public function setAmount(Decimal $amount, string $priceMode = self::PRICE_MODE_GROSS, bool $recalc = false) + public function setAmount(Decimal $amount, string $priceMode = self::PRICE_MODE_GROSS, bool $recalc = false): void { switch ($priceMode) { case self::PRICE_MODE_GROSS: @@ -85,7 +85,7 @@ public function getAmount(): Decimal return $this->grossAmount; } - public function setCurrency(Currency $currency) + public function setCurrency(Currency $currency): void { $this->currency = $currency; } @@ -172,7 +172,7 @@ public function setTaxEntryCombinationMode(?string $taxEntryCombinationMode = nu * * @param string $calculationMode */ - protected function updateTaxes(string $calculationMode) + protected function updateTaxes(string $calculationMode): void { $taxCalculationService = new TaxCalculationService(); $taxCalculationService->updateTaxes($this, $calculationMode); diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInfoInterface.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInfoInterface.php index 89d45c38297..b43cb870e08 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInfoInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInfoInterface.php @@ -59,7 +59,7 @@ public function getQuantity(): int|string; * * @param int|string $quantity */ - public function setQuantity(int|string $quantity); + public function setQuantity(int|string $quantity): void; /** * Relation to price system diff --git a/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInterface.php b/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInterface.php index 9a287f6b3ad..05e6f9bf5f5 100644 --- a/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/PriceSystem/PriceInterface.php @@ -49,7 +49,7 @@ public function isMinPrice(): bool; * @param string $priceMode - default to PRICE_MODE_GROSS * @param bool $recalc - default to false */ - public function setAmount(Decimal $amount, string $priceMode = self::PRICE_MODE_GROSS, bool $recalc = false); + public function setAmount(Decimal $amount, string $priceMode = self::PRICE_MODE_GROSS, bool $recalc = false): void; /** * Returns gross amount of price diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Action/Gift.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Action/Gift.php index 8f36dd70237..184687234db 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Action/Gift.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Action/Gift.php @@ -80,7 +80,7 @@ public function fromJSON(string $string): ActionInterface * * @internal */ - public function __sleep() + public function __sleep(): array { if (is_object($this->product)) { $this->productPath = $this->product->getFullPath(); @@ -94,7 +94,7 @@ public function __sleep() * * @internal */ - public function __wakeup() + public function __wakeup(): void { if ($this->productPath !== '') { $this->product = AbstractProduct::getByPath($this->productPath); diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogCategory.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogCategory.php index 4199e0dfc27..33e7397f168 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogCategory.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogCategory.php @@ -96,7 +96,7 @@ public function fromJSON(string $string): ConditionInterface * * @internal */ - public function __sleep() + public function __sleep(): array { return $this->handleSleep('categories', 'categoryIds'); } @@ -106,7 +106,7 @@ public function __sleep() * * @internal */ - public function __wakeup() + public function __wakeup(): void { $this->handleWakeup('categories', 'categoryIds'); } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogProduct.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogProduct.php index f14ead26855..121b2f7ab77 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogProduct.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/CatalogProduct.php @@ -113,7 +113,7 @@ public function fromJSON(string $string): ConditionInterface * * @internal */ - public function __sleep() + public function __sleep(): array { return $this->handleSleep('products', 'productIds'); } @@ -121,7 +121,7 @@ public function __sleep() /** * Restore products from serialized ID list */ - public function __wakeup() + public function __wakeup(): void { $this->handleWakeup('products', 'productIds'); } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/ClientIp.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/ClientIp.php index a7324b7a436..fadb6fadefc 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/ClientIp.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/ClientIp.php @@ -54,7 +54,7 @@ public function getIp(): int return $this->ip; } - public function setIp(int $ip) + public function setIp(int $ip): void { $this->ip = $ip; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sales.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sales.php index 839b6ba5cb3..40736e23470 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sales.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sales.php @@ -69,7 +69,7 @@ public function getAmount(): int return $this->amount; } - public function setAmount(int $amount) + public function setAmount(int $amount): void { $this->amount = (int)$amount; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sold.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sold.php index c2454260fd7..4182caeef3f 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sold.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/Sold.php @@ -82,7 +82,7 @@ public function getCount(): int return $this->count; } - public function setCount(int $count) + public function setCount(int $count): void { $this->count = (int)$count; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/TargetGroup.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/TargetGroup.php index b1c7d4b040f..46024b000ce 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/TargetGroup.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/TargetGroup.php @@ -47,7 +47,7 @@ public function check(EnvironmentInterface $environment): bool * * @internal */ - public function __sleep() + public function __sleep(): array { return ['targetGroupId', 'threshold']; } @@ -55,7 +55,7 @@ public function __sleep() /** * @internal */ - public function __wakeup() + public function __wakeup(): void { if ($this->targetGroupId) { $this->targetGroup = \Pimcore\Model\Tool\Targeting\TargetGroup::getById($this->targetGroupId); @@ -91,7 +91,7 @@ public function getTargetGroupId(): int return $this->targetGroupId; } - public function setTargetGroupId(int $targetGroupId) + public function setTargetGroupId(int $targetGroupId): void { $this->targetGroupId = $targetGroupId; if ($this->targetGroupId) { @@ -106,7 +106,7 @@ public function getTargetGroup(): \Pimcore\Model\Tool\Targeting\TargetGroup return $this->targetGroup; } - public function setTargetGroup(\Pimcore\Model\Tool\Targeting\TargetGroup $targetGroup) + public function setTargetGroup(\Pimcore\Model\Tool\Targeting\TargetGroup $targetGroup): void { $this->targetGroup = $targetGroup; $this->targetGroupId = $targetGroup->getId(); @@ -117,7 +117,7 @@ public function getThreshold(): int return $this->threshold; } - public function setThreshold(int $threshold) + public function setThreshold(int $threshold): void { $this->threshold = $threshold; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/VoucherToken.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/VoucherToken.php index b2ff4af6420..a9e0bafc964 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/VoucherToken.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Condition/VoucherToken.php @@ -57,7 +57,7 @@ public function check(EnvironmentInterface $environment): bool return false; } - public function checkVoucherCode($code): bool + public function checkVoucherCode(string $code): bool { if (in_array(VoucherServiceToken::getByCode($code)->getVoucherSeriesId(), $this->whiteListIds)) { return true; @@ -125,7 +125,7 @@ public function getWhiteListIds(): array /** * @param int[] $whiteListIds */ - public function setWhiteListIds(array $whiteListIds) + public function setWhiteListIds(array $whiteListIds): void { $this->whiteListIds = $whiteListIds; } @@ -141,7 +141,7 @@ public function getWhiteList(): array /** * @param \stdClass[] $whiteList */ - public function setWhiteList(array $whiteList) + public function setWhiteList(array $whiteList): void { $this->whiteList = $whiteList; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Environment.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Environment.php index 821aab39cc4..abe4a7a6b76 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Environment.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Environment.php @@ -143,7 +143,7 @@ public function getCategories(): array return $this->categories; } - public function setExecutionMode(string $executionMode) + public function setExecutionMode(string $executionMode): void { $this->executionMode = $executionMode; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/EnvironmentInterface.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/EnvironmentInterface.php index 4b1fdfb3771..087dd85eb68 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/EnvironmentInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/EnvironmentInterface.php @@ -64,7 +64,7 @@ public function getCategories(): array; * * @param string $executionMode */ - public function setExecutionMode(string $executionMode); + public function setExecutionMode(string $executionMode): void; /** * returns in with execution mode the system is - either product or cart diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/PriceInfo.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/PriceInfo.php index d2a585e4b94..141fd25b318 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/PriceInfo.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/PriceInfo.php @@ -178,9 +178,9 @@ public function getQuantity(): int|string /** * {@inheritdoc} */ - public function setQuantity(int|string $quantity) + public function setQuantity(int|string $quantity): void { - return $this->priceInfo->setQuantity($quantity); + $this->priceInfo->setQuantity($quantity); } /** @@ -225,13 +225,8 @@ public function getAmount(): Decimal /** * loop through any other calls - * - * @param string $name - * @param array $arguments - * - * @return mixed */ - public function __call(string $name, array $arguments) + public function __call(string $name, array $arguments): mixed { return call_user_func_array([$this->priceInfo, $name], $arguments); } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/PricingManager.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/PricingManager.php index d475738c589..7172e30ef0b 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/PricingManager.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/PricingManager.php @@ -67,7 +67,7 @@ public function __construct( $this->options = $resolver->resolve($options); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $classProperties = ['rule_class', 'price_info_class', 'environment_class']; @@ -84,7 +84,7 @@ protected function configureOptions(OptionsResolver $resolver) } } - public function setEnabled(bool $enabled) + public function setEnabled(bool $enabled): void { $this->enabled = $enabled; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule.php index 92caf8e9189..92938feca79 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule.php @@ -277,7 +277,7 @@ public function save(): static /** * delete item */ - public function delete() + public function delete(): void { $this->getDao()->delete(); } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Dao.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Dao.php index 298553805e4..acc15199e07 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Dao.php @@ -55,7 +55,7 @@ public function init(): void * * @throws NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE id=' . $this->db->quote($id)); if (empty($classRaw)) { @@ -67,7 +67,7 @@ public function getById(int $id) /** * Create a new record for the object in database */ - public function create() + public function create(): void { $this->db->insert(self::TABLE_NAME, []); $this->model->setId((int) $this->db->lastInsertId()); @@ -129,7 +129,7 @@ public function delete(): void $this->db->delete(self::TABLE_NAME, ['id' => $this->model->getId()]); } - public function setFieldsToSave(array $fields) + public function setFieldsToSave(array $fields): void { $this->fieldsToSave = $fields; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing.php index 76deefe14f4..37cc9a7e6d7 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing.php @@ -28,7 +28,7 @@ class Listing extends \Pimcore\Model\Listing\AbstractListing { protected bool $validate = false; - public function setValidation(bool $state) + public function setValidation(bool $state): void { $this->validate = (bool)$state; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing/Dao.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing/Dao.php index de9a7e2bf5b..9fa993d6b0f 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/Rule/Listing/Dao.php @@ -43,7 +43,7 @@ public function load(): array return $rules; } - public function setRuleClass($cartClass) + public function setRuleClass(string $cartClass): void { $this->ruleClass = $cartClass; } diff --git a/bundles/EcommerceFrameworkBundle/src/PricingManager/RuleInterface.php b/bundles/EcommerceFrameworkBundle/src/PricingManager/RuleInterface.php index 9e24262f9a7..a1481461754 100644 --- a/bundles/EcommerceFrameworkBundle/src/PricingManager/RuleInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/PricingManager/RuleInterface.php @@ -132,5 +132,5 @@ public function save(): static; /** * delete item */ - public function delete(); + public function delete(): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/SessionEnvironment.php b/bundles/EcommerceFrameworkBundle/src/SessionEnvironment.php index 2040e0c3043..39d7f69c015 100644 --- a/bundles/EcommerceFrameworkBundle/src/SessionEnvironment.php +++ b/bundles/EcommerceFrameworkBundle/src/SessionEnvironment.php @@ -48,7 +48,7 @@ public function __construct(RequestStack $requestStack, LocaleServiceInterface $ $this->requestStack = $requestStack; } - protected function load() + protected function load(): void { if ($this->sessionLoaded || $this->isCli()) { return; @@ -90,7 +90,7 @@ public function save(): mixed return $this; } - public function clearEnvironment() + public function clearEnvironment(): void { parent::clearEnvironment(); diff --git a/bundles/EcommerceFrameworkBundle/src/Tools/Installer.php b/bundles/EcommerceFrameworkBundle/src/Tools/Installer.php index 6cec140af08..985bb81f856 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tools/Installer.php +++ b/bundles/EcommerceFrameworkBundle/src/Tools/Installer.php @@ -144,7 +144,7 @@ public function __construct( parent::__construct(); } - public function install() + public function install(): void { $this->installFieldCollections(); $this->installClasses(); @@ -153,7 +153,7 @@ public function install() $this->installPermissions(); } - public function uninstall() + public function uninstall(): void { $this->uninstallPermissions(); $this->uninstallTables(); diff --git a/bundles/EcommerceFrameworkBundle/src/Tools/PaymentProviderInstaller.php b/bundles/EcommerceFrameworkBundle/src/Tools/PaymentProviderInstaller.php index f06a7168c47..27ca093b75b 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tools/PaymentProviderInstaller.php +++ b/bundles/EcommerceFrameworkBundle/src/Tools/PaymentProviderInstaller.php @@ -26,12 +26,12 @@ class PaymentProviderInstaller extends AbstractInstaller /** * @var string // json source path */ - protected $bricksPath; + protected string $bricksPath; /** - * @var array //$brickKey => $brickImportJsonPath + * @var array //$brickKey => $brickImportJsonPath */ - protected $bricksToInstall = []; + protected array $bricksToInstall = []; /** * {@inheritdoc} @@ -49,18 +49,14 @@ public function canBeUninstalled(): bool return $this->isInstalled(); } - public function install(): bool + public function install(): void { $this->installBricks(); - - return true; } - public function uninstall(): bool + public function uninstall(): void { $this->unInstallBricks(); - - return true; } /** @@ -90,14 +86,14 @@ public function needsReloadAfterInstall(): bool return true; } - protected function installBricks() + protected function installBricks(): void { foreach ($this->bricksToInstall as $brickKey => $brickFile) { self::installBrick($brickKey, $this->bricksPath . $brickFile); } } - protected function unInstallBricks() + protected function unInstallBricks(): void { foreach ($this->bricksToInstall as $brickKey => $brickFile) { $brick = Objectbrick\Definition::getByKey($brickKey); @@ -107,13 +103,7 @@ protected function unInstallBricks() } } - /** - * @param string $brickKey - * @param string $filepath - * - * @return void - */ - protected static function installBrick($brickKey, $filepath) + protected static function installBrick(string $brickKey, string $filepath): void { try { $brick = Objectbrick\Definition::getByKey($brickKey); diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionAddInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionAddInterface.php index 6aa53aa2cd8..30c3ebb31df 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionAddInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionAddInterface.php @@ -28,5 +28,5 @@ interface CartProductActionAddInterface * @param ProductInterface $product * @param float|int $quantity */ - public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1); + public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionRemoveInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionRemoveInterface.php index d4a2aad3d8e..4a5c45c822a 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionRemoveInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CartProductActionRemoveInterface.php @@ -28,5 +28,5 @@ interface CartProductActionRemoveInterface * @param ProductInterface $product * @param float|int $quantity */ - public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1); + public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CartUpdateInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CartUpdateInterface.php index a15460cbad1..81cc5541d23 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CartUpdateInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CartUpdateInterface.php @@ -25,5 +25,5 @@ interface CartUpdateInterface * * @param CartInterface $cart */ - public function trackCartUpdate(CartInterface $cart); + public function trackCartUpdate(CartInterface $cart): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CategoryPageViewInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CategoryPageViewInterface.php index 0bd3b43d2d6..b185d36373a 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CategoryPageViewInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CategoryPageViewInterface.php @@ -24,5 +24,5 @@ interface CategoryPageViewInterface * @param array|string $category One or more categories matching the page * @param mixed $page Any kind of page information you can use to track your page */ - public function trackCategoryPageView(array|string $category, mixed $page = null); + public function trackCategoryPageView(array|string $category, mixed $page = null): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutCompleteInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutCompleteInterface.php index 1f57789c986..fbddd26b926 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutCompleteInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutCompleteInterface.php @@ -25,5 +25,5 @@ interface CheckoutCompleteInterface * * @param AbstractOrder $order */ - public function trackCheckoutComplete(AbstractOrder $order); + public function trackCheckoutComplete(AbstractOrder $order): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutInterface.php index 9896e1fd22d..f6c6cf1375d 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutInterface.php @@ -25,5 +25,5 @@ interface CheckoutInterface * * @param CartInterface $cart */ - public function trackCheckout(CartInterface $cart); + public function trackCheckout(CartInterface $cart): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutStepInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutStepInterface.php index 8a194d7ff20..fac5c313f6f 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutStepInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/CheckoutStepInterface.php @@ -29,5 +29,5 @@ interface CheckoutStepInterface * @param string|null $stepNumber * @param string|null $checkoutOption */ - public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null); + public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpression.php b/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpression.php index 50de13baa33..6934f079f44 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpression.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpression.php @@ -25,7 +25,7 @@ public function getList(): string return $this->list; } - public function setList(string $list) + public function setList(string $list): void { $this->list = $list; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpressionInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpressionInterface.php index 7aa25be2245..40787f14bed 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpressionInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/ProductImpressionInterface.php @@ -26,5 +26,5 @@ interface ProductImpressionInterface * @param ProductInterface $product * @param string $list */ - public function trackProductImpression(ProductInterface $product, string $list = 'default'); + public function trackProductImpression(ProductInterface $product, string $list = 'default'): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/ProductViewInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/ProductViewInterface.php index 1f1ea945598..1a5c3a6cf2f 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/ProductViewInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/ProductViewInterface.php @@ -25,5 +25,5 @@ interface ProductViewInterface * * @param ProductInterface $product */ - public function trackProductView(ProductInterface $product); + public function trackProductView(ProductInterface $product): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/TrackEventInterface.php b/bundles/EcommerceFrameworkBundle/src/Tracking/TrackEventInterface.php index a2ac114e9d5..3a655dc11d7 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/TrackEventInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/TrackEventInterface.php @@ -24,5 +24,5 @@ interface TrackEventInterface * @param string|null $eventLabel * @param int|null $eventValue */ - public function trackEvent(string $eventCategory, string $eventAction, string $eventLabel = null, int $eventValue = null); + public function trackEvent(string $eventCategory, string $eventAction, string $eventLabel = null, int $eventValue = null): void; } diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker.php b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker.php index e09fb354239..9fed46e72cf 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker.php @@ -58,12 +58,12 @@ public function __construct( $this->checkoutTenants = $checkoutTenants; } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $this->templatePrefix = $options['template_prefix']; } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired(['template_prefix']); diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/Ecommerce.php b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/Ecommerce.php index 47161710b7d..6ac7b1ed5ac 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/Ecommerce.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/Ecommerce.php @@ -25,7 +25,7 @@ class Ecommerce extends AbstractAnalyticsTracker implements CheckoutCompleteInterface { - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); @@ -39,7 +39,7 @@ protected function configureOptions(OptionsResolver $resolver) * * @param AbstractOrder $order */ - public function trackCheckoutComplete(AbstractOrder $order) + public function trackCheckoutComplete(AbstractOrder $order): void { $transaction = $this->trackingItemBuilder->buildCheckoutTransaction($order); $items = $this->trackingItemBuilder->buildCheckoutItems($order); diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/EnhancedEcommerce.php b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/EnhancedEcommerce.php index f1d13c97828..7d3f7a4af76 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/EnhancedEcommerce.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/EnhancedEcommerce.php @@ -61,7 +61,7 @@ class EnhancedEcommerce extends AbstractAnalyticsTracker implements */ protected array $trackedCodes = []; - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); @@ -75,7 +75,7 @@ protected function configureOptions(OptionsResolver $resolver) * * @param ProductInterface $product */ - public function trackProductView(ProductInterface $product) + public function trackProductView(ProductInterface $product): void { $this->ensureDependencies(); @@ -97,7 +97,7 @@ public function trackProductView(ProductInterface $product) * @param ProductInterface $product * @param string $list */ - public function trackProductImpression(ProductInterface $product, string $list = 'default') + public function trackProductImpression(ProductInterface $product, string $list = 'default'): void { $this->ensureDependencies(); @@ -114,9 +114,9 @@ public function trackProductImpression(ProductInterface $product, string $list = /** * {@inheritdoc} */ - public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1) + public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void { - return $this->trackProductActionAdd($product, $quantity); + $this->trackProductActionAdd($product, $quantity); } /** @@ -125,7 +125,7 @@ public function trackCartProductActionAdd(CartInterface $cart, ProductInterface * @param ProductInterface $product * @param float|int $quantity */ - public function trackProductActionAdd(ProductInterface $product, float|int $quantity = 1) + public function trackProductActionAdd(ProductInterface $product, float|int $quantity = 1): void { $this->ensureDependencies(); $this->trackProductAction($product, 'add', $quantity); @@ -134,7 +134,7 @@ public function trackProductActionAdd(ProductInterface $product, float|int $quan /** * {@inheritdoc} */ - public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1) + public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void { $this->trackProductActionRemove($product, $quantity); } @@ -145,13 +145,13 @@ public function trackCartProductActionRemove(CartInterface $cart, ProductInterfa * @param ProductInterface $product * @param float|int $quantity */ - public function trackProductActionRemove(ProductInterface $product, float|int $quantity = 1) + public function trackProductActionRemove(ProductInterface $product, float|int $quantity = 1): void { $this->ensureDependencies(); $this->trackProductAction($product, 'remove', $quantity); } - protected function trackProductAction(ProductInterface $product, string $action, float|int $quantity = 1) + protected function trackProductAction(ProductInterface $product, string $action, float|int $quantity = 1): void { $item = $this->trackingItemBuilder->buildProductActionItem($product); $item->setQuantity($quantity); @@ -169,7 +169,7 @@ protected function trackProductAction(ProductInterface $product, string $action, * * @param CartInterface $cart */ - public function trackCheckout(CartInterface $cart) + public function trackCheckout(CartInterface $cart): void { $this->ensureDependencies(); @@ -192,7 +192,7 @@ public function trackCheckout(CartInterface $cart) * @param string|null $stepNumber * @param string|null $checkoutOption */ - public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null) + public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null): void { $this->ensureDependencies(); @@ -221,7 +221,7 @@ public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, Ca * * @param AbstractOrder $order */ - public function trackCheckoutComplete(AbstractOrder $order) + public function trackCheckoutComplete(AbstractOrder $order): void { $this->ensureDependencies(); @@ -242,7 +242,7 @@ public function trackEvent( string $eventAction, string $eventLabel = null, int $eventValue = null - ) { + ): void { $parameters = [ 'eventCategory' => $eventCategory, 'eventAction' => $eventAction, @@ -365,7 +365,7 @@ protected function transformProductImpression(ProductImpression $item): array /** * Makes sure dependencies are included once before any call */ - protected function ensureDependencies() + protected function ensureDependencies(): void { if ($this->dependenciesIncluded || empty($this->dependencies)) { return; diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/UniversalEcommerce.php b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/UniversalEcommerce.php index 779e780f7a8..b6dc4a2cc22 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/UniversalEcommerce.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/Analytics/UniversalEcommerce.php @@ -25,7 +25,7 @@ class UniversalEcommerce extends AbstractAnalyticsTracker implements CheckoutCompleteInterface { - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); @@ -39,7 +39,7 @@ protected function configureOptions(OptionsResolver $resolver) * * @param AbstractOrder $order */ - public function trackCheckoutComplete(AbstractOrder $order) + public function trackCheckoutComplete(AbstractOrder $order): void { $transaction = $this->trackingItemBuilder->buildCheckoutTransaction($order); $items = $this->trackingItemBuilder->buildCheckoutItems($order); diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/GoogleTagManager.php b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/GoogleTagManager.php index 50e879df377..1b3d193b526 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/GoogleTagManager.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/Tracker/GoogleTagManager.php @@ -56,7 +56,7 @@ class GoogleTagManager extends Tracker implements protected array $deferred = []; - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); @@ -68,14 +68,14 @@ protected function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function trackProductImpression(ProductInterface $product, string $list = 'default') + public function trackProductImpression(ProductInterface $product, string $list = 'default'): void { $item = $this->trackingItemBuilder->buildProductImpressionItem($product, $list); $this->addDeferredItem(self::DEFERRED_DIMENSION_IMPRESSIONS, $this->transformProductImpression($item)); } - public function trackProductView(ProductInterface $product) + public function trackProductView(ProductInterface $product): void { $item = $this->trackingItemBuilder->buildProductViewItem($product); @@ -95,7 +95,7 @@ public function trackProductView(ProductInterface $product) $this->trackCode($result); } - public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1) + public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void { $item = $this->trackingItemBuilder->buildProductActionItem($product, $quantity); @@ -117,7 +117,7 @@ public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $this->trackCode($result); } - public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1) + public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void { $item = $this->trackingItemBuilder->buildProductActionItem($product, $quantity); @@ -139,7 +139,7 @@ public function trackCartProductActionRemove(CartInterface $cart, ProductInterfa $this->trackCode($result); } - public function trackCheckout(CartInterface $cart) + public function trackCheckout(CartInterface $cart): void { $items = $this->trackingItemBuilder->buildCheckoutItemsByCart($cart); @@ -162,7 +162,7 @@ public function trackCheckout(CartInterface $cart) $this->trackCode($result); } - public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null) + public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null): void { $items = $this->trackingItemBuilder->buildCheckoutItemsByCart($cart); @@ -186,7 +186,7 @@ public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, Ca $this->trackCode($result); } - public function trackCheckoutComplete(AbstractOrder $order) + public function trackCheckoutComplete(AbstractOrder $order): void { $transaction = $this->trackingItemBuilder->buildCheckoutTransaction($order); $items = $this->trackingItemBuilder->buildCheckoutItems($order); @@ -299,17 +299,17 @@ private function renderCall(?array $call): string ]); } - protected function addDeferredItem(string $dimension, array $item) + protected function addDeferredItem(string $dimension, array $item): void { $this->deferred[$dimension][] = $item; } - protected function getDeferredItems(string $dimension) + protected function getDeferredItems(string $dimension): ?array { return $this->deferred[$dimension] ?? null; } - protected function consolidateDeferredDimensions() + protected function consolidateDeferredDimensions(): void { foreach (self::DEFERRED_DIMENSIONS as $dimension) { if ($items = $this->getDeferredItems($dimension)) { diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingItemBuilder.php b/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingItemBuilder.php index 03a8e54c94f..c7e6e62f1dd 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingItemBuilder.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingItemBuilder.php @@ -79,7 +79,7 @@ public function buildProductViewItem(ProductInterface $product): ProductAction * @param AbstractProductData $item the tracking item that is going to be serialized later on. * @param ProductInterface $product */ - protected function initProductAttributes(AbstractProductData $item, ProductInterface $product) + protected function initProductAttributes(AbstractProductData $item, ProductInterface $product): void { $item ->setId($product->getOSProductNumber()) diff --git a/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingManager.php b/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingManager.php index 64fa7dac2cd..adf7136715e 100644 --- a/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingManager.php +++ b/bundles/EcommerceFrameworkBundle/src/Tracking/TrackingManager.php @@ -60,7 +60,7 @@ public function __construct(RequestStack $requestStack, EnvironmentInterface $en * * @param TrackerInterface $tracker */ - public function registerTracker(TrackerInterface $tracker) + public function registerTracker(TrackerInterface $tracker): void { $this->trackers[] = $tracker; } @@ -114,7 +114,7 @@ public function getActiveTrackers(): array * @param array|string $category One or more categories matching the page * @param mixed $page Any kind of page information you can use to track your page */ - public function trackCategoryPageView(array|string $category, mixed $page = null) + public function trackCategoryPageView(array|string $category, mixed $page = null): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof CategoryPageViewInterface) { @@ -129,7 +129,7 @@ public function trackCategoryPageView(array|string $category, mixed $page = null * @param ProductInterface $product * @param string $list */ - public function trackProductImpression(ProductInterface $product, string $list = 'default') + public function trackProductImpression(ProductInterface $product, string $list = 'default'): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof ProductImpressionInterface) { @@ -143,7 +143,7 @@ public function trackProductImpression(ProductInterface $product, string $list = * * @param ProductInterface $product */ - public function trackProductView(ProductInterface $product) + public function trackProductView(ProductInterface $product): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof ProductViewInterface) { @@ -157,7 +157,7 @@ public function trackProductView(ProductInterface $product) * * @param CartInterface $cart */ - public function trackCartUpdate(CartInterface $cart) + public function trackCartUpdate(CartInterface $cart): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof CartUpdateInterface) { @@ -173,7 +173,7 @@ public function trackCartUpdate(CartInterface $cart) * @param ProductInterface $product * @param float|int $quantity */ - public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1) + public function trackCartProductActionAdd(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof CartProductActionAddInterface) { @@ -189,7 +189,7 @@ public function trackCartProductActionAdd(CartInterface $cart, ProductInterface * @param ProductInterface $product * @param float|int $quantity */ - public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1) + public function trackCartProductActionRemove(CartInterface $cart, ProductInterface $product, float|int $quantity = 1): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof CartProductActionRemoveInterface) { @@ -203,7 +203,7 @@ public function trackCartProductActionRemove(CartInterface $cart, ProductInterfa * * @param CartInterface $cart */ - public function trackCheckout(CartInterface $cart) + public function trackCheckout(CartInterface $cart): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof CheckoutInterface) { @@ -217,7 +217,7 @@ public function trackCheckout(CartInterface $cart) * * @param AbstractOrder $order */ - public function trackCheckoutComplete(AbstractOrder $order) + public function trackCheckoutComplete(AbstractOrder $order): void { if ($order->getProperty('os_tracked')) { return; @@ -242,7 +242,7 @@ public function trackCheckoutComplete(AbstractOrder $order) * @param string|null $stepNumber * @param string|null $checkoutOption */ - public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null) + public function trackCheckoutStep(CheckoutManagerCheckoutStepInterface $step, CartInterface $cart, string $stepNumber = null, string $checkoutOption = null): void { foreach ($this->getActiveTrackers() as $tracker) { if ($tracker instanceof CheckoutStepInterface) { @@ -290,7 +290,7 @@ public function trackEvent( string $eventAction, string $eventLabel = null, int $eventValue = null - ) { + ): void { foreach ($this->getTrackers() as $tracker) { if ($tracker instanceof TrackEventInterface) { $tracker->trackEvent($eventCategory, $eventAction, $eventLabel, $eventValue); diff --git a/bundles/EcommerceFrameworkBundle/src/Type/Decimal.php b/bundles/EcommerceFrameworkBundle/src/Type/Decimal.php index 75623e6f9a7..fadc5790753 100644 --- a/bundles/EcommerceFrameworkBundle/src/Type/Decimal.php +++ b/bundles/EcommerceFrameworkBundle/src/Type/Decimal.php @@ -138,13 +138,8 @@ public static function create(float|int|string|Decimal $amount, int $scale = nul /** * Creates a value from an raw integer input. No value conversions will be done. - * - * @param int $amount - * @param int|null $scale - * - * @return self */ - public static function fromRawValue(int $amount, int $scale = null): self + public static function fromRawValue(int $amount, int $scale = null): static { $scale = $scale ?? static::$defaultScale; self::validateScale($scale); @@ -155,14 +150,8 @@ public static function fromRawValue(int $amount, int $scale = null): self /** * Creates a value from a string input. If possible, the integer will be created with * string operations (e.g. adding zeroes), otherwise it will fall back to fromNumeric(). - * - * @param string $amount - * @param int|null $scale - * @param int|null $roundingMode - * - * @return Decimal */ - public static function fromString(string $amount, int $scale = null, int $roundingMode = null): self + public static function fromString(string $amount, int $scale = null, int $roundingMode = null): static { $scale = $scale ?? static::$defaultScale; self::validateScale($scale); @@ -212,14 +201,8 @@ public static function fromString(string $amount, int $scale = null, int $roundi * Creates a value from a numeric input. The given amount will be converted to int * with the given scale. Please note that this implicitely rounds the amount to the * next integer, so precision depends on the given scale. - * - * @param float|int|string $amount - * @param int|null $scale - * @param int|null $roundingMode - * - * @return Decimal */ - public static function fromNumeric(float|int|string $amount, int $scale = null, int $roundingMode = null): self + public static function fromNumeric(float|int|string $amount, int $scale = null, int $roundingMode = null): static { if (!is_numeric($amount)) { throw new \InvalidArgumentException('Value is not numeric'); @@ -378,13 +361,8 @@ public function __toString(): string /** * Builds a value with the given scale - * - * @param int $scale - * @param int|null $roundingMode - * - * @return Decimal */ - public function withScale(int $scale, int $roundingMode = null): self + public function withScale(int $scale, int $roundingMode = null): static { self::validateScale($scale); @@ -527,10 +505,8 @@ public function isNegative(): bool /** * Returns the absolute amount - * - * @return Decimal */ - public function abs(): self + public function abs(): static { if ($this->amount < 0) { return new static((int)abs($this->amount), $this->scale); @@ -541,12 +517,8 @@ public function abs(): self /** * Adds another price amount - * - * @param float|int|string|Decimal $other - * - * @return Decimal */ - public function add(float|int|string|Decimal $other): self + public function add(float|int|string|Decimal $other): static { if (!$other instanceof Decimal) { $other = static::fromNumeric($other, $this->scale); @@ -562,12 +534,8 @@ public function add(float|int|string|Decimal $other): self /** * Subtracts another price amount - * - * @param float|int|string|Decimal $other - * - * @return Decimal */ - public function sub(float|int|string|Decimal $other): self + public function sub(float|int|string|Decimal $other): static { if (!$other instanceof Decimal) { $other = static::fromNumeric($other, $this->scale); @@ -585,13 +553,8 @@ public function sub(float|int|string|Decimal $other): self * Multiplies by the given factor. This does NOT have to be a price amount, but can be * a simple scalar factor (e.g. 2) as multiplying prices is rarely needed. However, if * a Decimal is passed, its float representation will be used for calculations. - * - * @param float|int|Decimal $other - * @param int|null $roundingMode - * - * @return Decimal */ - public function mul(float|int|Decimal $other, int $roundingMode = null): self + public function mul(float|int|string|Decimal $other, int $roundingMode = null): static { $operand = $this->getScalarOperand($other); @@ -608,14 +571,9 @@ public function mul(float|int|Decimal $other, int $roundingMode = null): self * a simple scalar factor (e.g. 2) as dividing prices is rarely needed. However, if * a Decimal is passed, its float representation will be used for calculations. * - * @param float|int|Decimal $other - * @param int|null $roundingMode - * - * @return Decimal - * * @throws \DivisionByZeroError */ - public function div(float|int|Decimal $other, int $roundingMode = null): self + public function div(float|int|string|Decimal $other, int $roundingMode = null): static { $operand = $this->getScalarOperand($other); $epsilon = pow(10, -1 * $this->scale); @@ -666,14 +624,9 @@ public function toPercentage(mixed $percentage, int $roundingMode = null): self /** * Calculate a discounted amount * - * @param float|int|Decimal $discount - * @param int|null $roundingMode - * - * @return Decimal - * * @example Decimal::create(100)->discount(15) = 85 */ - public function discount(float|int|Decimal $discount, int $roundingMode = null): self + public function discount(float|int|string|Decimal $discount, int $roundingMode = null): static { $discount = $this->getScalarOperand($discount); diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/DefaultService.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/DefaultService.php index 5d7c268a20f..5db41dac6c9 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/DefaultService.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/DefaultService.php @@ -46,13 +46,13 @@ public function __construct(LocaleServiceInterface $localeService, array $option $this->currentLocale = $localeService->getLocale(); } - protected function processOptions(array $options) + protected function processOptions(array $options): void { $this->reservationMinutesThreshold = $options['reservation_minutes_threshold']; $this->statisticsDaysThreshold = $options['statistics_days_threshold']; } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired([ 'reservation_minutes_threshold', @@ -253,12 +253,7 @@ public function getPricingManagerTokenInformationDetails(CartInterface $cart, st return $tokenInformationList; } - /** - * @param int $seriesId - * - * @return bool - */ - public function cleanUpReservations(string $seriesId = null): bool + public function cleanUpReservations(int $seriesId = null): bool { if (isset($seriesId)) { return Reservation::cleanUpReservations($this->reservationMinutesThreshold, $seriesId); @@ -269,15 +264,10 @@ public function cleanUpReservations(string $seriesId = null): bool public function cleanUpVoucherSeries(\Pimcore\Model\DataObject\OnlineShopVoucherSeries $series): bool { - return Token\Listing::cleanUpAllTokens((string)$series->getId()); + return Token\Listing::cleanUpAllTokens($series->getId()); } - /** - * @param string|null $seriesId - * - * @return bool - */ - public function cleanUpStatistics(string $seriesId = null): bool + public function cleanUpStatistics(int $seriesId = null): bool { if (isset($seriesId)) { return Statistic::cleanUpStatistics($this->statisticsDaysThreshold, $seriesId); diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation.php index ff3e620fa20..304a5d3b742 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation.php @@ -136,11 +136,8 @@ public function remove(): bool /** * @param int $duration in Minutes - * @param int $seriesId - * - * @return bool */ - public static function cleanUpReservations(int $duration, string $seriesId = null): bool + public static function cleanUpReservations(int $duration, int $seriesId = null): bool { $query = 'DELETE FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Reservation\Dao::TABLE_NAME . ' WHERE TIMESTAMPDIFF(MINUTE, timestamp , NOW()) >= ?'; $params[] = $duration; @@ -202,7 +199,7 @@ public function getCartId(): ?string return $this->cart_id; } - public function setCartId(?string $cart_id) + public function setCartId(?string $cart_id): void { $this->cart_id = $cart_id; } @@ -212,7 +209,7 @@ public function getId(): ?int return $this->id; } - public function setId(?int $id) + public function setId(?int $id): void { $this->id = $id; } diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation/Dao.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation/Dao.php index a0084ed724f..fe5fd13266d 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/Reservation/Dao.php @@ -41,7 +41,7 @@ public function __construct() * * @throws NotFoundException */ - public function get(string $code, CartInterface $cart = null) + public function get(string $code, CartInterface $cart = null): void { $query = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE token = ?'; $params[] = $code; @@ -59,7 +59,7 @@ public function get(string $code, CartInterface $cart = null) $this->model->setCartId($result['cart_id']); } - public function create(string $code, CartInterface $cart) + public function create(string $code, CartInterface $cart): void { if (!Reservation::reservationExists($code, $cart)) { // Single Type Token --> only one token per Cart! --> Update on duplicate key! diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/Statistic.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/Statistic.php index 5b19ef21cda..6f11560132d 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/Statistic.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/Statistic.php @@ -90,11 +90,8 @@ public static function increaseUsageStatistic(int $seriesId): bool /** * @param int $duration days - * @param int $seriesId - * - * @return bool */ - public static function cleanUpStatistics(int $duration, string $seriesId = null): bool + public static function cleanUpStatistics(int $duration, int $seriesId = null): bool { $query = 'DELETE FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Statistic\Dao::TABLE_NAME . ' WHERE DAY(DATEDIFF(date, NOW())) >= ?'; $params[] = $duration; @@ -120,7 +117,7 @@ public function getId(): int return $this->id; } - public function setId(int $id) + public function setId(int $id): void { $this->id = $id; } @@ -130,7 +127,7 @@ public function getTokenSeriesId(): string return $this->tokenSeriesId; } - public function setTokenSeriesId(string $tokenSeriesId) + public function setTokenSeriesId(string $tokenSeriesId): void { $this->tokenSeriesId = $tokenSeriesId; } @@ -140,7 +137,7 @@ public function getDate(): int return $this->date; } - public function setDate(int $date) + public function setDate(int $date): void { $this->date = $date; } diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/Token.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/Token.php index fa3d6a3ff90..d7e3a2a3bff 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/Token.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/Token.php @@ -16,6 +16,7 @@ namespace Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService; +use Pimcore\Bundle\EcommerceFrameworkBundle\CartManager\CartInterface; use Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Token\Dao; use Pimcore\Db; use Pimcore\Model\AbstractModel; @@ -62,7 +63,7 @@ public function isUsed(int $maxUsages = 1): bool return false; } - public static function isUsedToken($code, $maxUsages = 1): bool + public static function isUsedToken(string $code, int $maxUsages = 1): bool { $db = Db::get(); $query = 'SELECT usages FROM ' . Dao::TABLE_NAME . ' WHERE token = ? '; @@ -110,7 +111,7 @@ public static function tokenExists(string $code): bool return true; } - public function release($cart): bool + public function release(?CartInterface $cart): bool { return Reservation::releaseToken($this->getToken(), $cart); } @@ -140,7 +141,7 @@ public function getTimestamp(): string return $this->timestamp; } - public function setTimestamp(string $timestamp) + public function setTimestamp(string $timestamp): void { $this->timestamp = $timestamp; } @@ -150,7 +151,7 @@ public function getVoucherSeriesId(): int return $this->voucherSeriesId; } - public function setVoucherSeriesId(int $voucherSeriesId) + public function setVoucherSeriesId(int $voucherSeriesId): void { $this->voucherSeriesId = $voucherSeriesId; } @@ -160,7 +161,7 @@ public function getToken(): string return $this->token; } - public function setToken(string $token) + public function setToken(string $token): void { $this->token = $token; } @@ -170,7 +171,7 @@ public function getLength(): int return $this->length; } - public function setLength(int $length) + public function setLength(int $length): void { $this->length = $length; } @@ -180,7 +181,7 @@ public function getType(): string return $this->type; } - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } @@ -190,7 +191,7 @@ public function getUsages(): int return $this->usages; } - public function setUsages(int $usages) + public function setUsages(int $usages): void { $this->usages = $usages; } @@ -200,7 +201,7 @@ public function getId(): int return $this->id; } - public function setId($id) + public function setId(int $id): void { $this->id = $id; } diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Dao.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Dao.php index 447d16abda4..5e3e3daf9bc 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Dao.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Dao.php @@ -41,7 +41,7 @@ public function __construct() * * @throws NotFoundException */ - public function getByCode(string $code) + public function getByCode(string $code): void { $result = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE token = ?', [$code]); if (empty($result)) { @@ -63,12 +63,12 @@ public function isReserved(CartInterface $cart = null): bool return $reservation !== null; } - public function getTokenUsages($code) + public function getTokenUsages(string $code): ?int { try { - return $this->db->fetchOne('SELECT usages FROM ' . self::TABLE_NAME . ' WHERE token = ?', $code); + return (int) $this->db->fetchOne('SELECT usages FROM ' . self::TABLE_NAME . ' WHERE token = ?', [$code]); } catch (\Exception $e) { - return false; + return null; } } @@ -94,7 +94,7 @@ public function unuse(): bool } } - public function check($cart) + public function check(CartInterface $cart): void { } } diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Listing.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Listing.php index ee86e898b32..41261e1cfd5 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Listing.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/Token/Listing.php @@ -42,7 +42,7 @@ public function isValidOrderKey(string $key): bool * * @throws \Exception */ - public function setFilterConditions(?int $seriesId, array $filter = []) + public function setFilterConditions(?int $seriesId, array $filter = []): void { if (isset($seriesId)) { $this->addConditionParam('voucherSeriesId = ?', $seriesId); @@ -85,7 +85,7 @@ public function setFilterConditions(?int $seriesId, array $filter = []) } } - public static function getBySeriesId($seriesId): bool|Listing + public static function getBySeriesId(int $seriesId): bool|Listing { try { $config = new self(); @@ -104,7 +104,7 @@ public function getTokenList(): array return $this->getData(); } - public static function getCodes($seriesId, $params): bool|array + public static function getCodes(int $seriesId, ?array $params): bool|array { $db = \Pimcore\Db::get(); $query = 'SELECT * FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Token\Dao::TABLE_NAME . ' WHERE voucherSeriesId = ?'; @@ -159,7 +159,7 @@ public static function getCodes($seriesId, $params): bool|array return $codes; } - public static function getCountByUsages($usages = 1, $seriesId = null) + public static function getCountByUsages(int $usages = 1, ?int $seriesId = null): int|false { $query = 'SELECT COUNT(*) as count FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Token\Dao::TABLE_NAME . ' WHERE usages >= ? '; $params[] = $usages; @@ -171,13 +171,13 @@ public static function getCountByUsages($usages = 1, $seriesId = null) $db = \Pimcore\Db::get(); try { - return $db->fetchOne($query, $params); + return (int) $db->fetchOne($query, $params); } catch (\Exception $e) { return false; } } - public static function getCountBySeriesId($seriesId) + public static function getCountBySeriesId(int $seriesId): ?int { $query = 'SELECT COUNT(*) as count FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Token\Dao::TABLE_NAME . ' WHERE voucherSeriesId = ?'; $params[] = $seriesId; @@ -185,13 +185,13 @@ public static function getCountBySeriesId($seriesId) $db = \Pimcore\Db::get(); try { - return $db->fetchOne($query, $params); + return (int) $db->fetchOne($query, $params); } catch (\Exception $e) { - return false; + return null; } } - public static function getCountByReservation($seriesId = null) + public static function getCountByReservation(?int $seriesId = null): ?int { $query = 'SELECT COUNT(t.id) FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Token\Dao::TABLE_NAME . ' as t INNER JOIN ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Reservation\Dao::TABLE_NAME . ' as r ON t.token = r.token'; @@ -205,19 +205,13 @@ public static function getCountByReservation($seriesId = null) $db = \Pimcore\Db::get(); try { - return $db->fetchOne($query, $params); + return (int) $db->fetchOne($query, $params); } catch (\Exception $e) { - return false; + return null; } } - /** - * @param int $length - * @param int $seriesId - * - * @return null|int - */ - public static function getCountByLength(int $length, int|string $seriesId = null): ?int + public static function getCountByLength(int $length, int $seriesId = null): ?int { $query = 'SELECT COUNT(*) as count FROM ' . \Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Token\Dao::TABLE_NAME . ' WHERE length = ?'; $params = [$length]; @@ -240,17 +234,13 @@ public static function getCountByLength(int $length, int|string $seriesId = null /** * Use with care, cleans all tokens of a series and the dependent * reservations. - * - * @param int $seriesId - * - * @return bool */ - public static function cleanUpAllTokens(string $seriesId): bool + public static function cleanUpAllTokens(int $seriesId): bool { return self::cleanUpTokens($seriesId); } - public static function cleanUpTokens(string $seriesId, array $filter = [], int $maxUsages = 1): bool + public static function cleanUpTokens(int $seriesId, array $filter = [], int $maxUsages = 1): bool { $db = \Pimcore\Db::get(); diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/AbstractTokenManager.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/AbstractTokenManager.php index 26ddbcab312..182f60c1b74 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/AbstractTokenManager.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/AbstractTokenManager.php @@ -29,7 +29,7 @@ abstract class AbstractTokenManager implements TokenManagerInterface, Exportable { public AbstractVoucherTokenType $configuration; - public string|int|null $seriesId; + public int|null $seriesId; public AbstractVoucherSeries $series; @@ -70,7 +70,7 @@ public function checkToken(string $code, CartInterface $cart): bool * * @throws VoucherServiceException When token for $code can't be found, series of token can't be found or if series isn't published. */ - protected function checkVoucherSeriesIsPublished(string $code) + protected function checkVoucherSeriesIsPublished(string $code): void { $token = Token::getByCode($code); if (!$token) { @@ -94,7 +94,7 @@ protected function checkVoucherSeriesIsPublished(string $code) * * @throws VoucherServiceException */ - protected function checkAllowOncePerCart(string $code, CartInterface $cart) + protected function checkAllowOncePerCart(string $code, CartInterface $cart): void { $cartCodes = $cart->getVoucherTokenCodes(); if (method_exists($this->configuration, 'getAllowOncePerCart') && $this->configuration->getAllowOncePerCart()) { @@ -117,7 +117,7 @@ protected function checkAllowOncePerCart(string $code, CartInterface $cart) * * @throws VoucherServiceException */ - protected function checkOnlyToken(CartInterface $cart) + protected function checkOnlyToken(CartInterface $cart): void { $cartCodes = $cart->getVoucherTokenCodes(); $cartVoucherCount = count($cartCodes); diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Pattern.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Pattern.php index 2ae78bdbbd4..a66b86943a9 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Pattern.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Pattern.php @@ -44,6 +44,9 @@ class Pattern extends AbstractTokenManager implements ExportableTokenManagerInte protected string $template; + /** + * @var array + */ protected array $characterPools = [ 'alphaNumeric' => '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', 'numeric' => '123456789', @@ -496,7 +499,7 @@ public function generateCodes(): bool|array * @param array $data * @param int $usagePeriod */ - protected function prepareUsageStatisticData(array &$data, int $usagePeriod) + protected function prepareUsageStatisticData(array &$data, int $usagePeriod): void { $now = new \DateTime(); $periodData = []; @@ -631,47 +634,51 @@ public function getConfiguration(): VoucherTokenTypePattern return $this->configuration; } - public function setConfiguration(VoucherTokenTypePattern $configuration) + public function setConfiguration(VoucherTokenTypePattern $configuration): void { $this->configuration = $configuration; } + /** + * @return array + */ public function getCharacterPools(): array { return $this->characterPools; } - public function getCharacterPool() + public function getCharacterPool(): string { return $this->characterPools[$this->configuration->getCharacterType()]; } - public function setCharacterPools(array $characterPools) + /** + * @param array $characterPools + */ + public function setCharacterPools(array $characterPools): void { $this->characterPools = $characterPools; } /** - * @param array $pool Associative Array - the key represents the name, the value the characters of the character-pool. i.e.:"['numeric'=>'12345']" + * @param array $pool Associative Array - the key represents the name, the value the characters of the character-pool. i.e.:"['numeric'=>'12345']" */ - public function addCharacterPool(array $pool) + public function addCharacterPool(array $pool): void { - if (is_array($pool)) { - $this->characterPools[] = $pool; - } + $this->characterPools = array_merge($this->characterPools, $pool); } - public function setTemplate(string $template) + public function setTemplate(string $template): void { $this->template = $template; } - public function setSeriesId(int|string|null $seriesId) + public function setSeriesId(int|null $seriesId): void { $this->seriesId = $seriesId; } - public function getSeriesId(): int|string|null + public function getSeriesId(): int|null { return $this->seriesId; } diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Single.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Single.php index 589d367b766..e771256ea0d 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Single.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/TokenManager/Single.php @@ -56,7 +56,7 @@ public function cleanUpCodes(?array $filter = []): bool return true; } - public function cleanupReservations(int $duration = 0, ?string $seriesId = null): bool + public function cleanupReservations(int $duration = 0, ?int $seriesId = null): bool { return Reservation::cleanUpReservations($duration, $seriesId); } @@ -156,7 +156,7 @@ public function getCodes(array $filter = null): bool|array return Token\Listing::getCodes($this->seriesId, $filter); } - protected function prepareUsageStatisticData(&$data, $usagePeriod) + protected function prepareUsageStatisticData(array &$data, ?int $usagePeriod): void { $now = new \DateTime(); $periodData = []; @@ -263,22 +263,22 @@ public function getConfiguration(): VoucherTokenTypeSingle return $this->configuration; } - public function setConfiguration(VoucherTokenTypeSingle $configuration) + public function setConfiguration(VoucherTokenTypeSingle $configuration): void { $this->configuration = $configuration; } - public function getSeriesId(): int|string|null + public function getSeriesId(): int|null { return $this->seriesId; } - public function setSeriesId(int|string|null $seriesId) + public function setSeriesId(int|null $seriesId): void { $this->seriesId = $seriesId; } - public function setTemplate(string $template) + public function setTemplate(string $template): void { $this->template = $template; } diff --git a/bundles/EcommerceFrameworkBundle/src/VoucherService/VoucherServiceInterface.php b/bundles/EcommerceFrameworkBundle/src/VoucherService/VoucherServiceInterface.php index ac29f5fc12b..4c688287556 100644 --- a/bundles/EcommerceFrameworkBundle/src/VoucherService/VoucherServiceInterface.php +++ b/bundles/EcommerceFrameworkBundle/src/VoucherService/VoucherServiceInterface.php @@ -91,12 +91,8 @@ public function getPricingManagerTokenInformationDetails(CartInterface $cart, st /** * Cleans the token reservations due to sysConfig duration settings, if no series Id is * set all reservations older than the set duration get removed. - * - * @param string|null $seriesId - * - * @return bool */ - public function cleanUpReservations(string $seriesId = null): bool; + public function cleanUpReservations(int $seriesId = null): bool; /** * Removes all tokens from a voucher series and its reservations, @@ -110,10 +106,6 @@ public function cleanUpVoucherSeries(\Pimcore\Model\DataObject\OnlineShopVoucher /** * Removes all statistics, optionally a seriesId can be passed, to only remove from one series. - * - * @param string|null $seriesId - * - * @return bool */ - public function cleanUpStatistics(string $seriesId = null): bool; + public function cleanUpStatistics(int $seriesId = null): bool; } diff --git a/bundles/GlossaryBundle/src/DependencyInjection/PimcoreGlossaryExtension.php b/bundles/GlossaryBundle/src/DependencyInjection/PimcoreGlossaryExtension.php index bd116c9f832..c8b51719788 100644 --- a/bundles/GlossaryBundle/src/DependencyInjection/PimcoreGlossaryExtension.php +++ b/bundles/GlossaryBundle/src/DependencyInjection/PimcoreGlossaryExtension.php @@ -23,7 +23,7 @@ final class PimcoreGlossaryExtension extends ConfigurableExtension { - public function loadInternal(array $config, ContainerBuilder $container) + public function loadInternal(array $config, ContainerBuilder $container): void { // on container build the shutdown handler shouldn't be called // for details please see https://github.com/pimcore/pimcore/issues/4709 diff --git a/bundles/GlossaryBundle/src/Model/Glossary/Dao.php b/bundles/GlossaryBundle/src/Model/Glossary/Dao.php index 2dc0962d31b..7bfa60fc1df 100644 --- a/bundles/GlossaryBundle/src/Model/Glossary/Dao.php +++ b/bundles/GlossaryBundle/src/Model/Glossary/Dao.php @@ -33,7 +33,7 @@ class Dao extends AbstractDao * * @throws NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -51,7 +51,7 @@ public function getById(int $id = null) /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -63,7 +63,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('glossary', ['id' => $this->model->getId()]); } @@ -71,7 +71,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $ts = time(); $this->model->setModificationDate($ts); @@ -94,7 +94,7 @@ public function update() /** * Create a new record for the object in database */ - public function create() + public function create(): void { $ts = time(); $this->model->setModificationDate($ts); diff --git a/bundles/InstallBundle/src/Command/InstallCommand.php b/bundles/InstallBundle/src/Command/InstallCommand.php index 01ff1af0d8d..52cfc7c5031 100644 --- a/bundles/InstallBundle/src/Command/InstallCommand.php +++ b/bundles/InstallBundle/src/Command/InstallCommand.php @@ -125,7 +125,7 @@ private function getOptions(): array /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $options = $this->getOptions(); @@ -184,7 +184,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { // no installer if Pimcore is already installed $configFile = Config::locateConfigFile('system.yaml'); @@ -247,7 +247,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) * * {@inheritdoc} */ - protected function interact(InputInterface $input, OutputInterface $output) + protected function interact(InputInterface $input, OutputInterface $output): void { foreach ($this->getOptions() as $name => $config) { if (!$this->installerNeedsOption($config)) { diff --git a/bundles/InstallBundle/src/DependencyInjection/PimcoreInstallExtension.php b/bundles/InstallBundle/src/DependencyInjection/PimcoreInstallExtension.php index 5d7d4ab0a5a..d2d84dce279 100644 --- a/bundles/InstallBundle/src/DependencyInjection/PimcoreInstallExtension.php +++ b/bundles/InstallBundle/src/DependencyInjection/PimcoreInstallExtension.php @@ -28,7 +28,7 @@ */ final class PimcoreInstallExtension extends ConfigurableExtension { - protected function loadInternal(array $config, ContainerBuilder $container) + protected function loadInternal(array $config, ContainerBuilder $container): void { $loader = new YamlFileLoader( $container, diff --git a/bundles/InstallBundle/src/Installer.php b/bundles/InstallBundle/src/Installer.php index 1c021fa7312..01982c5234e 100644 --- a/bundles/InstallBundle/src/Installer.php +++ b/bundles/InstallBundle/src/Installer.php @@ -610,7 +610,7 @@ protected function getDataFiles(): array return $files; } - protected function createOrUpdateUser($config = []): void + protected function createOrUpdateUser(array $config = []): void { $defaultConfig = [ 'username' => 'admin', diff --git a/bundles/SeoBundle/src/DependencyInjection/PimcoreSeoExtension.php b/bundles/SeoBundle/src/DependencyInjection/PimcoreSeoExtension.php index 4e02c052fa5..6d1108a78eb 100644 --- a/bundles/SeoBundle/src/DependencyInjection/PimcoreSeoExtension.php +++ b/bundles/SeoBundle/src/DependencyInjection/PimcoreSeoExtension.php @@ -22,7 +22,7 @@ class PimcoreSeoExtension extends Extension { - public function load(array $configs, \Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function load(array $configs, \Symfony\Component\DependencyInjection\ContainerBuilder $container): void { $loader = new YamlFileLoader( $container, diff --git a/bundles/SeoBundle/src/EventListener/ResponseExceptionListener.php b/bundles/SeoBundle/src/EventListener/ResponseExceptionListener.php index 7a8fc0e3d43..70347aefc48 100644 --- a/bundles/SeoBundle/src/EventListener/ResponseExceptionListener.php +++ b/bundles/SeoBundle/src/EventListener/ResponseExceptionListener.php @@ -49,7 +49,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelException(ExceptionEvent $event) + public function onKernelException(ExceptionEvent $event): void { $exception = $event->getThrowable(); @@ -77,7 +77,7 @@ public function onKernelException(ExceptionEvent $event) } } - protected function logToHttpErrorLog(Request $request, $statusCode) + protected function logToHttpErrorLog(Request $request, int $statusCode): void { $uri = $request->getUri(); $exists = $this->db->fetchOne('SELECT date FROM http_error_log WHERE uri = ?', [$uri]); @@ -86,7 +86,7 @@ protected function logToHttpErrorLog(Request $request, $statusCode) } else { $this->db->insert('http_error_log', [ 'uri' => $uri, - 'code' => (int) $statusCode, + 'code' => $statusCode, 'parametersGet' => serialize($_GET), 'parametersPost' => serialize($_POST), 'cookies' => serialize($_COOKIE), diff --git a/composer.json b/composer.json index 880a979d17c..950483b0278 100644 --- a/composer.json +++ b/composer.json @@ -127,7 +127,7 @@ "symfony/yaml": "^6.1", "tijsverkoyen/css-to-inline-styles": "^2.2.3", "twig/extra-bundle": "^3.4.0", - "twig/twig": "^3.0.4", + "twig/twig": "^3.3.9", "twig/string-extra": "^3.0.4", "rybakit/twig-deferred-extension": "^3.0", "umpirsky/country-list": "^2.0.6", @@ -161,7 +161,7 @@ "elasticsearch/elasticsearch": "^8.0", "composer/composer": "*", "chrome-php/chrome": "^1.4.0", - "webmozarts/console-parallelization": "^2.0.0-beta.2" + "webmozarts/console-parallelization": "^2.1" }, "suggest": { "ext-sockets": "*", diff --git a/doc/Development_Documentation/18_Tools_and_Features/37_Targeting_and_Personalization/03_Conditions.md b/doc/Development_Documentation/18_Tools_and_Features/37_Targeting_and_Personalization/03_Conditions.md index d4a38e524a7..3b53901f7bd 100644 --- a/doc/Development_Documentation/18_Tools_and_Features/37_Targeting_and_Personalization/03_Conditions.md +++ b/doc/Development_Documentation/18_Tools_and_Features/37_Targeting_and_Personalization/03_Conditions.md @@ -47,7 +47,7 @@ class TimeOfTheDay implements ConditionInterface $this->hour = $hour; } - public static function fromConfig(array $config) + public static function fromConfig(array $config): self { $hour = $config['hour'] ?? null; if (!empty($hour)) { diff --git a/doc/Development_Documentation/20_Extending_Pimcore/13_Bundle_Developers_Guide/04_Bundle_Collection.md b/doc/Development_Documentation/20_Extending_Pimcore/13_Bundle_Developers_Guide/04_Bundle_Collection.md index a3d506dc246..915b414f6fe 100644 --- a/doc/Development_Documentation/20_Extending_Pimcore/13_Bundle_Developers_Guide/04_Bundle_Collection.md +++ b/doc/Development_Documentation/20_Extending_Pimcore/13_Bundle_Developers_Guide/04_Bundle_Collection.md @@ -71,7 +71,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; class CustomBundle extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { // register any bundles your bundle depends on here $collection->addBundle(new FooBundle); @@ -96,7 +96,7 @@ use Pimcore\HttpKernel\BundleCollection\LazyLoadedItem; class CustomBundle extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { // call addBundle with a class name as string and restrict it to the dev environment $collection->addBundle(FooBundle::class, 0, ['dev']); @@ -121,7 +121,7 @@ with a priority of 10, but we need to set the priority to 25: class CustomBundle extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->addBundle(FooBundle::class, 10); } diff --git a/doc/User_Documentation/05_DataObjects/01_Grid_Configuration_Operators/Others/PHPCode.md b/doc/User_Documentation/05_DataObjects/01_Grid_Configuration_Operators/Others/PHPCode.md index 03a48faf046..357ceab140e 100644 --- a/doc/User_Documentation/05_DataObjects/01_Grid_Configuration_Operators/Others/PHPCode.md +++ b/doc/User_Documentation/05_DataObjects/01_Grid_Configuration_Operators/Others/PHPCode.md @@ -20,7 +20,7 @@ class OperatorSample extends AbstractOperator { private $additionalData; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/Analytics/AbstractTracker.php b/lib/Analytics/AbstractTracker.php index 97a19893199..087b3799f8a 100644 --- a/lib/Analytics/AbstractTracker.php +++ b/lib/Analytics/AbstractTracker.php @@ -56,7 +56,7 @@ abstract protected function buildCode(SiteId $siteId): ?string; /** * {@inheritdoc} */ - public function addCodePart(string $code, string $block = null, bool $prepend = false, SiteId $siteId = null) + public function addCodePart(string $code, string $block = null, bool $prepend = false, SiteId $siteId = null): void { $action = $prepend ? CodeCollector::ACTION_PREPEND : CodeCollector::ACTION_APPEND; diff --git a/lib/Analytics/Google/Event/TrackingDataEvent.php b/lib/Analytics/Google/Event/TrackingDataEvent.php index cf5856790b6..c657525a229 100644 --- a/lib/Analytics/Google/Event/TrackingDataEvent.php +++ b/lib/Analytics/Google/Event/TrackingDataEvent.php @@ -66,7 +66,7 @@ public function getData(): array return $this->data; } - public function setData(array $data) + public function setData(array $data): void { $this->data = $data; } @@ -93,7 +93,7 @@ public function getTemplate(): string return $this->template; } - public function setTemplate(string $template) + public function setTemplate(string $template): void { $this->template = $template; } diff --git a/lib/Analytics/Google/Tracker.php b/lib/Analytics/Google/Tracker.php index 2627a4606e2..69968afaa81 100644 --- a/lib/Analytics/Google/Tracker.php +++ b/lib/Analytics/Google/Tracker.php @@ -87,7 +87,7 @@ public function getDefaultPath(): ?string return $this->defaultPath; } - public function setDefaultPath(string $defaultPath = null) + public function setDefaultPath(string $defaultPath = null): void { $this->defaultPath = $defaultPath; } @@ -163,7 +163,7 @@ private function doBuildCode(SiteId $siteId, Config $config, array $siteConfig): return $this->renderTemplate($event); } - private function getTrackerConfigurationFromJson($configValue = null, array $defaultConfig = []): array + private function getTrackerConfigurationFromJson(string $configValue = null, array $defaultConfig = []): array { $config = []; if (!empty($configValue)) { diff --git a/lib/Analytics/GoogleTagManager/EventSubscriber/TrackingCodeSubscriber.php b/lib/Analytics/GoogleTagManager/EventSubscriber/TrackingCodeSubscriber.php index f731b376357..21c8910e9a0 100644 --- a/lib/Analytics/GoogleTagManager/EventSubscriber/TrackingCodeSubscriber.php +++ b/lib/Analytics/GoogleTagManager/EventSubscriber/TrackingCodeSubscriber.php @@ -59,7 +59,7 @@ public static function getSubscribedEvents(): array ]; } - public function onCodeHead(CodeEvent $event) + public function onCodeHead(CodeEvent $event): void { if (! $this->isEnabled()) { return; diff --git a/lib/Analytics/SiteId/SiteId.php b/lib/Analytics/SiteId/SiteId.php index 59f51172717..c608b4c3e63 100644 --- a/lib/Analytics/SiteId/SiteId.php +++ b/lib/Analytics/SiteId/SiteId.php @@ -38,12 +38,12 @@ private function __construct(string $configKey, Site $site = null) $this->site = $site; } - public static function forMainDomain(): SiteId + public static function forMainDomain(): self { return new self(self::CONFIG_KEY_MAIN_DOMAIN); } - public static function forSite(Site $site): SiteId + public static function forSite(Site $site): self { $configKey = sprintf('site_%s', $site->getId()); diff --git a/lib/Analytics/TrackerInterface.php b/lib/Analytics/TrackerInterface.php index 13e119bea89..53250403a53 100644 --- a/lib/Analytics/TrackerInterface.php +++ b/lib/Analytics/TrackerInterface.php @@ -40,5 +40,5 @@ public function generateCode(SiteId $siteId = null): ?string; * @param bool $prepend Whether to prepend the code to the code block * @param SiteId|null $siteId Restrict code to a specific site */ - public function addCodePart(string $code, string $block = null, bool $prepend = false, SiteId $siteId = null); + public function addCodePart(string $code, string $block = null, bool $prepend = false, SiteId $siteId = null): void; } diff --git a/lib/Cache/Core/CoreCacheHandler.php b/lib/Cache/Core/CoreCacheHandler.php index e7308167a09..ed34fde0ab1 100644 --- a/lib/Cache/Core/CoreCacheHandler.php +++ b/lib/Cache/Core/CoreCacheHandler.php @@ -186,7 +186,7 @@ public function isEnabled(): bool return $this->enabled; } - protected function dispatchStatusEvent() + protected function dispatchStatusEvent(): void { $this->dispatcher->dispatch(new Event(), $this->isEnabled() diff --git a/lib/Cache/Core/WriteLock.php b/lib/Cache/Core/WriteLock.php index 6a87fcbd2f9..9ad326539df 100644 --- a/lib/Cache/Core/WriteLock.php +++ b/lib/Cache/Core/WriteLock.php @@ -52,12 +52,12 @@ public function __construct(TagAwareAdapterInterface $itemPool) $this->itemPool = $itemPool; } - public function enable() + public function enable(): void { $this->enabled = true; } - public function disable() + public function disable(): void { $this->enabled = false; } @@ -70,7 +70,7 @@ public function isEnabled(): bool /** * Initialize lock value once from storage */ - protected function initializeLock() + protected function initializeLock(): void { if ($this->lockInitialized) { return; diff --git a/lib/Cache/RuntimeCache.php b/lib/Cache/RuntimeCache.php index b8b614ef20a..f93536b703a 100644 --- a/lib/Cache/RuntimeCache.php +++ b/lib/Cache/RuntimeCache.php @@ -155,7 +155,7 @@ public function offsetSet($index, $value): void * @param mixed $data * @param string $id */ - public static function save(mixed $data, string $id) + public static function save(mixed $data, string $id): void { self::set($id, $data); } @@ -172,7 +172,7 @@ public static function load(string $id): mixed return self::get($id); } - public static function clear(array $keepItems = []) + public static function clear(array $keepItems = []): void { self::$instance = null; $newInstance = new self(); diff --git a/lib/Composer.php b/lib/Composer.php index 69b0fd462f0..9899718a1ed 100644 --- a/lib/Composer.php +++ b/lib/Composer.php @@ -110,7 +110,7 @@ public static function prePackageUpdate(PackageEvent $event): void * * @internal */ - protected static function executeCommand(Event $event, $consoleDir, array $cmd, $timeout = 900, $writeBuffer = true): Process + protected static function executeCommand(Event $event, string $consoleDir, array $cmd, int $timeout = 900, bool $writeBuffer = true): Process { $command = [static::getPhp(false)]; $command = array_merge($command, static::getPhpArguments()); @@ -140,7 +140,7 @@ protected static function executeCommand(Event $event, $consoleDir, array $cmd, /** * @internal */ - protected static function getPhp($includeArgs = true): string + protected static function getPhp(bool $includeArgs = true): string { $phpFinder = new PhpExecutableFinder(); if (!$phpPath = $phpFinder->find($includeArgs)) { @@ -192,17 +192,17 @@ protected static function getOptions(Event $event): array return $options; } - protected static function getConsoleDir(Event $event, $actionName) + protected static function getConsoleDir(Event $event, string $actionName): ?string { $options = static::getOptions($event); if (!static::hasDirectory($event, 'bin-dir', $options['bin-dir'], $actionName)) { - return; + return null; } return $options['bin-dir']; } - protected static function hasDirectory(Event $event, $configName, $path, $actionName): bool + protected static function hasDirectory(Event $event, string $configName, string $path, string $actionName): bool { if (!is_dir($path)) { $event->getIO()->write(sprintf('The %s (%s) specified in composer.json was not found in %s, can not %s.', $configName, $path, getcwd(), $actionName)); diff --git a/lib/Config.php b/lib/Config.php index 7b37b22876d..b5d6c22bd28 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -127,7 +127,7 @@ public static function locateConfigFile(string $name): string * * @internal ONLY FOR TESTING PURPOSES IF NEEDED FOR SPECIFIC TEST CASES */ - public static function setSystemConfiguration(?array $configuration, string $offset = null) + public static function setSystemConfiguration(?array $configuration, string $offset = null): void { if (null !== $offset) { self::getSystemConfiguration(); @@ -295,7 +295,7 @@ public static function getWebsiteConfig(string $language = null): array * * @internal */ - public static function setWebsiteConfig(?array $config, string $language = null) + public static function setWebsiteConfig(?array $config, string $language = null): void { RuntimeCache::set(self::getWebsiteConfigRuntimeCacheKey($language), $config); } @@ -359,7 +359,7 @@ public static function getReportConfig(): array * * @internal */ - public static function setReportConfig(array $config) + public static function setReportConfig(array $config): void { RuntimeCache::set('pimcore_config_report', $config); } @@ -402,7 +402,7 @@ public static function getRobotsConfig(): array * * @internal */ - public static function setRobotsConfig(array $config) + public static function setRobotsConfig(array $config): void { RuntimeCache::set('pimcore_config_robots', $config); } @@ -433,7 +433,7 @@ public static function getWeb2PrintConfig(): array * * @internal */ - public static function setWeb2PrintConfig(array $config) + public static function setWeb2PrintConfig(array $config): void { RuntimeCache::set('pimcore_config_web2print', $config); } @@ -445,7 +445,7 @@ public static function setWeb2PrintConfig(array $config) * * @internal */ - public static function setModelClassMappingConfig(array $config) + public static function setModelClassMappingConfig(array $config): void { RuntimeCache::set('pimcore_config_model_classmapping', $config); } diff --git a/lib/Config/Config.php b/lib/Config/Config.php index 67121d8b36c..070f77b2bf6 100644 --- a/lib/Config/Config.php +++ b/lib/Config/Config.php @@ -125,14 +125,9 @@ public function __get(string $name) * Only allow setting of a property if $allowModifications was set to true * on construction. Otherwise, throw an exception. * - * @param string|null $name - * @param mixed $value - * - * @return void - * * @throws Exception */ - public function __set(?string $name, mixed $value) + public function __set(?string $name, mixed $value): void { if ($this->allowModifications) { if (is_array($value)) { diff --git a/lib/Console/AbstractCommand.php b/lib/Console/AbstractCommand.php index 2b58a3cb13a..445e710d993 100644 --- a/lib/Console/AbstractCommand.php +++ b/lib/Console/AbstractCommand.php @@ -41,7 +41,7 @@ abstract class AbstractCommand extends Command private ?VarCloner $varCloner = null; - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { parent::initialize($input, $output); @@ -50,12 +50,12 @@ protected function initialize(InputInterface $input, OutputInterface $output) $this->output = $output; } - protected function dump(mixed $data) + protected function dump(mixed $data): void { $this->doDump($data); } - protected function dumpVerbose(mixed $data) + protected function dumpVerbose(mixed $data): void { if ($this->output->isVerbose()) { $this->doDump($data); @@ -78,22 +78,22 @@ private function doDump(mixed $data): void $this->cliDumper->dump($this->varCloner->cloneVar($data)); } - protected function writeError(string $message) + protected function writeError(string $message): void { $this->output->writeln(sprintf('ERROR: %s', $message)); } - protected function writeInfo(string $message) + protected function writeInfo(string $message): void { $this->output->writeln(sprintf('INFO: %s', $message)); } - protected function writeComment(string $message) + protected function writeComment(string $message): void { $this->output->writeln(sprintf('COMMENT: %s', $message)); } - protected function writeQuestion(string $message) + protected function writeQuestion(string $message): void { $this->output->writeln(sprintf('QUESTION: %s', $message)); } diff --git a/lib/Console/ConsoleOutputDecorator.php b/lib/Console/ConsoleOutputDecorator.php index 675d6eac4b5..768dc806064 100644 --- a/lib/Console/ConsoleOutputDecorator.php +++ b/lib/Console/ConsoleOutputDecorator.php @@ -40,17 +40,17 @@ public function __construct(OutputInterface $output, OutputInterface $errorOutpu $this->errorOutput = $errorOutput; } - public function write($messages, $newline = false, $options = 0) + public function write(string|iterable $messages, bool $newline = false, int $options = 0): void { $this->output->write($messages, $newline, $options); } - public function writeln($messages, $options = 0) + public function writeln(string|iterable $messages, int $options = 0): void { $this->output->writeln($messages, $options); } - public function setVerbosity($level) + public function setVerbosity(int $level): void { $this->output->setVerbosity($level); } @@ -80,7 +80,7 @@ public function isDebug(): bool return $this->output->isDebug(); } - public function setDecorated($decorated) + public function setDecorated(bool $decorated): void { $this->output->setDecorated($decorated); } @@ -90,7 +90,7 @@ public function isDecorated(): bool return $this->output->isDecorated(); } - public function setFormatter(OutputFormatterInterface $formatter) + public function setFormatter(OutputFormatterInterface $formatter): void { $this->output->setFormatter($formatter); } @@ -110,7 +110,7 @@ public function getErrorOutput(): OutputInterface return $this->errorOutput; } - public function setErrorOutput(OutputInterface $error) + public function setErrorOutput(OutputInterface $error): void { $this->errorOutput = $error; } diff --git a/lib/Console/Style/PimcoreStyle.php b/lib/Console/Style/PimcoreStyle.php index 5298ecacd00..b941696509e 100644 --- a/lib/Console/Style/PimcoreStyle.php +++ b/lib/Console/Style/PimcoreStyle.php @@ -56,7 +56,7 @@ public function getOutput(): OutputInterface * @param string $underlineChar * @param string|null $style */ - public function simpleSection(string $message, string $underlineChar = '-', string $style = null) + public function simpleSection(string $message, string $underlineChar = '-', string $style = null): void { $underline = str_repeat($underlineChar, Helper::width(Helper::removeDecoration($this->getFormatter(), $message))); diff --git a/lib/Controller/Configuration/ResponseHeader.php b/lib/Controller/Configuration/ResponseHeader.php index 97b96026039..48d461aa1ff 100644 --- a/lib/Controller/Configuration/ResponseHeader.php +++ b/lib/Controller/Configuration/ResponseHeader.php @@ -73,7 +73,7 @@ public function getKey(): string return $this->key; } - public function setKey(string $key) + public function setKey(string $key): void { $this->key = $key; } @@ -83,7 +83,7 @@ public function getValues(): array|string return $this->values; } - public function setValues(array|string $values) + public function setValues(array|string $values): void { $this->values = $values; } @@ -93,7 +93,7 @@ public function getReplace(): bool return $this->replace; } - public function setReplace(bool $replace) + public function setReplace(bool $replace): void { $this->replace = $replace; } diff --git a/lib/Controller/FrontendController.php b/lib/Controller/FrontendController.php index 93d408b369b..bb0cb0c7d64 100644 --- a/lib/Controller/FrontendController.php +++ b/lib/Controller/FrontendController.php @@ -65,7 +65,7 @@ public function __get(string $name) throw new \RuntimeException(sprintf('Trying to read undefined property "%s"', $name)); } - public function __set(string $name, mixed $value) + public function __set(string $name, mixed $value): void { $requestAttributes = ['document', 'editmode']; if (in_array($name, $requestAttributes)) { @@ -87,7 +87,7 @@ public function __set(string $name, mixed $value) * @param bool $replace * @param Request|null $request */ - protected function addResponseHeader(string $key, array|string $values, bool $replace = false, Request $request = null) + protected function addResponseHeader(string $key, array|string $values, bool $replace = false, Request $request = null): void { if (null === $request) { $request = $this->container->get('request_stack')->getCurrentRequest(); diff --git a/lib/Controller/KernelControllerEventInterface.php b/lib/Controller/KernelControllerEventInterface.php index 569fec629ed..bc6ef32e564 100644 --- a/lib/Controller/KernelControllerEventInterface.php +++ b/lib/Controller/KernelControllerEventInterface.php @@ -20,5 +20,5 @@ interface KernelControllerEventInterface { - public function onKernelControllerEvent(ControllerEvent $event); + public function onKernelControllerEvent(ControllerEvent $event): void; } diff --git a/lib/Controller/KernelResponseEventInterface.php b/lib/Controller/KernelResponseEventInterface.php index 2ff5529f61b..5fc60767f27 100644 --- a/lib/Controller/KernelResponseEventInterface.php +++ b/lib/Controller/KernelResponseEventInterface.php @@ -20,5 +20,5 @@ interface KernelResponseEventInterface { - public function onKernelResponseEvent(ResponseEvent $event); + public function onKernelResponseEvent(ResponseEvent $event): void; } diff --git a/lib/DataObject/GridColumnConfig/Operator/AbstractOperator.php b/lib/DataObject/GridColumnConfig/Operator/AbstractOperator.php index 88332bb4676..7e5ba5de9a1 100644 --- a/lib/DataObject/GridColumnConfig/Operator/AbstractOperator.php +++ b/lib/DataObject/GridColumnConfig/Operator/AbstractOperator.php @@ -55,7 +55,7 @@ public function getContext(): array return $this->context; } - public function setContext(array $context) + public function setContext(array $context): void { $this->context = $context; } @@ -65,7 +65,7 @@ public function getLabel(): string return $this->label; } - public function setLabel(string $label) + public function setLabel(string $label): void { $this->label = $label; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Anonymizer.php b/lib/DataObject/GridColumnConfig/Operator/Anonymizer.php index e76d764a5c0..192ce23d267 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Anonymizer.php +++ b/lib/DataObject/GridColumnConfig/Operator/Anonymizer.php @@ -25,7 +25,7 @@ final class Anonymizer extends AbstractOperator { private string $mode; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/AnyGetter.php b/lib/DataObject/GridColumnConfig/Operator/AnyGetter.php index 8c3cbad73d1..8f4483fe886 100644 --- a/lib/DataObject/GridColumnConfig/Operator/AnyGetter.php +++ b/lib/DataObject/GridColumnConfig/Operator/AnyGetter.php @@ -37,7 +37,7 @@ final class AnyGetter extends AbstractOperator private bool $returnLastResult; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { if (!Admin::getCurrentUser()->isAdmin()) { throw new \Exception('AnyGetter only allowed for admin users'); @@ -155,7 +155,7 @@ public function getAttribute(): string return $this->attribute; } - public function setAttribute(string $attribute) + public function setAttribute(string $attribute): void { $this->attribute = $attribute; } @@ -165,7 +165,7 @@ public function getParam1(): string return $this->param1; } - public function setParam1(string $param1) + public function setParam1(string $param1): void { $this->param1 = $param1; } @@ -175,7 +175,7 @@ public function getForwardAttribute(): string return $this->forwardAttribute; } - public function setForwardAttribute(string $forwardAttribute) + public function setForwardAttribute(string $forwardAttribute): void { $this->forwardAttribute = $forwardAttribute; } @@ -185,7 +185,7 @@ public function getForwardParam1(): string return $this->forwardParam1; } - public function setForwardParam1(string $forwardParam1) + public function setForwardParam1(string $forwardParam1): void { $this->forwardParam1 = $forwardParam1; } @@ -195,7 +195,7 @@ public function getIsArrayType(): bool return $this->isArrayType; } - public function setIsArrayType(bool $isArrayType) + public function setIsArrayType(bool $isArrayType): void { $this->isArrayType = $isArrayType; } @@ -205,7 +205,7 @@ public function getReturnLastResult(): bool return $this->returnLastResult; } - public function setReturnLastResult(bool $returnLastResult) + public function setReturnLastResult(bool $returnLastResult): void { $this->returnLastResult = $returnLastResult; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Arithmetic.php b/lib/DataObject/GridColumnConfig/Operator/Arithmetic.php index 29b9ce19ff3..33c2c28eb42 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Arithmetic.php +++ b/lib/DataObject/GridColumnConfig/Operator/Arithmetic.php @@ -27,7 +27,7 @@ final class Arithmetic extends AbstractOperator private string $operator; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -112,7 +112,7 @@ public function getSkipNull(): bool return $this->skipNull; } - public function setSkipNull(bool $skipNull) + public function setSkipNull(bool $skipNull): void { $this->skipNull = $skipNull; } @@ -122,7 +122,7 @@ public function getOperator(): string return $this->operator; } - public function setOperator(string $operator) + public function setOperator(string $operator): void { $this->operator = $operator; } diff --git a/lib/DataObject/GridColumnConfig/Operator/AssetMetadataGetter.php b/lib/DataObject/GridColumnConfig/Operator/AssetMetadataGetter.php index ed5bbeedd23..466fc0649d5 100644 --- a/lib/DataObject/GridColumnConfig/Operator/AssetMetadataGetter.php +++ b/lib/DataObject/GridColumnConfig/Operator/AssetMetadataGetter.php @@ -29,7 +29,7 @@ final class AssetMetadataGetter extends AbstractOperator private ?string $locale = null; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -109,12 +109,12 @@ public function getMetaField(): mixed return $this->metaField; } - public function setMetaField(mixed $metaField) + public function setMetaField(mixed $metaField): void { $this->metaField = $metaField; } - public function setLocale(mixed $locale) + public function setLocale(mixed $locale): void { $this->locale = $locale; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Base64.php b/lib/DataObject/GridColumnConfig/Operator/Base64.php index f27a18209b6..e01099c378d 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Base64.php +++ b/lib/DataObject/GridColumnConfig/Operator/Base64.php @@ -25,7 +25,7 @@ final class Base64 extends AbstractOperator { private string $mode; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/Boolean.php b/lib/DataObject/GridColumnConfig/Operator/Boolean.php index c975df445c0..b1ae76815b6 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Boolean.php +++ b/lib/DataObject/GridColumnConfig/Operator/Boolean.php @@ -27,7 +27,7 @@ final class Boolean extends AbstractOperator private string $operator; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -94,7 +94,7 @@ public function getSkipNull(): bool return $this->skipNull; } - public function setSkipNull(bool $skipNull) + public function setSkipNull(bool $skipNull): void { $this->skipNull = $skipNull; } @@ -104,7 +104,7 @@ public function getOperator(): string return $this->operator; } - public function setOperator(string $operator) + public function setOperator(string $operator): void { $this->operator = $operator; } diff --git a/lib/DataObject/GridColumnConfig/Operator/BooleanFormatter.php b/lib/DataObject/GridColumnConfig/Operator/BooleanFormatter.php index 2ba212ab830..217e346a67d 100644 --- a/lib/DataObject/GridColumnConfig/Operator/BooleanFormatter.php +++ b/lib/DataObject/GridColumnConfig/Operator/BooleanFormatter.php @@ -27,7 +27,7 @@ final class BooleanFormatter extends AbstractOperator private string $noValue; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -75,7 +75,7 @@ public function getYesValue(): mixed return $this->yesValue; } - public function setYesValue(mixed $yesValue) + public function setYesValue(mixed $yesValue): void { $this->yesValue = $yesValue; } @@ -85,7 +85,7 @@ public function getNoValue(): mixed return $this->noValue; } - public function setNoValue(mixed $noValue) + public function setNoValue(mixed $noValue): void { $this->noValue = $noValue; } diff --git a/lib/DataObject/GridColumnConfig/Operator/CaseConverter.php b/lib/DataObject/GridColumnConfig/Operator/CaseConverter.php index 18003c92d5d..d4e174e3e3e 100644 --- a/lib/DataObject/GridColumnConfig/Operator/CaseConverter.php +++ b/lib/DataObject/GridColumnConfig/Operator/CaseConverter.php @@ -25,7 +25,7 @@ final class CaseConverter extends AbstractOperator { private int $capitalization; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/Concatenator.php b/lib/DataObject/GridColumnConfig/Operator/Concatenator.php index 6bfbe086f8d..af52df4a2e4 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Concatenator.php +++ b/lib/DataObject/GridColumnConfig/Operator/Concatenator.php @@ -27,7 +27,7 @@ final class Concatenator extends AbstractOperator private bool $forceValue; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/DateFormatter.php b/lib/DataObject/GridColumnConfig/Operator/DateFormatter.php index 81d57a115ee..da4b794fd38 100644 --- a/lib/DataObject/GridColumnConfig/Operator/DateFormatter.php +++ b/lib/DataObject/GridColumnConfig/Operator/DateFormatter.php @@ -26,7 +26,7 @@ final class DateFormatter extends AbstractOperator { private ?string $format = null; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/ElementCounter.php b/lib/DataObject/GridColumnConfig/Operator/ElementCounter.php index e454e387209..e69d6e728d7 100644 --- a/lib/DataObject/GridColumnConfig/Operator/ElementCounter.php +++ b/lib/DataObject/GridColumnConfig/Operator/ElementCounter.php @@ -25,7 +25,7 @@ final class ElementCounter extends AbstractOperator { private bool $countEmpty; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -76,7 +76,7 @@ public function getCountEmpty(): bool return $this->countEmpty; } - public function setCountEmpty(bool $countEmpty) + public function setCountEmpty(bool $countEmpty): void { $this->countEmpty = $countEmpty; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Factory/LFExpanderFactory.php b/lib/DataObject/GridColumnConfig/Operator/Factory/LFExpanderFactory.php index fd1e6138497..ae472f14951 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Factory/LFExpanderFactory.php +++ b/lib/DataObject/GridColumnConfig/Operator/Factory/LFExpanderFactory.php @@ -33,7 +33,7 @@ public function __construct(LocaleServiceInterface $localeService) $this->localeService = $localeService; } - public function build(\stdClass $configElement, $context = null): OperatorInterface + public function build(\stdClass $configElement, array $context = []): OperatorInterface { return new LFExpander($this->localeService, $configElement, $context); } diff --git a/lib/DataObject/GridColumnConfig/Operator/Factory/LocaleSwitcherFactory.php b/lib/DataObject/GridColumnConfig/Operator/Factory/LocaleSwitcherFactory.php index 3cd593d0fe4..f3020a02e98 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Factory/LocaleSwitcherFactory.php +++ b/lib/DataObject/GridColumnConfig/Operator/Factory/LocaleSwitcherFactory.php @@ -33,7 +33,7 @@ public function __construct(LocaleServiceInterface $localeService) $this->localeService = $localeService; } - public function build(\stdClass $configElement, $context = null): OperatorInterface + public function build(\stdClass $configElement, array $context = []): OperatorInterface { return new LocaleSwitcher($this->localeService, $configElement, $context); } diff --git a/lib/DataObject/GridColumnConfig/Operator/Factory/TranslateValueFactory.php b/lib/DataObject/GridColumnConfig/Operator/Factory/TranslateValueFactory.php index 1efd3856e4e..ebeb040c564 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Factory/TranslateValueFactory.php +++ b/lib/DataObject/GridColumnConfig/Operator/Factory/TranslateValueFactory.php @@ -33,7 +33,7 @@ public function __construct(TranslatorInterface $translator) $this->translator = $translator; } - public function build(\stdClass $configElement, $context = null): OperatorInterface + public function build(\stdClass $configElement, array $context = []): OperatorInterface { return new TranslateValue($this->translator, $configElement, $context); } diff --git a/lib/DataObject/GridColumnConfig/Operator/Factory/WorkflowStateFactory.php b/lib/DataObject/GridColumnConfig/Operator/Factory/WorkflowStateFactory.php index de2295924f3..15166b5054b 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Factory/WorkflowStateFactory.php +++ b/lib/DataObject/GridColumnConfig/Operator/Factory/WorkflowStateFactory.php @@ -33,7 +33,7 @@ public function __construct(StatusInfo $workflowStatusInfo) $this->workflowStatusInfo = $workflowStatusInfo; } - public function build(\stdClass $configElement, $context = null): OperatorInterface + public function build(\stdClass $configElement, array $context = []): OperatorInterface { $operator = new WorkflowState($configElement, $context); $operator->setWorkflowStatusInfo($this->workflowStatusInfo); diff --git a/lib/DataObject/GridColumnConfig/Operator/FieldCollectionGetter.php b/lib/DataObject/GridColumnConfig/Operator/FieldCollectionGetter.php index c1c18b1d446..be3ed0391fc 100644 --- a/lib/DataObject/GridColumnConfig/Operator/FieldCollectionGetter.php +++ b/lib/DataObject/GridColumnConfig/Operator/FieldCollectionGetter.php @@ -30,7 +30,7 @@ final class FieldCollectionGetter extends AbstractOperator private string $colAttr; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/IsEqual.php b/lib/DataObject/GridColumnConfig/Operator/IsEqual.php index a582c7267c7..d5d6db80e5d 100644 --- a/lib/DataObject/GridColumnConfig/Operator/IsEqual.php +++ b/lib/DataObject/GridColumnConfig/Operator/IsEqual.php @@ -25,7 +25,7 @@ final class IsEqual extends AbstractOperator { private bool $skipNull; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -88,7 +88,7 @@ public function getSkipNull(): bool return $this->skipNull; } - public function setSkipNull(bool $skipNull) + public function setSkipNull(bool $skipNull): void { $this->skipNull = $skipNull; } diff --git a/lib/DataObject/GridColumnConfig/Operator/JSON.php b/lib/DataObject/GridColumnConfig/Operator/JSON.php index 1ce478619e3..788cbb7ca20 100644 --- a/lib/DataObject/GridColumnConfig/Operator/JSON.php +++ b/lib/DataObject/GridColumnConfig/Operator/JSON.php @@ -25,7 +25,7 @@ final class JSON extends AbstractOperator { private string $mode; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/LFExpander.php b/lib/DataObject/GridColumnConfig/Operator/LFExpander.php index 54d0fe788ff..242c715a91f 100644 --- a/lib/DataObject/GridColumnConfig/Operator/LFExpander.php +++ b/lib/DataObject/GridColumnConfig/Operator/LFExpander.php @@ -35,7 +35,7 @@ final class LFExpander extends AbstractOperator private bool $asArray; - public function __construct(LocaleServiceInterface $localeService, \stdClass $config, $context = null) + public function __construct(LocaleServiceInterface $localeService, \stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -110,7 +110,7 @@ public function getAsArray(): bool return $this->asArray; } - public function setAsArray(bool $asArray) + public function setAsArray(bool $asArray): void { $this->asArray = $asArray; } diff --git a/lib/DataObject/GridColumnConfig/Operator/LocaleSwitcher.php b/lib/DataObject/GridColumnConfig/Operator/LocaleSwitcher.php index 00609c3a3aa..c1b027a481d 100644 --- a/lib/DataObject/GridColumnConfig/Operator/LocaleSwitcher.php +++ b/lib/DataObject/GridColumnConfig/Operator/LocaleSwitcher.php @@ -28,7 +28,7 @@ final class LocaleSwitcher extends AbstractOperator private ?string $locale = null; - public function __construct(LocaleServiceInterface $localeService, \stdClass $config, $context = null) + public function __construct(LocaleServiceInterface $localeService, \stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/Merge.php b/lib/DataObject/GridColumnConfig/Operator/Merge.php index e51cf5aba7b..01c7c82d3d6 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Merge.php +++ b/lib/DataObject/GridColumnConfig/Operator/Merge.php @@ -27,7 +27,7 @@ final class Merge extends AbstractOperator private bool $unique; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -81,7 +81,7 @@ public function getFlatten(): bool return $this->flatten; } - public function setFlatten(bool $flatten) + public function setFlatten(bool $flatten): void { $this->flatten = $flatten; } @@ -91,7 +91,7 @@ public function getUnique(): bool return $this->unique; } - public function setUnique(bool $unique) + public function setUnique(bool $unique): void { $this->unique = $unique; } diff --git a/lib/DataObject/GridColumnConfig/Operator/ObjectFieldGetter.php b/lib/DataObject/GridColumnConfig/Operator/ObjectFieldGetter.php index 1f9ad8da55d..26343d62444 100644 --- a/lib/DataObject/GridColumnConfig/Operator/ObjectFieldGetter.php +++ b/lib/DataObject/GridColumnConfig/Operator/ObjectFieldGetter.php @@ -28,7 +28,7 @@ final class ObjectFieldGetter extends AbstractOperator private string $forwardAttribute; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/PHP.php b/lib/DataObject/GridColumnConfig/Operator/PHP.php index e8039926da3..063028fb341 100644 --- a/lib/DataObject/GridColumnConfig/Operator/PHP.php +++ b/lib/DataObject/GridColumnConfig/Operator/PHP.php @@ -26,7 +26,7 @@ final class PHP extends AbstractOperator { private string $mode; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/PHPCode.php b/lib/DataObject/GridColumnConfig/Operator/PHPCode.php index 57e2dd890b2..ba2ade93b85 100644 --- a/lib/DataObject/GridColumnConfig/Operator/PHPCode.php +++ b/lib/DataObject/GridColumnConfig/Operator/PHPCode.php @@ -29,7 +29,7 @@ final class PHPCode extends AbstractOperator private ?OperatorInterface $instance = null; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -42,7 +42,7 @@ public function getPhpClass(): string return $this->phpClass; } - public function setPhpClass(string $phpClass) + public function setPhpClass(string $phpClass): void { $this->phpClass = $phpClass; $this->instance = null; diff --git a/lib/DataObject/GridColumnConfig/Operator/PropertyGetter.php b/lib/DataObject/GridColumnConfig/Operator/PropertyGetter.php index 1ffaf2053b8..fdfb4f0810c 100644 --- a/lib/DataObject/GridColumnConfig/Operator/PropertyGetter.php +++ b/lib/DataObject/GridColumnConfig/Operator/PropertyGetter.php @@ -25,7 +25,7 @@ final class PropertyGetter extends AbstractOperator { private string $propertyName; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -49,7 +49,7 @@ public function getPropertyName(): string return $this->propertyName; } - public function setPropertyName(string $propertyName) + public function setPropertyName(string $propertyName): void { $this->propertyName = $propertyName; } diff --git a/lib/DataObject/GridColumnConfig/Operator/RequiredBy.php b/lib/DataObject/GridColumnConfig/Operator/RequiredBy.php index c11406300b4..2bb88be2a30 100644 --- a/lib/DataObject/GridColumnConfig/Operator/RequiredBy.php +++ b/lib/DataObject/GridColumnConfig/Operator/RequiredBy.php @@ -29,7 +29,7 @@ final class RequiredBy extends AbstractOperator private bool $onlyCount; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -85,7 +85,7 @@ public function getElementType(): ?string return $this->elementType; } - public function setElementType(?string $elementType) + public function setElementType(?string $elementType): void { $this->elementType = $elementType; } @@ -95,7 +95,7 @@ public function getOnlyCount(): bool return $this->onlyCount; } - public function setOnlyCount(bool $onlyCount) + public function setOnlyCount(bool $onlyCount): void { $this->onlyCount = $onlyCount; } diff --git a/lib/DataObject/GridColumnConfig/Operator/StringContains.php b/lib/DataObject/GridColumnConfig/Operator/StringContains.php index 4658cb98db2..33d074ea0d1 100644 --- a/lib/DataObject/GridColumnConfig/Operator/StringContains.php +++ b/lib/DataObject/GridColumnConfig/Operator/StringContains.php @@ -27,7 +27,7 @@ final class StringContains extends AbstractOperator private bool $insensitive; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -100,7 +100,7 @@ public function getSearch(): string return $this->search; } - public function setSearch(string $search) + public function setSearch(string $search): void { $this->search = $search; } @@ -110,7 +110,7 @@ public function getInsensitive(): bool return $this->insensitive; } - public function setInsensitive(bool $insensitive) + public function setInsensitive(bool $insensitive): void { $this->insensitive = $insensitive; } diff --git a/lib/DataObject/GridColumnConfig/Operator/StringReplace.php b/lib/DataObject/GridColumnConfig/Operator/StringReplace.php index db2e749b292..633375f6923 100644 --- a/lib/DataObject/GridColumnConfig/Operator/StringReplace.php +++ b/lib/DataObject/GridColumnConfig/Operator/StringReplace.php @@ -29,7 +29,7 @@ final class StringReplace extends AbstractOperator private bool $insensitive; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -100,7 +100,7 @@ public function getSearch(): string return $this->search; } - public function setSearch(string $search) + public function setSearch(string $search): void { $this->search = $search; } @@ -110,7 +110,7 @@ public function getReplace(): string return $this->replace; } - public function setReplace(string $replace) + public function setReplace(string $replace): void { $this->replace = $replace; } @@ -120,7 +120,7 @@ public function getInsensitive(): bool return $this->insensitive; } - public function setInsensitive(bool $insensitive) + public function setInsensitive(bool $insensitive): void { $this->insensitive = $insensitive; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Substring.php b/lib/DataObject/GridColumnConfig/Operator/Substring.php index fef903a3753..86f38db9b4d 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Substring.php +++ b/lib/DataObject/GridColumnConfig/Operator/Substring.php @@ -29,7 +29,7 @@ final class Substring extends AbstractOperator private bool $ellipses; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); @@ -101,7 +101,7 @@ public function getStart(): int return $this->start; } - public function setStart(int $start) + public function setStart(int $start): void { $this->start = $start; } @@ -111,7 +111,7 @@ public function getLength(): int return $this->length; } - public function setLength(int $length) + public function setLength(int $length): void { $this->length = $length; } @@ -121,7 +121,7 @@ public function getEllipses(): bool return $this->ellipses; } - public function setEllipses(bool $ellipses) + public function setEllipses(bool $ellipses): void { $this->ellipses = $ellipses; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Text.php b/lib/DataObject/GridColumnConfig/Operator/Text.php index 2bf295d5b84..be608a312fd 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Text.php +++ b/lib/DataObject/GridColumnConfig/Operator/Text.php @@ -25,7 +25,7 @@ final class Text extends AbstractOperator { private string $textValue; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/DataObject/GridColumnConfig/Operator/TranslateValue.php b/lib/DataObject/GridColumnConfig/Operator/TranslateValue.php index 8cf95601305..20ca9fcaedc 100644 --- a/lib/DataObject/GridColumnConfig/Operator/TranslateValue.php +++ b/lib/DataObject/GridColumnConfig/Operator/TranslateValue.php @@ -75,7 +75,7 @@ public function getPrefix(): string return $this->prefix; } - public function setPrefix(string $prefix) + public function setPrefix(string $prefix): void { $this->prefix = $prefix; } diff --git a/lib/DataObject/GridColumnConfig/Operator/Trimmer.php b/lib/DataObject/GridColumnConfig/Operator/Trimmer.php index 63a23d310c5..0f08251d8d1 100644 --- a/lib/DataObject/GridColumnConfig/Operator/Trimmer.php +++ b/lib/DataObject/GridColumnConfig/Operator/Trimmer.php @@ -31,7 +31,7 @@ final class Trimmer extends AbstractOperator private int $trim; - public function __construct(\stdClass $config, $context = null) + public function __construct(\stdClass $config, array $context = []) { parent::__construct($config, $context); diff --git a/lib/Db/Helper.php b/lib/Db/Helper.php index c59b92a2c4d..e94034b4de6 100644 --- a/lib/Db/Helper.php +++ b/lib/Db/Helper.php @@ -18,6 +18,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\Result; +use Doctrine\DBAL\Types\Type; use Pimcore\Model\Element\ValidationException; class Helper @@ -36,7 +37,7 @@ public static function upsert(Connection $connection, string $table, array $data } } - public static function insertOrUpdate(Connection $connection, $table, array $data): int|string + public static function insertOrUpdate(Connection $connection, string $table, array $data): int|string { // extract and quote col names from the array keys $i = 0; @@ -69,7 +70,7 @@ public static function insertOrUpdate(Connection $connection, $table, array $dat return $connection->executeStatement($sql, $bind); } - public static function fetchPairs(Connection $db, $sql, array $params = [], $types = []): array + public static function fetchPairs(Connection $db, string $sql, array $params = [], array $types = []): array { $stmt = $db->executeQuery($sql, $params, $types); $data = []; @@ -82,7 +83,7 @@ public static function fetchPairs(Connection $db, $sql, array $params = [], $typ return $data; } - public static function selectAndDeleteWhere(Connection $db, $table, $idColumn = 'id', $where = ''): void + public static function selectAndDeleteWhere(Connection $db, string $table, string $idColumn = 'id', string $where = ''): void { $sql = 'SELECT ' . $db->quoteIdentifier($idColumn) . ' FROM ' . $table; @@ -101,7 +102,7 @@ public static function selectAndDeleteWhere(Connection $db, $table, $idColumn = } } - public static function queryIgnoreError(Connection $db, $sql, $exclusions = []): ?\Doctrine\DBAL\Result + public static function queryIgnoreError(Connection $db, string $sql, array $exclusions = []): ?\Doctrine\DBAL\Result { try { return $db->executeQuery($sql); @@ -117,7 +118,7 @@ public static function queryIgnoreError(Connection $db, $sql, $exclusions = []): return null; } - public static function quoteInto(Connection $db, $text, $value, $type = null, $count = null): array|string + public static function quoteInto(Connection $db, string $text, mixed $value, int|string|Type|null $type = null, ?int $count = null): array|string { if ($count === null) { return str_replace('?', $db->quote($value, $type), $text); diff --git a/lib/Document/Editable/Block/BlockName.php b/lib/Document/Editable/Block/BlockName.php index 11b490520ad..5c234f701b8 100644 --- a/lib/Document/Editable/Block/BlockName.php +++ b/lib/Document/Editable/Block/BlockName.php @@ -39,25 +39,16 @@ public function __construct(string $name, string $realName) /** * Factory method to create an instance from strings - * - * @param string $name - * @param string $realName - * - * @return BlockName */ - public static function createFromNames(string $name, string $realName): BlockName + public static function createFromNames(string $name, string $realName): self { return new self($name, $realName); } /** * Create an instance from a document editable - * - * @param Editable $editable - * - * @return BlockName */ - public static function createFromEditable(Editable $editable): BlockName + public static function createFromEditable(Editable $editable): self { return new self($editable->getName(), $editable->getRealName()); } diff --git a/lib/Document/Editable/Block/BlockState.php b/lib/Document/Editable/Block/BlockState.php index 7fc2eef3a77..e7af8e4af78 100644 --- a/lib/Document/Editable/Block/BlockState.php +++ b/lib/Document/Editable/Block/BlockState.php @@ -51,7 +51,7 @@ public function hasBlocks(): bool return !empty($this->blocks); } - public function pushBlock(BlockName $block) + public function pushBlock(BlockName $block): void { array_push($this->blocks, $block); } @@ -65,7 +65,7 @@ public function popBlock(): BlockName return array_pop($this->blocks); } - public function clearBlocks() + public function clearBlocks(): void { $this->blocks = []; } @@ -83,7 +83,7 @@ public function hasIndexes(): bool return !empty($this->indexes); } - public function pushIndex(int $index) + public function pushIndex(int $index): void { array_push($this->indexes, $index); } @@ -97,7 +97,7 @@ public function popIndex(): int return array_pop($this->indexes); } - public function clearIndexes() + public function clearIndexes(): void { $this->indexes = []; } diff --git a/lib/Document/Editable/Block/BlockStateStack.php b/lib/Document/Editable/Block/BlockStateStack.php index d47df963f86..ede7050b55c 100644 --- a/lib/Document/Editable/Block/BlockStateStack.php +++ b/lib/Document/Editable/Block/BlockStateStack.php @@ -40,7 +40,7 @@ public function __construct() * * @param BlockState|null $blockState */ - public function push(BlockState $blockState = null) + public function push(BlockState $blockState = null): void { if (null === $blockState) { $blockState = new BlockState(); @@ -91,7 +91,7 @@ public function jsonSerialize(): array return $this->states; } - public function loadArray(array $array) + public function loadArray(array $array): void { $this->states = []; diff --git a/lib/Document/Editable/EditableHandler.php b/lib/Document/Editable/EditableHandler.php index 59085d11abc..9fc47c532df 100644 --- a/lib/Document/Editable/EditableHandler.php +++ b/lib/Document/Editable/EditableHandler.php @@ -225,7 +225,7 @@ public function renderAreaFrontend(Info $info, array $templateParams = []): stri return $html; } - protected function handleBrickActionResult(?Response $result) + protected function handleBrickActionResult(?Response $result): void { // if the action result is a response object, push it onto the // response stack. this response will be used by the ResponseStackListener diff --git a/lib/Document/Editable/UsageRecorderSubscriber.php b/lib/Document/Editable/UsageRecorderSubscriber.php index bd4c4e707d9..ce4ba2e91b3 100644 --- a/lib/Document/Editable/UsageRecorderSubscriber.php +++ b/lib/Document/Editable/UsageRecorderSubscriber.php @@ -38,7 +38,7 @@ public static function getSubscribedEvents(): array ]; } - public function onBuildEditableName(EditableNameEvent $event) + public function onBuildEditableName(EditableNameEvent $event): void { $this->recordedEditableNames[] = $event->getEditableName(); } diff --git a/lib/Event/Admin/IndexActionSettingsEvent.php b/lib/Event/Admin/IndexActionSettingsEvent.php index 216385bc526..f0410d6f1c6 100644 --- a/lib/Event/Admin/IndexActionSettingsEvent.php +++ b/lib/Event/Admin/IndexActionSettingsEvent.php @@ -33,12 +33,12 @@ public function getSettings(): array return $this->settings; } - public function setSettings(array $settings) + public function setSettings(array $settings): void { $this->settings = $settings; } - public function addSetting(string $key, mixed $value) + public function addSetting(string $key, mixed $value): void { $this->settings[$key] = $value; } diff --git a/lib/Event/Admin/Login/LoginCredentialsEvent.php b/lib/Event/Admin/Login/LoginCredentialsEvent.php index 9e53c1dbe2b..99753099ff0 100644 --- a/lib/Event/Admin/Login/LoginCredentialsEvent.php +++ b/lib/Event/Admin/Login/LoginCredentialsEvent.php @@ -37,7 +37,7 @@ public function getCredentials(): array return $this->credentials; } - public function setCredentials(array $credentials) + public function setCredentials(array $credentials): void { $this->credentials = $credentials; } diff --git a/lib/Event/Admin/Report/SettingsEvent.php b/lib/Event/Admin/Report/SettingsEvent.php index 2038c3a3165..3a876fde3eb 100644 --- a/lib/Event/Admin/Report/SettingsEvent.php +++ b/lib/Event/Admin/Report/SettingsEvent.php @@ -33,7 +33,7 @@ public function getSettings(): array return $this->settings; } - public function setSettings(array $settings) + public function setSettings(array $settings): void { $this->settings = $settings; } diff --git a/lib/Event/Analytics/Google/TagManager/CodeEvent.php b/lib/Event/Analytics/Google/TagManager/CodeEvent.php index 9ba6ac6e784..07d4a530f7d 100644 --- a/lib/Event/Analytics/Google/TagManager/CodeEvent.php +++ b/lib/Event/Analytics/Google/TagManager/CodeEvent.php @@ -46,7 +46,7 @@ public function getData(): array return $this->data; } - public function setData(array $data) + public function setData(array $data): void { $this->data = $data; } @@ -73,7 +73,7 @@ public function getTemplate(): string return $this->template; } - public function setTemplate(string $template) + public function setTemplate(string $template): void { $this->template = $template; } diff --git a/lib/Event/BundleManager/PathsEvent.php b/lib/Event/BundleManager/PathsEvent.php index d7b402dda93..787f39c23b6 100644 --- a/lib/Event/BundleManager/PathsEvent.php +++ b/lib/Event/BundleManager/PathsEvent.php @@ -33,13 +33,13 @@ public function getPaths(): array return $this->paths; } - public function setPaths(array $paths) + public function setPaths(array $paths): void { $this->paths = []; $this->addPaths($paths); } - public function addPaths(array $paths) + public function addPaths(array $paths): void { $this->paths = array_merge($this->paths, $paths); $this->paths = array_unique($this->paths); diff --git a/lib/Event/Cache/Core/ResultEvent.php b/lib/Event/Cache/Core/ResultEvent.php index 21c054714db..077a7eae072 100644 --- a/lib/Event/Cache/Core/ResultEvent.php +++ b/lib/Event/Cache/Core/ResultEvent.php @@ -32,7 +32,7 @@ public function getResult(): bool return $this->result; } - public function setResult(bool $result) + public function setResult(bool $result): void { $this->result = (bool)$result; } diff --git a/lib/Event/Cache/FullPage/CacheResponseEvent.php b/lib/Event/Cache/FullPage/CacheResponseEvent.php index 3a5e903a85e..9c5e1f5e631 100644 --- a/lib/Event/Cache/FullPage/CacheResponseEvent.php +++ b/lib/Event/Cache/FullPage/CacheResponseEvent.php @@ -45,7 +45,7 @@ public function getCache(): bool return $this->cache; } - public function setCache(bool $cache) + public function setCache(bool $cache): void { $this->cache = $cache; } diff --git a/lib/Event/Cache/FullPage/IgnoredSessionKeysEvent.php b/lib/Event/Cache/FullPage/IgnoredSessionKeysEvent.php index 644e66b2c94..90d3cd735a1 100644 --- a/lib/Event/Cache/FullPage/IgnoredSessionKeysEvent.php +++ b/lib/Event/Cache/FullPage/IgnoredSessionKeysEvent.php @@ -40,7 +40,7 @@ public function getKeys(): array return $this->keys; } - public function setKeys(array $keys) + public function setKeys(array $keys): void { $this->keys = $keys; } diff --git a/lib/Event/Model/AssetEvent.php b/lib/Event/Model/AssetEvent.php index 6c9beb95865..337ce6a7ad5 100644 --- a/lib/Event/Model/AssetEvent.php +++ b/lib/Event/Model/AssetEvent.php @@ -43,7 +43,7 @@ public function getAsset(): Asset return $this->asset; } - public function setAsset(Asset $asset) + public function setAsset(Asset $asset): void { $this->asset = $asset; } diff --git a/lib/Event/Model/DataObject/ClassDefinitionEvent.php b/lib/Event/Model/DataObject/ClassDefinitionEvent.php index 20826caba06..137899f54cf 100644 --- a/lib/Event/Model/DataObject/ClassDefinitionEvent.php +++ b/lib/Event/Model/DataObject/ClassDefinitionEvent.php @@ -38,7 +38,7 @@ public function getClassDefinition(): ClassDefinition return $this->classDefinition; } - public function setClassDefinition(ClassDefinition $classDefinition) + public function setClassDefinition(ClassDefinition $classDefinition): void { $this->classDefinition = $classDefinition; } diff --git a/lib/Event/Model/DataObject/ClassificationStore/CollectionConfigEvent.php b/lib/Event/Model/DataObject/ClassificationStore/CollectionConfigEvent.php index 50b995cfbb2..a6157c4100d 100644 --- a/lib/Event/Model/DataObject/ClassificationStore/CollectionConfigEvent.php +++ b/lib/Event/Model/DataObject/ClassificationStore/CollectionConfigEvent.php @@ -38,7 +38,7 @@ public function getCollectionConfig(): CollectionConfig return $this->collectionConfig; } - public function setCollectionConfig(CollectionConfig $collectionConfig) + public function setCollectionConfig(CollectionConfig $collectionConfig): void { $this->collectionConfig = $collectionConfig; } diff --git a/lib/Event/Model/DataObject/ClassificationStore/GroupConfigEvent.php b/lib/Event/Model/DataObject/ClassificationStore/GroupConfigEvent.php index 4f08b370c91..bc1840867d7 100644 --- a/lib/Event/Model/DataObject/ClassificationStore/GroupConfigEvent.php +++ b/lib/Event/Model/DataObject/ClassificationStore/GroupConfigEvent.php @@ -38,7 +38,7 @@ public function getGroupConfig(): GroupConfig return $this->groupConfig; } - public function setGroupConfig(GroupConfig $groupConfig) + public function setGroupConfig(GroupConfig $groupConfig): void { $this->groupConfig = $groupConfig; } diff --git a/lib/Event/Model/DataObject/ClassificationStore/KeyConfigEvent.php b/lib/Event/Model/DataObject/ClassificationStore/KeyConfigEvent.php index e33995bb295..5be72b60260 100644 --- a/lib/Event/Model/DataObject/ClassificationStore/KeyConfigEvent.php +++ b/lib/Event/Model/DataObject/ClassificationStore/KeyConfigEvent.php @@ -38,7 +38,7 @@ public function getKeyConfig(): KeyConfig return $this->keyConfig; } - public function setKeyConfig(KeyConfig $keyConfig) + public function setKeyConfig(KeyConfig $keyConfig): void { $this->keyConfig = $keyConfig; } diff --git a/lib/Event/Model/DataObject/ClassificationStore/StoreConfigEvent.php b/lib/Event/Model/DataObject/ClassificationStore/StoreConfigEvent.php index adce156a604..4212ce418d0 100644 --- a/lib/Event/Model/DataObject/ClassificationStore/StoreConfigEvent.php +++ b/lib/Event/Model/DataObject/ClassificationStore/StoreConfigEvent.php @@ -38,7 +38,7 @@ public function getStoreConfig(): StoreConfig return $this->storeConfig; } - public function setStoreConfig(StoreConfig $storeConfig) + public function setStoreConfig(StoreConfig $storeConfig): void { $this->storeConfig = $storeConfig; } diff --git a/lib/Event/Model/DataObject/CustomLayoutEvent.php b/lib/Event/Model/DataObject/CustomLayoutEvent.php index 5bca3a516a4..ef4e22ee4f1 100644 --- a/lib/Event/Model/DataObject/CustomLayoutEvent.php +++ b/lib/Event/Model/DataObject/CustomLayoutEvent.php @@ -38,7 +38,7 @@ public function getCustomLayout(): ClassDefinition\CustomLayout return $this->customLayout; } - public function setCustomLayout(ClassDefinition\CustomLayout $customLayout) + public function setCustomLayout(ClassDefinition\CustomLayout $customLayout): void { $this->customLayout = $customLayout; } diff --git a/lib/Event/Model/DataObject/QuantityValueUnitEvent.php b/lib/Event/Model/DataObject/QuantityValueUnitEvent.php index 819dbed7b66..445cffc3739 100644 --- a/lib/Event/Model/DataObject/QuantityValueUnitEvent.php +++ b/lib/Event/Model/DataObject/QuantityValueUnitEvent.php @@ -38,7 +38,7 @@ public function getUnit(): Unit return $this->unit; } - public function setUnit(Unit $unit) + public function setUnit(Unit $unit): void { $this->unit = $unit; } diff --git a/lib/Event/Model/DataObjectEvent.php b/lib/Event/Model/DataObjectEvent.php index 6501c9c72ba..bfd76acfe23 100644 --- a/lib/Event/Model/DataObjectEvent.php +++ b/lib/Event/Model/DataObjectEvent.php @@ -43,7 +43,7 @@ public function getObject(): AbstractObject return $this->object; } - public function setObject(AbstractObject $object) + public function setObject(AbstractObject $object): void { $this->object = $object; } diff --git a/lib/Event/Model/DataObjectImportEvent.php b/lib/Event/Model/DataObjectImportEvent.php index 3f5da91c6bc..689376b1374 100644 --- a/lib/Event/Model/DataObjectImportEvent.php +++ b/lib/Event/Model/DataObjectImportEvent.php @@ -55,7 +55,7 @@ public function getConfig(): mixed return $this->config; } - public function setConfig(mixed $config) + public function setConfig(mixed $config): void { $this->config = $config; } @@ -65,7 +65,7 @@ public function getOriginalFile(): string return $this->originalFile; } - public function setOriginalFile(string $originalFile) + public function setOriginalFile(string $originalFile): void { $this->originalFile = $originalFile; } @@ -75,7 +75,7 @@ public function getObject(): Concrete return $this->object; } - public function setObject(Concrete $object) + public function setObject(Concrete $object): void { $this->object = $object; } @@ -85,7 +85,7 @@ public function getRowData(): mixed return $this->rowData; } - public function setRowData(mixed $rowData) + public function setRowData(mixed $rowData): void { $this->rowData = $rowData; } @@ -95,7 +95,7 @@ public function getAdditionalData(): mixed return $this->additionalData; } - public function setAdditionalData(mixed $additionalData) + public function setAdditionalData(mixed $additionalData): void { $this->additionalData = $additionalData; } @@ -105,7 +105,7 @@ public function getContext(): mixed return $this->context; } - public function setContext(mixed $context) + public function setContext(mixed $context): void { $this->context = $context; } diff --git a/lib/Event/Model/Document/EditableNameEvent.php b/lib/Event/Model/Document/EditableNameEvent.php index 6caa9868b94..90a1e1f7387 100644 --- a/lib/Event/Model/Document/EditableNameEvent.php +++ b/lib/Event/Model/Document/EditableNameEvent.php @@ -92,7 +92,7 @@ public function getEditableName(): string return $this->editableName; } - public function setEditableName(string $editableName) + public function setEditableName(string $editableName): void { $this->editableName = $editableName; } diff --git a/lib/Event/Model/DocumentEvent.php b/lib/Event/Model/DocumentEvent.php index e3e6d4281d9..22f453277e7 100644 --- a/lib/Event/Model/DocumentEvent.php +++ b/lib/Event/Model/DocumentEvent.php @@ -43,7 +43,7 @@ public function getDocument(): Document return $this->document; } - public function setDocument(Document $document) + public function setDocument(Document $document): void { $this->document = $document; } diff --git a/lib/Event/Model/ElementEvent.php b/lib/Event/Model/ElementEvent.php index db04ee3ee32..ff45a02d471 100644 --- a/lib/Event/Model/ElementEvent.php +++ b/lib/Event/Model/ElementEvent.php @@ -43,7 +43,7 @@ public function getElement(): ElementInterface return $this->element; } - public function setElement(ElementInterface $element) + public function setElement(ElementInterface $element): void { $this->element = $element; } diff --git a/lib/Event/Model/ModelEvent.php b/lib/Event/Model/ModelEvent.php index 9087698fcff..f534e5a9400 100644 --- a/lib/Event/Model/ModelEvent.php +++ b/lib/Event/Model/ModelEvent.php @@ -37,7 +37,7 @@ public function getModel(): ModelInterface return $this->modelInterface; } - public function setModel(ModelInterface $element) + public function setModel(ModelInterface $element): void { $this->modelInterface = $element; } diff --git a/lib/Event/Model/NotificationEvent.php b/lib/Event/Model/NotificationEvent.php index cec1f4c00ae..851b35a585b 100644 --- a/lib/Event/Model/NotificationEvent.php +++ b/lib/Event/Model/NotificationEvent.php @@ -43,7 +43,7 @@ public function getNotification(): Notification return $this->notification; } - public function setNotification(Notification $notification) + public function setNotification(Notification $notification): void { $this->notification = $notification; } diff --git a/lib/Event/Model/SearchBackendEvent.php b/lib/Event/Model/SearchBackendEvent.php index 3a6e41fed97..5b5475abc33 100644 --- a/lib/Event/Model/SearchBackendEvent.php +++ b/lib/Event/Model/SearchBackendEvent.php @@ -38,7 +38,7 @@ public function getData(): Data return $this->data; } - public function setData(Data $data) + public function setData(Data $data): void { $this->data = $data; } diff --git a/lib/Event/Model/TargetGroupEvent.php b/lib/Event/Model/TargetGroupEvent.php index 4f324299804..a0d750f52c2 100644 --- a/lib/Event/Model/TargetGroupEvent.php +++ b/lib/Event/Model/TargetGroupEvent.php @@ -42,7 +42,7 @@ public function getTargetGroup(): TargetGroup return $this->targetGroup; } - public function setTargetGroup(TargetGroup $targetGroup) + public function setTargetGroup(TargetGroup $targetGroup): void { $this->targetGroup = $targetGroup; } diff --git a/lib/Event/Model/TranslationEvent.php b/lib/Event/Model/TranslationEvent.php index ce83d589c3e..4c0cda072b3 100644 --- a/lib/Event/Model/TranslationEvent.php +++ b/lib/Event/Model/TranslationEvent.php @@ -43,7 +43,7 @@ public function getTranslation(): Translation return $this->translation; } - public function setTranslation(Translation $translation) + public function setTranslation(Translation $translation): void { $this->translation = $translation; } diff --git a/lib/Event/Model/UserRoleEvent.php b/lib/Event/Model/UserRoleEvent.php index e4afb4c4e44..b4a4bf53002 100644 --- a/lib/Event/Model/UserRoleEvent.php +++ b/lib/Event/Model/UserRoleEvent.php @@ -38,7 +38,7 @@ public function getUserRole(): AbstractUser return $this->userRole; } - public function setUserRole(AbstractUser $userRole) + public function setUserRole(AbstractUser $userRole): void { $this->userRole = $userRole; } diff --git a/lib/Event/Model/VersionEvent.php b/lib/Event/Model/VersionEvent.php index ee7cacde4c1..d9205e8814d 100644 --- a/lib/Event/Model/VersionEvent.php +++ b/lib/Event/Model/VersionEvent.php @@ -38,7 +38,7 @@ public function getVersion(): Version return $this->version; } - public function setVersion(Version $version) + public function setVersion(Version $version): void { $this->version = $version; } diff --git a/lib/Event/System/ConsoleEvent.php b/lib/Event/System/ConsoleEvent.php index 0e4f7f463e7..aa4984e8bb4 100644 --- a/lib/Event/System/ConsoleEvent.php +++ b/lib/Event/System/ConsoleEvent.php @@ -38,7 +38,7 @@ public function getApplication(): Application return $this->application; } - public function setApplication(Application $application) + public function setApplication(Application $application): void { $this->application = $application; } diff --git a/lib/Event/Targeting/BuildConditionEvent.php b/lib/Event/Targeting/BuildConditionEvent.php index c994308ba79..7d68a96803c 100644 --- a/lib/Event/Targeting/BuildConditionEvent.php +++ b/lib/Event/Targeting/BuildConditionEvent.php @@ -62,7 +62,7 @@ public function getCondition(): ?ConditionInterface return $this->condition; } - public function setCondition(ConditionInterface $condition) + public function setCondition(ConditionInterface $condition): void { $this->condition = $condition; diff --git a/lib/Event/Targeting/RenderToolbarEvent.php b/lib/Event/Targeting/RenderToolbarEvent.php index fec27e39d61..013c1b62229 100644 --- a/lib/Event/Targeting/RenderToolbarEvent.php +++ b/lib/Event/Targeting/RenderToolbarEvent.php @@ -36,7 +36,7 @@ public function getTemplate(): string return $this->template; } - public function setTemplate(string $template) + public function setTemplate(string $template): void { $this->template = $template; } @@ -46,7 +46,7 @@ public function getData(): array return $this->data; } - public function setData(array $data) + public function setData(array $data): void { $this->data = $data; } diff --git a/lib/Event/Targeting/TargetingCodeEvent.php b/lib/Event/Targeting/TargetingCodeEvent.php index 696e553e04b..1cd349af8f1 100644 --- a/lib/Event/Targeting/TargetingCodeEvent.php +++ b/lib/Event/Targeting/TargetingCodeEvent.php @@ -51,7 +51,7 @@ public function getTemplate(): string return $this->template; } - public function setTemplate(string $template) + public function setTemplate(string $template): void { $this->template = $template; } @@ -78,7 +78,7 @@ public function getData(): array return $this->data; } - public function setData(array $data) + public function setData(array $data): void { $this->data = $data; } diff --git a/lib/Event/Targeting/TargetingResolveVisitorInfoEvent.php b/lib/Event/Targeting/TargetingResolveVisitorInfoEvent.php index 0b51974fffd..eb7b648f4f1 100644 --- a/lib/Event/Targeting/TargetingResolveVisitorInfoEvent.php +++ b/lib/Event/Targeting/TargetingResolveVisitorInfoEvent.php @@ -21,7 +21,7 @@ class TargetingResolveVisitorInfoEvent extends TargetingEvent { - public function setVisitorInfo(VisitorInfo $visitorInfo) + public function setVisitorInfo(VisitorInfo $visitorInfo): void { $this->visitorInfo = $visitorInfo; } diff --git a/lib/Extension/Bundle/Installer/AbstractInstaller.php b/lib/Extension/Bundle/Installer/AbstractInstaller.php index fa254387626..8f9a5d14911 100644 --- a/lib/Extension/Bundle/Installer/AbstractInstaller.php +++ b/lib/Extension/Bundle/Installer/AbstractInstaller.php @@ -32,14 +32,14 @@ public function __construct() /** * {@inheritdoc} */ - public function install() + public function install(): void { } /** * {@inheritdoc} */ - public function uninstall() + public function uninstall(): void { } diff --git a/lib/Extension/Bundle/Installer/InstallerInterface.php b/lib/Extension/Bundle/Installer/InstallerInterface.php index 4b9696df6e0..2d066af001e 100644 --- a/lib/Extension/Bundle/Installer/InstallerInterface.php +++ b/lib/Extension/Bundle/Installer/InstallerInterface.php @@ -27,14 +27,14 @@ interface InstallerInterface * * @throws InstallationException */ - public function install(); + public function install(): void; /** * Uninstalls the bundle * * @throws InstallationException */ - public function uninstall(); + public function uninstall(): void; /** * Determine if bundle is installed diff --git a/lib/Extension/Bundle/Installer/SettingsStoreAwareInstaller.php b/lib/Extension/Bundle/Installer/SettingsStoreAwareInstaller.php index 324b24b4105..b97d2836371 100644 --- a/lib/Extension/Bundle/Installer/SettingsStoreAwareInstaller.php +++ b/lib/Extension/Bundle/Installer/SettingsStoreAwareInstaller.php @@ -69,7 +69,7 @@ public function getLastMigrationVersionClassName(): ?string return null; } - protected function markInstalled() + protected function markInstalled(): void { $migrationVersion = $this->getLastMigrationVersionClassName(); if ($migrationVersion) { @@ -95,7 +95,7 @@ protected function markInstalled() SettingsStore::set($this->getSettingsStoreInstallationId(), true, 'bool', 'pimcore'); } - protected function markUninstalled() + protected function markUninstalled(): void { SettingsStore::set($this->getSettingsStoreInstallationId(), false, 'bool', 'pimcore'); @@ -111,13 +111,13 @@ protected function markUninstalled() } } - public function install() + public function install(): void { parent::install(); $this->markInstalled(); } - public function uninstall() + public function uninstall(): void { parent::uninstall(); $this->markUninstalled(); diff --git a/lib/Extension/Document/Areabrick/AbstractAreabrick.php b/lib/Extension/Document/Areabrick/AbstractAreabrick.php index 478e44fa82a..cdd741b54d0 100644 --- a/lib/Extension/Document/Areabrick/AbstractAreabrick.php +++ b/lib/Extension/Document/Areabrick/AbstractAreabrick.php @@ -35,7 +35,7 @@ abstract class AbstractAreabrick implements AreabrickInterface, TemplateAreabric * * @param EditableRenderer $editableRenderer */ - public function setEditableRenderer(EditableRenderer $editableRenderer) + public function setEditableRenderer(EditableRenderer $editableRenderer): void { $this->editableRenderer = $editableRenderer; } @@ -45,7 +45,7 @@ public function setEditableRenderer(EditableRenderer $editableRenderer) /** * {@inheritdoc} */ - public function setId(string $id) + public function setId(string $id): void { // make sure ID is only set once if (null !== $this->id) { diff --git a/lib/Extension/Document/Areabrick/AreabrickInterface.php b/lib/Extension/Document/Areabrick/AreabrickInterface.php index 90811e87eaf..0400104e520 100644 --- a/lib/Extension/Document/Areabrick/AreabrickInterface.php +++ b/lib/Extension/Document/Areabrick/AreabrickInterface.php @@ -26,7 +26,7 @@ interface AreabrickInterface * * @param string $id */ - public function setId(string $id); + public function setId(string $id): void; /** * Brick ID - needs to be unique throughout the system. diff --git a/lib/Extension/Document/Areabrick/AreabrickManager.php b/lib/Extension/Document/Areabrick/AreabrickManager.php index 8678114dc5f..fc7e6d176a7 100644 --- a/lib/Extension/Document/Areabrick/AreabrickManager.php +++ b/lib/Extension/Document/Areabrick/AreabrickManager.php @@ -43,7 +43,7 @@ public function __construct(ContainerInterface $container) /** * {@inheritdoc} */ - public function register(string $id, AreabrickInterface $brick) + public function register(string $id, AreabrickInterface $brick): void { if (array_key_exists($id, $this->bricks)) { throw new ConfigurationException(sprintf( @@ -71,7 +71,7 @@ public function register(string $id, AreabrickInterface $brick) /** * {@inheritdoc} */ - public function registerService(string $id, string $serviceId) + public function registerService(string $id, string $serviceId): void { if (array_key_exists($id, $this->bricks)) { throw new ConfigurationException(sprintf( @@ -182,7 +182,7 @@ protected function loadServiceBrick(string $id): ?AreabrickInterface /** * Loads all brick instances registered as service definitions */ - protected function loadServiceBricks() + protected function loadServiceBricks(): void { foreach ($this->brickServiceIds as $id => $serviceId) { $this->loadServiceBrick($id); diff --git a/lib/Extension/Document/Areabrick/AreabrickManagerInterface.php b/lib/Extension/Document/Areabrick/AreabrickManagerInterface.php index 6acacaa4005..1f0863e72f1 100644 --- a/lib/Extension/Document/Areabrick/AreabrickManagerInterface.php +++ b/lib/Extension/Document/Areabrick/AreabrickManagerInterface.php @@ -25,7 +25,7 @@ interface AreabrickManagerInterface * @param string $id * @param AreabrickInterface $brick */ - public function register(string $id, AreabrickInterface $brick); + public function register(string $id, AreabrickInterface $brick): void; /** * Registers a lazy loaded area brick service on the manager @@ -33,7 +33,7 @@ public function register(string $id, AreabrickInterface $brick); * @param string $id * @param string $serviceId */ - public function registerService(string $id, string $serviceId); + public function registerService(string $id, string $serviceId): void; /** * Fetches a brick by ID diff --git a/lib/Google/Cse.php b/lib/Google/Cse.php index 51078e7e80b..392d8b6ccfc 100644 --- a/lib/Google/Cse.php +++ b/lib/Google/Cse.php @@ -145,7 +145,7 @@ public function __construct(Search $googleResponse = null) } } - public function readGoogleResponse(Search $googleResponse) + public function readGoogleResponse(Search $googleResponse): void { $items = []; diff --git a/lib/Http/Request/Resolver/DocumentResolver.php b/lib/Http/Request/Resolver/DocumentResolver.php index 1f42a4c9812..6e4a876be9a 100644 --- a/lib/Http/Request/Resolver/DocumentResolver.php +++ b/lib/Http/Request/Resolver/DocumentResolver.php @@ -47,7 +47,7 @@ public function getDocument(Request $request = null): ?Document return null; } - public function setDocument(Request $request, Document $document) + public function setDocument(Request $request, Document $document): void { $request->attributes->set(DynamicRouter::CONTENT_KEY, $document); if ($document->getProperty('language')) { diff --git a/lib/Http/Request/Resolver/OutputTimestampResolver.php b/lib/Http/Request/Resolver/OutputTimestampResolver.php index 21235eecec5..cb7a6bc126b 100644 --- a/lib/Http/Request/Resolver/OutputTimestampResolver.php +++ b/lib/Http/Request/Resolver/OutputTimestampResolver.php @@ -62,7 +62,7 @@ public function getOutputTimestamp(): int * * @param int $timestamp */ - public function setOutputTimestamp(int $timestamp) + public function setOutputTimestamp(int $timestamp): void { $this->getMainRequest()->attributes->set(self::ATTRIBUTE_PIMCORE_OUTPUT_TIMESTAMP, $timestamp); } diff --git a/lib/Http/Request/Resolver/PimcoreContextResolver.php b/lib/Http/Request/Resolver/PimcoreContextResolver.php index eecf32f3316..e180aba018c 100644 --- a/lib/Http/Request/Resolver/PimcoreContextResolver.php +++ b/lib/Http/Request/Resolver/PimcoreContextResolver.php @@ -70,7 +70,7 @@ public function getPimcoreContext(Request $request = null): ?string * @param Request $request * @param string $context */ - public function setPimcoreContext(Request $request, string $context) + public function setPimcoreContext(Request $request, string $context): void { $request->attributes->set(self::ATTRIBUTE_PIMCORE_CONTEXT, $context); } diff --git a/lib/Http/Request/Resolver/ResponseHeaderResolver.php b/lib/Http/Request/Resolver/ResponseHeaderResolver.php index bc7f25c3681..dca5dbc95e3 100644 --- a/lib/Http/Request/Resolver/ResponseHeaderResolver.php +++ b/lib/Http/Request/Resolver/ResponseHeaderResolver.php @@ -53,7 +53,7 @@ public function getResponseHeaders(Request $request = null): array * @param array|string $values * @param bool $replace */ - public function addResponseHeader(Request $request, string $key, array|string $values, bool $replace = false) + public function addResponseHeader(Request $request, string $key, array|string $values, bool $replace = false): void { // the array of headers set by the ResponseHeader annotation $responseHeaders = $this->getResponseHeaders($request); diff --git a/lib/Http/Request/Resolver/SiteResolver.php b/lib/Http/Request/Resolver/SiteResolver.php index 5216430c6c7..1d8c01ed907 100644 --- a/lib/Http/Request/Resolver/SiteResolver.php +++ b/lib/Http/Request/Resolver/SiteResolver.php @@ -25,7 +25,7 @@ class SiteResolver extends AbstractRequestResolver const ATTRIBUTE_SITE_PATH = '_site_path'; - public function setSite(Request $request, Site $site) + public function setSite(Request $request, Site $site): void { $request->attributes->set(static::ATTRIBUTE_SITE, $site); } @@ -44,7 +44,7 @@ public function getSite(Request $request = null): ?Site return $request->attributes->get(static::ATTRIBUTE_SITE); } - public function setSitePath(Request $request, string $path) + public function setSitePath(Request $request, string $path): void { $request->attributes->set(static::ATTRIBUTE_SITE_PATH, $path); } diff --git a/lib/Http/Request/Resolver/StaticPageResolver.php b/lib/Http/Request/Resolver/StaticPageResolver.php index d78b44ef569..73ef55df0e4 100644 --- a/lib/Http/Request/Resolver/StaticPageResolver.php +++ b/lib/Http/Request/Resolver/StaticPageResolver.php @@ -31,7 +31,7 @@ public function hasStaticPageContext(Request $request): bool return $request->attributes->has(self::ATTRIBUTE_PIMCORE_STATIC_PAGE); } - public function setStaticPageContext(Request $request) + public function setStaticPageContext(Request $request): void { $request->attributes->set(self::ATTRIBUTE_PIMCORE_STATIC_PAGE, true); } diff --git a/lib/Http/Request/Resolver/TemplateResolver.php b/lib/Http/Request/Resolver/TemplateResolver.php index 1b1fc84de65..a3044777a4f 100644 --- a/lib/Http/Request/Resolver/TemplateResolver.php +++ b/lib/Http/Request/Resolver/TemplateResolver.php @@ -38,7 +38,7 @@ public function getTemplate(Request $request = null): ?string return $request->get(DynamicRouter::CONTENT_TEMPLATE); } - public function setTemplate(Request $request, string $template) + public function setTemplate(Request $request, string $template): void { $request->attributes->set(DynamicRouter::CONTENT_TEMPLATE, $template); } diff --git a/lib/HttpKernel/Bundle/DependentBundleInterface.php b/lib/HttpKernel/Bundle/DependentBundleInterface.php index a07debdbfaa..5d0da5f8221 100644 --- a/lib/HttpKernel/Bundle/DependentBundleInterface.php +++ b/lib/HttpKernel/Bundle/DependentBundleInterface.php @@ -34,5 +34,5 @@ interface DependentBundleInterface * * @param BundleCollection $collection */ - public static function registerDependentBundles(BundleCollection $collection); + public static function registerDependentBundles(BundleCollection $collection): void; } diff --git a/lib/HttpKernel/BundleCollection/Item.php b/lib/HttpKernel/BundleCollection/Item.php index 6d4635b64f6..8b382445666 100644 --- a/lib/HttpKernel/BundleCollection/Item.php +++ b/lib/HttpKernel/BundleCollection/Item.php @@ -51,7 +51,7 @@ public function isPimcoreBundle(): bool return $this->bundle instanceof PimcoreBundleInterface; } - public function registerDependencies(BundleCollection $collection) + public function registerDependencies(BundleCollection $collection): void { if ($this->bundle instanceof DependentBundleInterface) { $this->bundle::registerDependentBundles($collection); diff --git a/lib/HttpKernel/BundleCollection/ItemInterface.php b/lib/HttpKernel/BundleCollection/ItemInterface.php index 67a4e500140..2aaf6cc7795 100644 --- a/lib/HttpKernel/BundleCollection/ItemInterface.php +++ b/lib/HttpKernel/BundleCollection/ItemInterface.php @@ -37,10 +37,8 @@ public function getEnvironments(): array; /** * Registers dependent bundles if the bundle implements DependentBundleInterface - * - * @param BundleCollection $collection */ - public function registerDependencies(BundleCollection $collection); + public function registerDependencies(BundleCollection $collection): void; public function matchesEnvironment(string $environment): bool; diff --git a/lib/HttpKernel/BundleCollection/LazyLoadedItem.php b/lib/HttpKernel/BundleCollection/LazyLoadedItem.php index 0ce0bbbc3f1..71b7f5a4305 100644 --- a/lib/HttpKernel/BundleCollection/LazyLoadedItem.php +++ b/lib/HttpKernel/BundleCollection/LazyLoadedItem.php @@ -78,7 +78,7 @@ public function isPimcoreBundle(): bool return self::implementsInterface($this->className, PimcoreBundleInterface::class); } - public function registerDependencies(BundleCollection $collection) + public function registerDependencies(BundleCollection $collection): void { if (self::implementsInterface($this->className, DependentBundleInterface::class)) { /** @var DependentBundleInterface $className */ diff --git a/lib/HttpKernel/CacheWarmer/MkdirCacheWarmer.php b/lib/HttpKernel/CacheWarmer/MkdirCacheWarmer.php index 3c73e20c555..da370892732 100644 --- a/lib/HttpKernel/CacheWarmer/MkdirCacheWarmer.php +++ b/lib/HttpKernel/CacheWarmer/MkdirCacheWarmer.php @@ -44,7 +44,7 @@ public function isOptional(): bool /** * {@inheritdoc} */ - public function warmUp($cacheDir): array + public function warmUp(string $cacheDir): array { $directories = [ // var diff --git a/lib/HttpKernel/CacheWarmer/PimcoreCoreCacheWarmer.php b/lib/HttpKernel/CacheWarmer/PimcoreCoreCacheWarmer.php index 57e3506d127..aca7d5a3587 100644 --- a/lib/HttpKernel/CacheWarmer/PimcoreCoreCacheWarmer.php +++ b/lib/HttpKernel/CacheWarmer/PimcoreCoreCacheWarmer.php @@ -37,7 +37,7 @@ public function isOptional(): bool /** * {@inheritdoc} */ - public function warmUp($cacheDir): array + public function warmUp(string $cacheDir): array { $classes = []; diff --git a/lib/Image/Adapter.php b/lib/Image/Adapter.php index f371672fcbd..0b79fd064c8 100644 --- a/lib/Image/Adapter.php +++ b/lib/Image/Adapter.php @@ -326,7 +326,7 @@ abstract public function save(string $path, string $format = null, int $quality /** * @abstract */ - abstract protected function destroy(); + abstract protected function destroy(): void; abstract public function getContentOptimizedFormat(): string; diff --git a/lib/Image/Adapter/GD.php b/lib/Image/Adapter/GD.php index fd125f60931..ad575697575 100644 --- a/lib/Image/Adapter/GD.php +++ b/lib/Image/Adapter/GD.php @@ -134,7 +134,7 @@ private function hasAlphaChannel(): bool /** * {@inheritdoc} */ - protected function destroy() + protected function destroy(): void { if ($this->resource) { imagedestroy($this->resource); diff --git a/lib/Image/Adapter/Imagick.php b/lib/Image/Adapter/Imagick.php index 3150f606a66..0308f55354c 100644 --- a/lib/Image/Adapter/Imagick.php +++ b/lib/Image/Adapter/Imagick.php @@ -306,7 +306,7 @@ private function checkPreserveAnimation(string $format = '', \Imagick $i = null, /** * {@inheritdoc} */ - protected function destroy() + protected function destroy(): void { if ($this->resource) { $this->resource->clear(); @@ -419,7 +419,7 @@ private function setColorspaceToRGB(): static * * @internal */ - public static function setCMYKColorProfile(string $CMYKColorProfile) + public static function setCMYKColorProfile(string $CMYKColorProfile): void { self::$CMYKColorProfile = $CMYKColorProfile; } @@ -451,7 +451,7 @@ public static function getCMYKColorProfile(): string * @internal * */ - public static function setRGBColorProfile(string $RGBColorProfile) + public static function setRGBColorProfile(string $RGBColorProfile): void { self::$RGBColorProfile = $RGBColorProfile; } @@ -663,7 +663,7 @@ public function roundCorners(int $width, int $height): static /** * Workaround for Imagick PHP extension v3.4.4 which removed Imagick::roundCorners */ - private function internalRoundCorners(int $width, int $height) + private function internalRoundCorners(int $width, int $height): void { $imageWidth = $this->resource->getImageWidth(); $imageHeight = $this->resource->getImageHeight(); @@ -839,7 +839,7 @@ public function sepia(): static return $this; } - public function sharpen($radius = 0, $sigma = 1.0, $amount = 1.0, $threshold = 0.05): static + public function sharpen(float $radius = 0, float $sigma = 1.0, float $amount = 1.0, float $threshold = 0.05): static { $this->preModify(); $this->resource->normalizeImage(); @@ -882,7 +882,7 @@ public function mirror(string $mode): static return $this; } - public function isVectorGraphic($imagePath = null): bool + public function isVectorGraphic(?string $imagePath = null): bool { if (!$imagePath) { $imagePath = $this->imagePath; diff --git a/lib/Image/ImageOptimizerInterface.php b/lib/Image/ImageOptimizerInterface.php index 0713477e0c7..805b3cd04ce 100644 --- a/lib/Image/ImageOptimizerInterface.php +++ b/lib/Image/ImageOptimizerInterface.php @@ -20,7 +20,7 @@ interface ImageOptimizerInterface { - public function optimizeImage(string $path); + public function optimizeImage(string $path): void; - public function registerOptimizer(OptimizerInterface $optimizer); + public function registerOptimizer(OptimizerInterface $optimizer): void; } diff --git a/lib/Image/Optimizer.php b/lib/Image/Optimizer.php index bbc07786232..23624cd9402 100644 --- a/lib/Image/Optimizer.php +++ b/lib/Image/Optimizer.php @@ -28,7 +28,7 @@ class Optimizer implements ImageOptimizerInterface */ private array $optimizers = []; - public function optimizeImage(string $path) + public function optimizeImage(string $path): void { $extension = File::getFileExtension($path); $storage = Storage::get('thumbnail'); @@ -80,7 +80,7 @@ public function optimizeImage(string $path) } } - public function registerOptimizer(OptimizerInterface $optimizer) + public function registerOptimizer(OptimizerInterface $optimizer): void { if (in_array($optimizer, $this->optimizers)) { throw new \InvalidArgumentException(sprintf('Optimizer of class %s has already been registered', diff --git a/lib/Kernel.php b/lib/Kernel.php index e0746dec9df..ece824ddeab 100644 --- a/lib/Kernel.php +++ b/lib/Kernel.php @@ -123,7 +123,7 @@ protected function configureRoutes(RoutingConfigurator $routes): void /** * {@inheritdoc} */ - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $bundleConfigLocator = new BundleConfigLocator($this); foreach ($bundleConfigLocator->locate('config') as $bundleConfig) { @@ -198,7 +198,7 @@ public function registerContainerConfiguration(LoaderInterface $loader) /** * {@inheritdoc} */ - public function boot() + public function boot(): void { if (true === $this->booted) { // make sure container reset is handled properly @@ -216,7 +216,7 @@ public function boot() /** * {@inheritdoc} */ - public function shutdown() + public function shutdown(): void { if (true === $this->booted) { // cleanup runtime cache, doctrine, monolog ... to free some memory and avoid locking issues @@ -229,7 +229,7 @@ public function shutdown() /** * {@inheritdoc} */ - protected function initializeContainer() + protected function initializeContainer(): void { parent::initializeContainer(); @@ -309,7 +309,7 @@ public function getBundleCollection(): BundleCollection * * @param BundleCollection $collection */ - protected function registerCoreBundlesToCollection(BundleCollection $collection) + protected function registerCoreBundlesToCollection(BundleCollection $collection): void { $collection->addBundles([ // symfony "core"/standard @@ -357,14 +357,14 @@ protected function getEnvironmentsForDevBundles(): array * * @param BundleCollection $collection */ - public function registerBundlesToCollection(BundleCollection $collection) + public function registerBundlesToCollection(BundleCollection $collection): void { } /** * Handle system settings and requirements */ - protected function setSystemRequirements() + protected function setSystemRequirements(): void { // try to set system-internal variables $maxExecutionTime = 240; diff --git a/lib/Loader/ImplementationLoader/ImplementationLoader.php b/lib/Loader/ImplementationLoader/ImplementationLoader.php index 2e612a9ac97..cc0fb5acc33 100644 --- a/lib/Loader/ImplementationLoader/ImplementationLoader.php +++ b/lib/Loader/ImplementationLoader/ImplementationLoader.php @@ -54,7 +54,7 @@ private function setLoaders(array $loaders): void } } - public function addLoader(LoaderInterface $loader) + public function addLoader(LoaderInterface $loader): void { $this->loaders[] = $loader; } diff --git a/lib/Localization/IntlFormatter.php b/lib/Localization/IntlFormatter.php index f50276cd1a5..f1ce7845284 100644 --- a/lib/Localization/IntlFormatter.php +++ b/lib/Localization/IntlFormatter.php @@ -86,7 +86,7 @@ public function setLocale(string $locale): void $this->currencyFormatters = []; } - public function getCurrencyFormat($locale): string + public function getCurrencyFormat(string $locale): string { return $this->currencyFormats[$locale]; } diff --git a/lib/Localization/LocaleService.php b/lib/Localization/LocaleService.php index 7fe251b3194..6d803b6af6b 100644 --- a/lib/Localization/LocaleService.php +++ b/lib/Localization/LocaleService.php @@ -107,7 +107,7 @@ public function getLocale(): ?string return $this->locale; } - public function setLocale(?string $locale) + public function setLocale(?string $locale): void { $this->locale = $locale; diff --git a/lib/Localization/LocaleServiceInterface.php b/lib/Localization/LocaleServiceInterface.php index 9fbb5b84f45..8488b987ded 100644 --- a/lib/Localization/LocaleServiceInterface.php +++ b/lib/Localization/LocaleServiceInterface.php @@ -33,7 +33,7 @@ public function getDisplayRegions(string $locale = null): array; public function getLocale(): ?string; - public function setLocale(?string $locale); + public function setLocale(?string $locale): void; public function hasLocale(): bool; } diff --git a/lib/Log/ApplicationLogger.php b/lib/Log/ApplicationLogger.php index 3b8647bb9db..d8dd10f1c0c 100644 --- a/lib/Log/ApplicationLogger.php +++ b/lib/Log/ApplicationLogger.php @@ -59,7 +59,7 @@ public static function getInstance(string $component = 'default', bool $initDbHa return $logger; } - public function addWriter(object $writer) + public function addWriter(object $writer): void { if ($writer instanceof \Monolog\Handler\HandlerInterface) { if (!isset($this->loggers['default-monolog'])) { @@ -72,7 +72,7 @@ public function addWriter(object $writer) } } - public function setComponent(string $component) + public function setComponent(string $component): void { $this->component = $component; } @@ -83,7 +83,7 @@ public function setComponent(string $component) * @deprecated * */ - public function setFileObject(FileObject|string $fileObject) + public function setFileObject(FileObject|string $fileObject): void { $this->fileObject = $fileObject; } @@ -93,7 +93,7 @@ public function setFileObject(FileObject|string $fileObject) * * @deprecated */ - public function setRelatedObject(\Pimcore\Model\Asset|int|\Pimcore\Model\Document|\Pimcore\Model\DataObject\AbstractObject $relatedObject) + public function setRelatedObject(\Pimcore\Model\Asset|int|\Pimcore\Model\Document|\Pimcore\Model\DataObject\AbstractObject $relatedObject): void { $this->relatedObject = $relatedObject; @@ -309,7 +309,7 @@ public function debug($message, array $context = []): void $this->handleLog('debug', $message, func_get_args()); } - protected function handleLog(mixed $level, string $message, array $params) + protected function handleLog(mixed $level, string $message, array $params): void { $context = []; @@ -344,7 +344,7 @@ protected function handleLog(mixed $level, string $message, array $params) * @param \Pimcore\Model\DataObject\AbstractObject|null $relatedObject * @param string|null $component */ - public function logException(string $message, \Throwable $exceptionObject, ?string $priority = 'alert', \Pimcore\Model\DataObject\AbstractObject $relatedObject = null, string $component = null) + public function logException(string $message, \Throwable $exceptionObject, ?string $priority = 'alert', \Pimcore\Model\DataObject\AbstractObject $relatedObject = null, string $component = null): void { if (is_null($priority)) { $priority = 'alert'; @@ -372,7 +372,7 @@ public static function logExceptionObject( int|string|Level $level = Level::Alert, \Pimcore\Model\DataObject\AbstractObject $relatedObject = null, array $context = [] - ) { + ): void { $message .= ' : ' . $exception->getMessage(); $fileObject = self::createExceptionFileObject($exception); diff --git a/lib/Mail.php b/lib/Mail.php index fd057fd942b..fa2e6693234 100644 --- a/lib/Mail.php +++ b/lib/Mail.php @@ -165,7 +165,7 @@ public function __construct($headers = null, $body = null, string $contentType = * * @internal */ - public function init(string $type = 'email') + public function init(string $type = 'email'): void { $config = Config::getSystemConfiguration($type); @@ -352,7 +352,7 @@ public function getParam(int|string $key): mixed * * @param bool $value */ - public static function setForceDebugMode(bool $value) + public static function setForceDebugMode(bool $value): void { self::$forceDebugMode = $value; } @@ -840,7 +840,7 @@ public function getOriginalData(): ?array * * @internal */ - public function setOriginalData(?array $originalData) + public function setOriginalData(?array $originalData): void { $this->originalData = $originalData; } @@ -882,7 +882,7 @@ private function formatAddress(Address|string|array ...$addresses): array * * @return $this */ - public function addTo(...$addresses): static + public function addTo(Address|string ...$addresses): static { $addresses = $this->formatAddress(...$addresses); @@ -894,7 +894,7 @@ public function addTo(...$addresses): static * * @return $this */ - public function addCc(...$addresses): static + public function addCc(Address|string ...$addresses): static { $addresses = $this->formatAddress(...$addresses); @@ -906,7 +906,7 @@ public function addCc(...$addresses): static * * @return $this */ - public function addBcc(...$addresses): static + public function addBcc(Address|string ...$addresses): static { $addresses = $this->formatAddress(...$addresses); @@ -918,7 +918,7 @@ public function addBcc(...$addresses): static * * @return $this */ - public function addFrom(...$addresses): static + public function addFrom(Address|string ...$addresses): static { $addresses = $this->formatAddress(...$addresses); @@ -930,7 +930,7 @@ public function addFrom(...$addresses): static * * @return $this */ - public function addReplyTo(...$addresses): static + public function addReplyTo(Address|string ...$addresses): static { $addresses = $this->formatAddress(...$addresses); diff --git a/lib/Mail/Plugins/RedirectingPlugin.php b/lib/Mail/Plugins/RedirectingPlugin.php index e03b44dcf81..df6f0a6c315 100644 --- a/lib/Mail/Plugins/RedirectingPlugin.php +++ b/lib/Mail/Plugins/RedirectingPlugin.php @@ -102,8 +102,6 @@ public function beforeSendPerformed(Mail $message): void /** * Invoked immediately after the Message is sent. - * - * @param Mail $message */ public function sendPerformed(Mail $message): void { @@ -163,7 +161,7 @@ private function appendDebugInformation(Mail $message): void /** * Sets the sender and receiver information of the mail to keep the log searchable for the original data. */ - private function setSenderAndReceiversParams($message): void + private function setSenderAndReceiversParams(Mail $message): void { $originalData = $message->getOriginalData(); diff --git a/lib/Maintenance/Executor.php b/lib/Maintenance/Executor.php index 5d7cc638bad..fe87d31f726 100644 --- a/lib/Maintenance/Executor.php +++ b/lib/Maintenance/Executor.php @@ -41,7 +41,7 @@ public function __construct( $this->logger = $logger; } - public function executeTask(string $name) + public function executeTask(string $name): void { if (!in_array($name, $this->getTaskNames(), true)) { throw new \Exception(sprintf('Task with name "%s" not found', $name)); @@ -69,7 +69,7 @@ public function executeTask(string $name) /** * {@inheritdoc} */ - public function executeMaintenance(array $validJobs = [], array $excludedJobs = []) + public function executeMaintenance(array $validJobs = [], array $excludedJobs = []): void { $this->setLastExecution(); @@ -109,7 +109,7 @@ public function getTasks(): array return $this->tasks; } - public function setLastExecution() + public function setLastExecution(): void { TmpStore::set($this->pidFileName, time()); } @@ -125,7 +125,7 @@ public function getLastExecution(): int return 0; } - public function registerTask(string $name, TaskInterface $task) + public function registerTask(string $name, TaskInterface $task): void { if (array_key_exists($name, $this->tasks)) { throw new \InvalidArgumentException(sprintf('Task with name %s has already been registered', $name)); diff --git a/lib/Maintenance/ExecutorInterface.php b/lib/Maintenance/ExecutorInterface.php index a2d37c717d0..1d0577b77c8 100644 --- a/lib/Maintenance/ExecutorInterface.php +++ b/lib/Maintenance/ExecutorInterface.php @@ -21,21 +21,21 @@ */ interface ExecutorInterface { - public function executeTask(string $name); + public function executeTask(string $name): void; /** * Execute the Maintenance Task * - * @param array $validJobs - * @param array $excludedJobs + * @param string[] $validJobs + * @param string[] $excludedJobs */ - public function executeMaintenance(array $validJobs = [], array $excludedJobs = []); + public function executeMaintenance(array $validJobs = [], array $excludedJobs = []): void; - public function registerTask(string $name, TaskInterface $task); + public function registerTask(string $name, TaskInterface $task): void; public function getTaskNames(): array; public function getLastExecution(): int; - public function setLastExecution(); + public function setLastExecution(): void; } diff --git a/lib/Maintenance/TaskInterface.php b/lib/Maintenance/TaskInterface.php index 9febdbc3d62..66c1defa607 100644 --- a/lib/Maintenance/TaskInterface.php +++ b/lib/Maintenance/TaskInterface.php @@ -21,5 +21,5 @@ interface TaskInterface /** * Execute the Task */ - public function execute(); + public function execute(): void; } diff --git a/lib/Maintenance/Tasks/CleanupBrickTablesTask.php b/lib/Maintenance/Tasks/CleanupBrickTablesTask.php index bf749b6ab72..fe144f1b1c1 100644 --- a/lib/Maintenance/Tasks/CleanupBrickTablesTask.php +++ b/lib/Maintenance/Tasks/CleanupBrickTablesTask.php @@ -37,7 +37,7 @@ public function __construct(LoggerInterface $logger) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $db = Db::get(); $tableTypes = ['store', 'query', 'localized']; diff --git a/lib/Maintenance/Tasks/CleanupClassificationstoreTablesTask.php b/lib/Maintenance/Tasks/CleanupClassificationstoreTablesTask.php index 262ffc6d2ed..5e9c96b234d 100644 --- a/lib/Maintenance/Tasks/CleanupClassificationstoreTablesTask.php +++ b/lib/Maintenance/Tasks/CleanupClassificationstoreTablesTask.php @@ -36,7 +36,7 @@ public function __construct(LoggerInterface $logger) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $db = Db::get(); $tableTypes = ['object_classificationstore_data', 'object_classificationstore_groups']; diff --git a/lib/Maintenance/Tasks/CleanupFieldcollectionTablesTask.php b/lib/Maintenance/Tasks/CleanupFieldcollectionTablesTask.php index 03f34a8b043..8b2d6663b09 100644 --- a/lib/Maintenance/Tasks/CleanupFieldcollectionTablesTask.php +++ b/lib/Maintenance/Tasks/CleanupFieldcollectionTablesTask.php @@ -36,7 +36,7 @@ public function __construct(LoggerInterface $logger) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $db = Db::get(); $tasks = [ diff --git a/lib/Maintenance/Tasks/DbCleanupBrokenViewsTask.php b/lib/Maintenance/Tasks/DbCleanupBrokenViewsTask.php index e75c0f5ef21..a7cb5f1a4a4 100644 --- a/lib/Maintenance/Tasks/DbCleanupBrokenViewsTask.php +++ b/lib/Maintenance/Tasks/DbCleanupBrokenViewsTask.php @@ -38,7 +38,7 @@ public function __construct(Connection $db, LoggerInterface $logger) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $tables = $this->db->fetchAllAssociative('SHOW FULL TABLES'); foreach ($tables as $table) { diff --git a/lib/Maintenance/Tasks/FullTextIndexOptimizeTask.php b/lib/Maintenance/Tasks/FullTextIndexOptimizeTask.php index 2f236c27851..c94d0eb797b 100644 --- a/lib/Maintenance/Tasks/FullTextIndexOptimizeTask.php +++ b/lib/Maintenance/Tasks/FullTextIndexOptimizeTask.php @@ -37,7 +37,7 @@ public function __construct(LockFactory $lockFactory) * * @throws \Doctrine\DBAL\Exception */ - public function execute() + public function execute(): void { if ($this->lock->acquire(false)) { Db::get()->fetchAllAssociative('OPTIMIZE TABLE search_backend_data'); diff --git a/lib/Maintenance/Tasks/HousekeepingTask.php b/lib/Maintenance/Tasks/HousekeepingTask.php index b19bcd58e45..701c903115a 100644 --- a/lib/Maintenance/Tasks/HousekeepingTask.php +++ b/lib/Maintenance/Tasks/HousekeepingTask.php @@ -36,7 +36,7 @@ public function __construct(int $tmpFileTime, int $profilerTime) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { foreach (['dev'] as $environment) { $profilerDir = sprintf('%s/%s/profiler', PIMCORE_SYMFONY_CACHE_DIRECTORY, $environment); diff --git a/lib/Maintenance/Tasks/LogArchiveTask.php b/lib/Maintenance/Tasks/LogArchiveTask.php index d3b89585ae7..eca7df8109d 100644 --- a/lib/Maintenance/Tasks/LogArchiveTask.php +++ b/lib/Maintenance/Tasks/LogArchiveTask.php @@ -46,7 +46,7 @@ public function __construct(Connection $db, Config $config, LoggerInterface $log /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $db = $this->db; $storage = Storage::get('application_log'); diff --git a/lib/Maintenance/Tasks/LogCleanupTask.php b/lib/Maintenance/Tasks/LogCleanupTask.php index 06c37d71013..3da351e37d0 100644 --- a/lib/Maintenance/Tasks/LogCleanupTask.php +++ b/lib/Maintenance/Tasks/LogCleanupTask.php @@ -27,7 +27,7 @@ class LogCleanupTask implements TaskInterface /** * {@inheritdoc} */ - public function execute() + public function execute(): void { // we don't use the RotatingFileHandler of Monolog, since rotating asynchronously is recommended + compression $logFiles = glob(PIMCORE_LOG_DIRECTORY.'/*.log'); diff --git a/lib/Maintenance/Tasks/LogErrorCleanupTask.php b/lib/Maintenance/Tasks/LogErrorCleanupTask.php index 8d980cb806d..c1d9d9b7134 100644 --- a/lib/Maintenance/Tasks/LogErrorCleanupTask.php +++ b/lib/Maintenance/Tasks/LogErrorCleanupTask.php @@ -34,7 +34,7 @@ public function __construct(Connection $db) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { // keep the history for max. 7 days (=> exactly 144h), according to the privacy policy (EU/German Law) // it's allowed to store the IP for 7 days for security reasons (DoS, ...) diff --git a/lib/Maintenance/Tasks/LogMailMaintenanceTask.php b/lib/Maintenance/Tasks/LogMailMaintenanceTask.php index fc7183ebb06..ddf2a3d266f 100644 --- a/lib/Maintenance/Tasks/LogMailMaintenanceTask.php +++ b/lib/Maintenance/Tasks/LogMailMaintenanceTask.php @@ -40,7 +40,7 @@ public function __construct(Connection $db, Config $config) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $db = $this->db; diff --git a/lib/Maintenance/Tasks/LowQualityImagePreviewTask.php b/lib/Maintenance/Tasks/LowQualityImagePreviewTask.php index 39619180ab5..c32adf6b98f 100644 --- a/lib/Maintenance/Tasks/LowQualityImagePreviewTask.php +++ b/lib/Maintenance/Tasks/LowQualityImagePreviewTask.php @@ -40,7 +40,7 @@ public function __construct(LoggerInterface $logger, LockFactory $lockFactory) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { if (date('H') <= 4 && $this->lock->acquire()) { // execution should be only sometime between 0:00 and 4:59 -> less load expected diff --git a/lib/Maintenance/Tasks/RedirectCleanupTask.php b/lib/Maintenance/Tasks/RedirectCleanupTask.php index 857fe62046b..e6d6545a8c6 100644 --- a/lib/Maintenance/Tasks/RedirectCleanupTask.php +++ b/lib/Maintenance/Tasks/RedirectCleanupTask.php @@ -27,7 +27,7 @@ class RedirectCleanupTask implements TaskInterface /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $list = new Redirect\Listing(); $list->setCondition('active = 1 AND expiry < '.time()." AND expiry IS NOT NULL AND expiry != ''"); diff --git a/lib/Maintenance/Tasks/ScheduledTasksTask.php b/lib/Maintenance/Tasks/ScheduledTasksTask.php index fe1ce737203..4c011837a22 100644 --- a/lib/Maintenance/Tasks/ScheduledTasksTask.php +++ b/lib/Maintenance/Tasks/ScheduledTasksTask.php @@ -40,7 +40,7 @@ public function __construct(LoggerInterface $logger) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $list = new Listing(); $list->setCondition('active = 1 AND date < ?', time()); diff --git a/lib/Maintenance/Tasks/StaticPagesGenerationTask.php b/lib/Maintenance/Tasks/StaticPagesGenerationTask.php index a8ef853c4ca..0b65a1de90d 100644 --- a/lib/Maintenance/Tasks/StaticPagesGenerationTask.php +++ b/lib/Maintenance/Tasks/StaticPagesGenerationTask.php @@ -39,7 +39,7 @@ public function __construct(StaticPageGenerator $generator, LoggerInterface $log /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $listing = new Document\Listing(); $listing->setCondition("`type` = 'page'"); diff --git a/lib/Maintenance/Tasks/TmpStoreCleanupTask.php b/lib/Maintenance/Tasks/TmpStoreCleanupTask.php index d9d38276ec3..01cd8d18a16 100644 --- a/lib/Maintenance/Tasks/TmpStoreCleanupTask.php +++ b/lib/Maintenance/Tasks/TmpStoreCleanupTask.php @@ -34,7 +34,7 @@ public function __construct(Connection $db) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $this->db->executeQuery('DELETE FROM tmp_store WHERE `expiryDate` < :time', ['time' => time()]); } diff --git a/lib/Maintenance/Tasks/VersionsCleanupStackTraceDbTask.php b/lib/Maintenance/Tasks/VersionsCleanupStackTraceDbTask.php index dc61f30c6c5..5a89fc3fdf4 100644 --- a/lib/Maintenance/Tasks/VersionsCleanupStackTraceDbTask.php +++ b/lib/Maintenance/Tasks/VersionsCleanupStackTraceDbTask.php @@ -27,7 +27,7 @@ class VersionsCleanupStackTraceDbTask implements TaskInterface /** * {@inheritdoc} */ - public function execute() + public function execute(): void { Db::get()->executeStatement( 'UPDATE versions SET stackTrace = NULL WHERE date < ? AND stackTrace IS NOT NULL', diff --git a/lib/Maintenance/Tasks/VersionsCleanupTask.php b/lib/Maintenance/Tasks/VersionsCleanupTask.php index 78b09edce39..2a2c2307fd1 100644 --- a/lib/Maintenance/Tasks/VersionsCleanupTask.php +++ b/lib/Maintenance/Tasks/VersionsCleanupTask.php @@ -43,7 +43,7 @@ public function __construct(LoggerInterface $logger, Config $config) /** * {@inheritdoc} */ - public function execute() + public function execute(): void { $this->doVersionCleanup(); $this->doAutoSaveVersionCleanup(); diff --git a/lib/Messenger/Handler/AssetPreviewImageHandler.php b/lib/Messenger/Handler/AssetPreviewImageHandler.php index 33bc25d4d3c..6b173e5ebbb 100644 --- a/lib/Messenger/Handler/AssetPreviewImageHandler.php +++ b/lib/Messenger/Handler/AssetPreviewImageHandler.php @@ -34,7 +34,7 @@ public function __construct(protected LoggerInterface $logger) { } - public function __invoke(AssetPreviewImageMessage $message, Acknowledger $ack = null) + public function __invoke(AssetPreviewImageMessage $message, Acknowledger $ack = null): mixed { return $this->handle($message, $ack); } diff --git a/lib/Messenger/Handler/CleanupThumbnailsHandler.php b/lib/Messenger/Handler/CleanupThumbnailsHandler.php index 628b45f0c6d..6f5973d818b 100644 --- a/lib/Messenger/Handler/CleanupThumbnailsHandler.php +++ b/lib/Messenger/Handler/CleanupThumbnailsHandler.php @@ -30,7 +30,7 @@ class CleanupThumbnailsHandler implements BatchHandlerInterface use BatchHandlerTrait; use HandlerHelperTrait; - public function __invoke(CleanupThumbnailsMessage $message, Acknowledger $ack = null) + public function __invoke(CleanupThumbnailsMessage $message, Acknowledger $ack = null): mixed { return $this->handle($message, $ack); } diff --git a/lib/Messenger/Handler/OptimizeImageHandler.php b/lib/Messenger/Handler/OptimizeImageHandler.php index 47d0e87a8f3..c8f16449e4e 100644 --- a/lib/Messenger/Handler/OptimizeImageHandler.php +++ b/lib/Messenger/Handler/OptimizeImageHandler.php @@ -35,7 +35,7 @@ public function __construct(protected ImageOptimizerInterface $optimizer, protec { } - public function __invoke(OptimizeImageMessage $message, Acknowledger $ack = null) + public function __invoke(OptimizeImageMessage $message, Acknowledger $ack = null): mixed { return $this->handle($message, $ack); } diff --git a/lib/Messenger/Handler/SanityCheckHandler.php b/lib/Messenger/Handler/SanityCheckHandler.php index cf5a0086365..5378122ac97 100644 --- a/lib/Messenger/Handler/SanityCheckHandler.php +++ b/lib/Messenger/Handler/SanityCheckHandler.php @@ -34,7 +34,7 @@ class SanityCheckHandler implements BatchHandlerInterface use BatchHandlerTrait; use HandlerHelperTrait; - public function __invoke(SanityCheckMessage $message, Acknowledger $ack = null) + public function __invoke(SanityCheckMessage $message, Acknowledger $ack = null): mixed { return $this->handle($message, $ack); } diff --git a/lib/Messenger/Handler/SearchBackendHandler.php b/lib/Messenger/Handler/SearchBackendHandler.php index 787008694db..6ad4222a54a 100644 --- a/lib/Messenger/Handler/SearchBackendHandler.php +++ b/lib/Messenger/Handler/SearchBackendHandler.php @@ -31,7 +31,7 @@ class SearchBackendHandler implements BatchHandlerInterface use BatchHandlerTrait; use HandlerHelperTrait; - public function __invoke(SearchBackendMessage $message, Acknowledger $ack = null) + public function __invoke(SearchBackendMessage $message, Acknowledger $ack = null): mixed { return $this->handle($message, $ack); } diff --git a/lib/Messenger/Handler/VersionDeleteHandler.php b/lib/Messenger/Handler/VersionDeleteHandler.php index bda5466ceaf..db032428717 100644 --- a/lib/Messenger/Handler/VersionDeleteHandler.php +++ b/lib/Messenger/Handler/VersionDeleteHandler.php @@ -30,7 +30,7 @@ class VersionDeleteHandler implements BatchHandlerInterface { use BatchHandlerTrait; - public function __invoke(VersionDeleteMessage $message, Acknowledger $ack = null) + public function __invoke(VersionDeleteMessage $message, Acknowledger $ack = null): mixed { return $this->handle($message, $ack); } diff --git a/lib/Model/AbstractModel.php b/lib/Model/AbstractModel.php index 69a490b67b3..40bfa4a70d4 100644 --- a/lib/Model/AbstractModel.php +++ b/lib/Model/AbstractModel.php @@ -61,12 +61,9 @@ public function setDao(?AbstractDao $dao): static } /** - * @param string|null $key - * @param bool $forceDetection - * * @throws \Exception */ - public function initDao(string $key = null, bool $forceDetection = false) + public function initDao(string $key = null, bool $forceDetection = false): void { $myClass = get_class($this); $cacheKey = $myClass . ($key ? ('-' . $key) : ''); @@ -201,7 +198,7 @@ public function setValue(string $key, mixed $value, bool $ignoreEmptyValues = fa /** * @return array */ - public function __sleep() + public function __sleep(): array { $blockedVars = ['dao', 'dirtyFields', 'activeDispatchingEvents']; @@ -211,12 +208,9 @@ public function __sleep() } /** - * @param string $method - * @param array $args - * - * @return mixed - * * @throws \Exception + * + * @return mixed|void */ public function __call(string $method, array $args) { @@ -271,7 +265,7 @@ protected static function getModelFactory(): Factory * * @throws \Exception */ - protected static function checkCreateData(array $data) + protected static function checkCreateData(array $data): void { if (isset($data['id'])) { throw new \Exception(sprintf('Calling %s including `id` key in the data-array is not supported, use setId() instead.', __METHOD__)); diff --git a/lib/Model/Dao/AbstractDao.php b/lib/Model/Dao/AbstractDao.php index fe88ba685cf..8948406932c 100644 --- a/lib/Model/Dao/AbstractDao.php +++ b/lib/Model/Dao/AbstractDao.php @@ -32,22 +32,22 @@ abstract class AbstractDao implements DaoInterface */ public $db; - public function configure() + public function configure(): void { $this->db = Db::get(); } - public function beginTransaction() + public function beginTransaction(): void { $this->db->beginTransaction(); } - public function commit() + public function commit(): void { $this->db->commit(); } - public function rollBack() + public function rollBack(): void { $this->db->rollBack(); } @@ -81,7 +81,7 @@ public function getValidTableColumns(string $table, bool $cache = true): array * * @param string $table */ - public function resetValidTableColumnsCache(string $table) + public function resetValidTableColumnsCache(string $table): void { $cacheKey = self::CACHEKEY . $table; if (RuntimeCache::isRegistered($cacheKey)) { diff --git a/lib/Model/Dao/DaoInterface.php b/lib/Model/Dao/DaoInterface.php index 27507a7fe67..f95c4fe882e 100644 --- a/lib/Model/Dao/DaoInterface.php +++ b/lib/Model/Dao/DaoInterface.php @@ -18,7 +18,10 @@ interface DaoInterface { - public function setModel(\Pimcore\Model\AbstractModel $model); + /** + * @return $this + */ + public function setModel(\Pimcore\Model\AbstractModel $model): static; - public function configure(); + public function configure(): void; } diff --git a/lib/Model/Dao/DaoTrait.php b/lib/Model/Dao/DaoTrait.php index bdabdd2cb27..85028353858 100644 --- a/lib/Model/Dao/DaoTrait.php +++ b/lib/Model/Dao/DaoTrait.php @@ -27,9 +27,6 @@ trait DaoTrait */ protected $model; - /** - * @return $this - */ public function setModel(AbstractModel $model): static { $this->model = $model; diff --git a/lib/Model/Dao/PimcoreLocationAwareConfigDao.php b/lib/Model/Dao/PimcoreLocationAwareConfigDao.php index a90b803e5bb..1ad60374c0f 100644 --- a/lib/Model/Dao/PimcoreLocationAwareConfigDao.php +++ b/lib/Model/Dao/PimcoreLocationAwareConfigDao.php @@ -32,7 +32,7 @@ abstract class PimcoreLocationAwareConfigDao implements DaoInterface private Config\LocationAwareConfigRepository $locationAwareConfigRepository; - public function configure() + public function configure(): void { $params = func_get_arg(0); $this->settingsStoreScope = $params['settingsStoreScope'] ?? 'pimcore_config'; @@ -95,7 +95,7 @@ protected function invalidateCache(string $id): void * * @throws \Exception */ - protected function saveData(string $id, array $data) + protected function saveData(string $id, array $data): void { $dao = $this; $this->invalidateCache($id); diff --git a/lib/Model/Listing/CallableFilterListingInterface.php b/lib/Model/Listing/CallableFilterListingInterface.php index 6b36bc34ed5..ec0285044ec 100644 --- a/lib/Model/Listing/CallableFilterListingInterface.php +++ b/lib/Model/Listing/CallableFilterListingInterface.php @@ -18,7 +18,7 @@ interface CallableFilterListingInterface { - public function setFilter(?callable $filter); + public function setFilter(?callable $filter): void; public function getFilter(): ?callable; } diff --git a/lib/Model/Listing/CallableOrderListingInterface.php b/lib/Model/Listing/CallableOrderListingInterface.php index 0fe35123d7e..8e77e115c38 100644 --- a/lib/Model/Listing/CallableOrderListingInterface.php +++ b/lib/Model/Listing/CallableOrderListingInterface.php @@ -18,7 +18,10 @@ interface CallableOrderListingInterface { - public function setOrder(?callable $order); + /** + * @return $this + */ + public function setOrder(?callable $order): static; public function getOrder(): ?callable; } diff --git a/lib/Model/Listing/Traits/OrderListingTrait.php b/lib/Model/Listing/Traits/OrderListingTrait.php index 49282727392..27286aaefa3 100644 --- a/lib/Model/Listing/Traits/OrderListingTrait.php +++ b/lib/Model/Listing/Traits/OrderListingTrait.php @@ -28,8 +28,10 @@ public function getOrder(): ?callable return $this->order; } - public function setOrder(?callable $order): void + public function setOrder(?callable $order): static { $this->order = $order; + + return $this; } } diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php index b3e35b0bfe1..afb9ca967de 100644 --- a/lib/Model/ModelInterface.php +++ b/lib/Model/ModelInterface.php @@ -25,12 +25,9 @@ public function getDao(): DaoInterface; public function setDao(Dao\AbstractDao $dao): static; /** - * @param string|null $key - * @param bool $forceDetection - * * @throws \Exception */ - public function initDao(string $key = null, bool $forceDetection = false); + public function initDao(string $key = null, bool $forceDetection = false): void; public function setValues(array $data = []): static; diff --git a/lib/Model/Paginator/EventSubscriber/PaginateListingSubscriber.php b/lib/Model/Paginator/EventSubscriber/PaginateListingSubscriber.php index ac88477aa6d..630566c3a39 100644 --- a/lib/Model/Paginator/EventSubscriber/PaginateListingSubscriber.php +++ b/lib/Model/Paginator/EventSubscriber/PaginateListingSubscriber.php @@ -22,7 +22,7 @@ class PaginateListingSubscriber implements EventSubscriberInterface { - public function items(ItemsEvent $event) + public function items(ItemsEvent $event): void { $paginationAdapter = $event->target; diff --git a/lib/Navigation/Container.php b/lib/Navigation/Container.php index 3c1011a8ffe..6b92d35c143 100644 --- a/lib/Navigation/Container.php +++ b/lib/Navigation/Container.php @@ -481,7 +481,7 @@ public function findBy(string $property, mixed $value, bool $all = false, bool $ * * @throws \Exception if method does not exist */ - public function __call(string $method, array $arguments) + public function __call(string $method, array $arguments): mixed { if (@preg_match('/(find(?:One|All)?By)(.+)/', $method, $match)) { return $this->{$match[1]}($match[2], $arguments[0], !empty($arguments[1])); diff --git a/lib/Navigation/Page.php b/lib/Navigation/Page.php index 09fb8ecdde8..d8d4e927fb8 100644 --- a/lib/Navigation/Page.php +++ b/lib/Navigation/Page.php @@ -882,14 +882,9 @@ public function get(string $property): mixed * * Magic overload for enabling $page->propname = $value. * - * @param string $name property name - * @param mixed $value value to set - * - * @return void - * * @throws \Exception if property name is invalid */ - public function __set(string $name, mixed $value) + public function __set(string $name, mixed $value): void { $this->set($name, $value); } @@ -1124,7 +1119,7 @@ protected static function _normalizePropertyName(string $property): string * * TODO: In Pimcore 11, deprecate/remove the IF block and mark these methods as internal in the phpdoc block */ - public static function setDefaultPageType(string $type = null) + public static function setDefaultPageType(string $type = null): void { // @phpstan-ignore-next-line if ($type !== null && !is_string($type)) { diff --git a/lib/Navigation/Page/Document.php b/lib/Navigation/Page/Document.php index 82b8f10c083..5bd99e03d79 100644 --- a/lib/Navigation/Page/Document.php +++ b/lib/Navigation/Page/Document.php @@ -99,7 +99,7 @@ public function getDocumentId(): int return $this->_documentId; } - public function setDocumentId(int $documentId) + public function setDocumentId(int $documentId): void { $this->_documentId = $documentId; } @@ -109,7 +109,7 @@ public function getDocumentType(): string return $this->documentType; } - public function setDocumentType(string $documentType) + public function setDocumentType(string $documentType): void { $this->documentType = $documentType; } @@ -119,7 +119,7 @@ public function getRealFullPath(): string return $this->realFullPath; } - public function setRealFullPath(string $realFullPath) + public function setRealFullPath(string $realFullPath): void { $this->realFullPath = $realFullPath; } diff --git a/lib/Navigation/Renderer/Menu.php b/lib/Navigation/Renderer/Menu.php index 8a5f9d9e23d..96850d13422 100644 --- a/lib/Navigation/Renderer/Menu.php +++ b/lib/Navigation/Renderer/Menu.php @@ -347,7 +347,7 @@ public function getTemplate(): array|string|null return $this->_template; } - public function setTemplate(array|string $template) + public function setTemplate(array|string $template): void { $this->_template = $template; } diff --git a/lib/Perspective/Config.php b/lib/Perspective/Config.php index 7ccc6e39b1f..b2d0862d92e 100644 --- a/lib/Perspective/Config.php +++ b/lib/Perspective/Config.php @@ -209,7 +209,7 @@ public static function getStandardPerspective(): array ]; } - public static function getRuntimePerspective(User $currentUser = null) + public static function getRuntimePerspective(User $currentUser = null): mixed { if (null === $currentUser) { $currentUser = Tool\Admin::getCurrentUser(); @@ -336,7 +336,7 @@ protected static function getRuntimeElementTreeConfig(string $name): array return $result; } - public static function getAvailablePerspectives($user): array + public static function getAvailablePerspectives(?User $user): array { $currentConfigName = null; $masterConfig = self::get(); diff --git a/lib/Routing/Dynamic/DataObjectRouteHandler.php b/lib/Routing/Dynamic/DataObjectRouteHandler.php index bba9f64d70d..06b1bd00204 100644 --- a/lib/Routing/Dynamic/DataObjectRouteHandler.php +++ b/lib/Routing/Dynamic/DataObjectRouteHandler.php @@ -58,7 +58,7 @@ public function getRouteByName(string $name): ?DataObjectRoute /** * {@inheritdoc} */ - public function matchRequest(RouteCollection $collection, DynamicRequestContext $context) + public function matchRequest(RouteCollection $collection, DynamicRequestContext $context): void { $site = $this->siteResolver->getSite($context->getRequest()); $slug = DataObject\Data\UrlSlug::resolveSlug($context->getOriginalPath(), $site ? $site->getId() : 0); diff --git a/lib/Routing/Dynamic/DocumentRouteHandler.php b/lib/Routing/Dynamic/DocumentRouteHandler.php index d8acfb54501..1ab92c60ed7 100644 --- a/lib/Routing/Dynamic/DocumentRouteHandler.php +++ b/lib/Routing/Dynamic/DocumentRouteHandler.php @@ -66,7 +66,7 @@ public function __construct( $this->staticPageResolver = $staticPageResolver; } - public function setForceHandleUnpublishedDocuments(bool $handle) + public function setForceHandleUnpublishedDocuments(bool $handle): void { $this->forceHandleUnpublishedDocuments = $handle; } @@ -86,7 +86,7 @@ public function getDirectRouteDocumentTypes(): array * * @deprecated will be removed in Pimcore 11 */ - public function addDirectRouteDocumentType(string $type) + public function addDirectRouteDocumentType(string $type): void { if (!in_array($type, $this->getDirectRouteDocumentTypes())) { $this->directRouteDocumentTypes[] = $type; @@ -112,7 +112,7 @@ public function getRouteByName(string $name): ?DocumentRoute /** * {@inheritdoc} */ - public function matchRequest(RouteCollection $collection, DynamicRequestContext $context) + public function matchRequest(RouteCollection $collection, DynamicRequestContext $context): void { $document = Document::getByPath($context->getPath()); diff --git a/lib/Routing/Dynamic/DynamicRouteHandlerInterface.php b/lib/Routing/Dynamic/DynamicRouteHandlerInterface.php index c25b9dd427d..df111990c6e 100644 --- a/lib/Routing/Dynamic/DynamicRouteHandlerInterface.php +++ b/lib/Routing/Dynamic/DynamicRouteHandlerInterface.php @@ -44,5 +44,5 @@ public function getRouteByName(string $name): ?Route; * @param RouteCollection $collection * @param DynamicRequestContext $context */ - public function matchRequest(RouteCollection $collection, DynamicRequestContext $context); + public function matchRequest(RouteCollection $collection, DynamicRequestContext $context): void; } diff --git a/lib/Routing/DynamicRouteProvider.php b/lib/Routing/DynamicRouteProvider.php index 2ace8d4a76b..70fbfb9bfb8 100644 --- a/lib/Routing/DynamicRouteProvider.php +++ b/lib/Routing/DynamicRouteProvider.php @@ -50,7 +50,7 @@ public function __construct(SiteResolver $siteResolver, array $handlers = []) } } - public function addHandler(DynamicRouteHandlerInterface $handler) + public function addHandler(DynamicRouteHandlerInterface $handler): void { if (!in_array($handler, $this->handlers, true)) { $this->handlers[] = $handler; @@ -85,7 +85,7 @@ public function getRouteCollectionForRequest(Request $request): RouteCollection /** * {@inheritdoc} */ - public function getRouteByName($name): SymfonyRoute + public function getRouteByName(string $name): SymfonyRoute { foreach ($this->handlers as $handler) { try { diff --git a/lib/Routing/Element/Router.php b/lib/Routing/Element/Router.php index 926d0ea856c..02ee37fbed4 100644 --- a/lib/Routing/Element/Router.php +++ b/lib/Routing/Element/Router.php @@ -48,7 +48,7 @@ public function __construct(RequestContext $context, RequestHelper $requestHelpe /** * {@inheritdoc} */ - public function setContext(RequestContext $context) + public function setContext(RequestContext $context): void { $this->context = $context; } @@ -68,7 +68,7 @@ public function getContext(): RequestContext * * @return bool */ - public function supports($name): bool + public function supports(string $name): bool { return $name === 'pimcore_element'; } @@ -79,7 +79,7 @@ public function supports($name): bool * * @return string */ - public function getRouteDebugMessage($name, array $parameters = []): string + public function getRouteDebugMessage(string $name, array $parameters = []): string { $element = $parameters['element'] ?? null; if ($element instanceof ElementInterface) { @@ -193,7 +193,7 @@ public function matchRequest(Request $request): array * * @return array */ - public function match($pathinfo): array + public function match(string $pathinfo): array { throw new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo)); } diff --git a/lib/Routing/Loader/BundleRoutingLoader.php b/lib/Routing/Loader/BundleRoutingLoader.php index d8f4c31bcf6..a865b9d427a 100644 --- a/lib/Routing/Loader/BundleRoutingLoader.php +++ b/lib/Routing/Loader/BundleRoutingLoader.php @@ -35,7 +35,7 @@ public function __construct(BundleConfigLocator $locator) /** * {@inheritdoc} */ - public function load($resource, $type = null): mixed + public function load(mixed $resource, string $type = null): mixed { $collection = new RouteCollection(); $files = $this->locator->locate('routing'); @@ -55,7 +55,7 @@ public function load($resource, $type = null): mixed /** * {@inheritdoc} */ - public function supports($resource, $type = null): bool + public function supports(mixed $resource, string $type = null): bool { return 'pimcore_bundle' === $type; } diff --git a/lib/Routing/Staticroute/Router.php b/lib/Routing/Staticroute/Router.php index 9b0a0632f32..f838a252d40 100644 --- a/lib/Routing/Staticroute/Router.php +++ b/lib/Routing/Staticroute/Router.php @@ -67,7 +67,7 @@ public function __construct(RequestContext $context, Config $config) /** * {@inheritdoc} */ - public function setContext(RequestContext $context) + public function setContext(RequestContext $context): void { $this->context = $context; } @@ -85,7 +85,7 @@ public function getLocaleParams(): array return $this->localeParams; } - public function setLocaleParams(array $localeParams) + public function setLocaleParams(array $localeParams): void { $this->localeParams = $localeParams; } @@ -93,7 +93,7 @@ public function setLocaleParams(array $localeParams) /** * {@inheritdoc} */ - public function supports($name): bool + public function supports(string $name): bool { return is_string($name) && in_array($name, $this->getSupportedNames()); } @@ -109,9 +109,9 @@ public function getRouteCollection(): RouteCollection /** * {@inheritdoc} */ - public function getRouteDebugMessage($name, array $parameters = []): string + public function getRouteDebugMessage(string $name, array $parameters = []): string { - return (string)$name; + return $name; } /** @@ -210,7 +210,7 @@ public function matchRequest(Request $request): array * * @return array */ - public function match($pathinfo): array + public function match(string $pathinfo): array { return $this->doMatch($pathinfo); } diff --git a/lib/Security/Hasher/AbstractUserAwarePasswordHasher.php b/lib/Security/Hasher/AbstractUserAwarePasswordHasher.php index 67e632c7aa5..d60c502774b 100644 --- a/lib/Security/Hasher/AbstractUserAwarePasswordHasher.php +++ b/lib/Security/Hasher/AbstractUserAwarePasswordHasher.php @@ -30,7 +30,7 @@ abstract class AbstractUserAwarePasswordHasher extends PlaintextPasswordHasher i /** * {@inheritdoc} */ - public function setUser(UserInterface $user) + public function setUser(UserInterface $user): void { if ($this->user) { throw new RuntimeException('User was already set and can\'t be overwritten'); diff --git a/lib/Security/Hasher/Factory/UserAwarePasswordHasherFactory.php b/lib/Security/Hasher/Factory/UserAwarePasswordHasherFactory.php index 084b1840f80..8c53fac37ef 100644 --- a/lib/Security/Hasher/Factory/UserAwarePasswordHasherFactory.php +++ b/lib/Security/Hasher/Factory/UserAwarePasswordHasherFactory.php @@ -18,7 +18,9 @@ use Pimcore\Security\Exception\ConfigurationException; use Pimcore\Security\Hasher\UserAwarePasswordHasherInterface; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; /** @@ -46,7 +48,7 @@ class UserAwarePasswordHasherFactory extends AbstractHasherFactory /** * {@inheritdoc} */ - public function getPasswordHasher($user): PasswordHasherInterface + public function getPasswordHasher(string|PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user): PasswordHasherInterface { if (!$user instanceof UserInterface) { throw new \RuntimeException(sprintf( diff --git a/lib/Security/Hasher/PasswordFieldHasher.php b/lib/Security/Hasher/PasswordFieldHasher.php index 75253b76301..63c32ec46bd 100644 --- a/lib/Security/Hasher/PasswordFieldHasher.php +++ b/lib/Security/Hasher/PasswordFieldHasher.php @@ -31,7 +31,7 @@ class PasswordFieldHasher extends AbstractUserAwarePasswordHasher { use CheckPasswordLengthTrait; - protected string $fieldName = 'password'; + protected string $fieldName; /** * If true, the user password hash will be updated if necessary. @@ -40,10 +40,7 @@ class PasswordFieldHasher extends AbstractUserAwarePasswordHasher */ protected bool $updateHash = true; - /** - * @param string $fieldName - */ - public function __construct($fieldName) + public function __construct(string $fieldName = 'password') { $this->fieldName = $fieldName; } @@ -53,12 +50,12 @@ public function getUpdateHash(): bool return $this->updateHash; } - public function setUpdateHash(bool $updateHash) + public function setUpdateHash(bool $updateHash): void { $this->updateHash = (bool)$updateHash; } - public function hashPassword($raw, $salt): string + public function hashPassword(string $raw, ?string $salt): string { if ($this->isPasswordTooLong($raw)) { throw new BadCredentialsException(sprintf('Password exceeds a maximum of %d characters', static::MAX_PASSWORD_LENGTH)); @@ -67,7 +64,7 @@ public function hashPassword($raw, $salt): string return $this->getFieldDefinition()->calculateHash($raw); } - public function isPasswordValid($encoded, $raw): bool + public function isPasswordValid(string $encoded, string $raw): bool { if ($this->isPasswordTooLong($raw)) { return false; diff --git a/lib/Security/Hasher/PasswordHasherFactory.php b/lib/Security/Hasher/PasswordHasherFactory.php index 027a4fe58b4..a5686812786 100644 --- a/lib/Security/Hasher/PasswordHasherFactory.php +++ b/lib/Security/Hasher/PasswordHasherFactory.php @@ -17,8 +17,10 @@ namespace Pimcore\Security\Hasher; use Pimcore\Security\Hasher\Factory\UserAwarePasswordHasherFactory; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; /** @@ -37,14 +39,14 @@ class PasswordHasherFactory implements PasswordHasherFactoryInterface /** * @param PasswordHasherFactoryInterface[] $passwordHasherFactories */ - public function __construct(protected PasswordHasherFactoryInterface $frameworkFactory, protected array $passwordHasherFactories = []) + public function __construct(protected PasswordHasherFactoryInterface $frameworkFactory, protected array $passwordHasherFactories = []) { } /** * {@inheritdoc} */ - public function getPasswordHasher($user): PasswordHasherInterface + public function getPasswordHasher(string|PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user): PasswordHasherInterface { if ($hasher = $this->getPasswordHasherFromFactory($user)) { return $hasher; @@ -56,10 +58,8 @@ public function getPasswordHasher($user): PasswordHasherInterface /** * Returns the password hasher factory to use for the given account. - * - * @param string|UserInterface $user A UserInterface instance or a class name */ - private function getPasswordHasherFromFactory(UserInterface|string $user): ?PasswordHasherInterface + private function getPasswordHasherFromFactory(string|PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user): ?PasswordHasherInterface { $factoryKey = null; diff --git a/lib/Security/Hasher/UserAwarePasswordHasherInterface.php b/lib/Security/Hasher/UserAwarePasswordHasherInterface.php index a4adec246e9..ba3b54628b1 100644 --- a/lib/Security/Hasher/UserAwarePasswordHasherInterface.php +++ b/lib/Security/Hasher/UserAwarePasswordHasherInterface.php @@ -33,7 +33,7 @@ interface UserAwarePasswordHasherInterface extends PasswordHasherInterface * @throws RuntimeException * if the user is already set to prevent overwriting the scoped user object */ - public function setUser(UserInterface $user); + public function setUser(UserInterface $user): void; /** * Get the user object diff --git a/lib/Security/User/ObjectUserProvider.php b/lib/Security/User/ObjectUserProvider.php index fd5416dc463..935bd7cb05a 100644 --- a/lib/Security/User/ObjectUserProvider.php +++ b/lib/Security/User/ObjectUserProvider.php @@ -56,7 +56,7 @@ public function __construct(string $className, string $usernameField = 'username $this->usernameField = $usernameField; } - protected function setClassName(string $className) + protected function setClassName(string $className): void { if (empty($className)) { throw new InvalidArgumentException('Object class name is empty'); @@ -107,7 +107,7 @@ public function refreshUser(UserInterface $user) /** * {@inheritdoc} */ - public function supportsClass($class): bool + public function supportsClass(string $class): bool { return $class === $this->className; } diff --git a/lib/Session/Attribute/LockableAttributeBag.php b/lib/Session/Attribute/LockableAttributeBag.php index b566f9e13f2..1b3a018ced1 100644 --- a/lib/Session/Attribute/LockableAttributeBag.php +++ b/lib/Session/Attribute/LockableAttributeBag.php @@ -26,7 +26,7 @@ class LockableAttributeBag extends AttributeBag implements LockableAttributeBagI /** * {@inheritdoc} */ - public function lock() + public function lock(): void { $this->locked = true; } @@ -34,7 +34,7 @@ public function lock() /** * {@inheritdoc} */ - public function unlock() + public function unlock(): void { $this->locked = false; } @@ -50,7 +50,7 @@ public function isLocked(): bool /** * {@inheritdoc} */ - public function set($name, $value) + public function set(string $name, mixed $value): void { $this->checkLock(); @@ -60,7 +60,7 @@ public function set($name, $value) /** * {@inheritdoc} */ - public function replace(array $attributes) + public function replace(array $attributes): void { $this->checkLock(); @@ -72,7 +72,7 @@ public function replace(array $attributes) * * @return mixed */ - public function remove($name): mixed + public function remove(string $name): mixed { $this->checkLock(); @@ -95,7 +95,7 @@ public function clear(): mixed * @throws AttributeBagLockedException * if lock is set */ - protected function checkLock() + protected function checkLock(): void { if ($this->locked) { throw new AttributeBagLockedException('Attribute bag is locked'); diff --git a/lib/Session/Attribute/LockableAttributeBagInterface.php b/lib/Session/Attribute/LockableAttributeBagInterface.php index 63a8aee7e8d..7c4f31c924f 100644 --- a/lib/Session/Attribute/LockableAttributeBagInterface.php +++ b/lib/Session/Attribute/LockableAttributeBagInterface.php @@ -23,17 +23,15 @@ interface LockableAttributeBagInterface extends AttributeBagInterface /** * Lock the attribute bag (disallow modifications) */ - public function lock(); + public function lock(): void; /** * Unlock the attribute bag */ - public function unlock(); + public function unlock(): void; /** * Get lock status - * - * @return bool */ public function isLocked(): bool; } diff --git a/lib/Sitemap/Document/DocumentTreeGenerator.php b/lib/Sitemap/Document/DocumentTreeGenerator.php index 03260fbdf81..e1c4c922ad3 100644 --- a/lib/Sitemap/Document/DocumentTreeGenerator.php +++ b/lib/Sitemap/Document/DocumentTreeGenerator.php @@ -49,7 +49,7 @@ public function __construct( $this->options = $optionsResolver->resolve($options); } - protected function configureOptions(OptionsResolver $options) + protected function configureOptions(OptionsResolver $options): void { $options->setDefaults([ 'rootId' => 1, @@ -66,7 +66,7 @@ protected function configureOptions(OptionsResolver $options) $options->setAllowedTypes('garbageCollectThreshold', 'int'); } - public function populate(UrlContainerInterface $urlContainer, string $section = null) + public function populate(UrlContainerInterface $urlContainer, string $section = null): void { if ($this->options['handleMainDomain'] && null === $section || $section === 'default') { $rootDocument = Document::getById($this->options['rootId']); diff --git a/lib/Sitemap/Document/DocumentUrlGenerator.php b/lib/Sitemap/Document/DocumentUrlGenerator.php index 49393f859a8..65617410d52 100644 --- a/lib/Sitemap/Document/DocumentUrlGenerator.php +++ b/lib/Sitemap/Document/DocumentUrlGenerator.php @@ -73,10 +73,7 @@ protected function prepareOptions(array $options, Site $site = null): array return $options; } - /** - * @return string - */ - protected function hostForSite(Site $site) + protected function hostForSite(Site $site): string { $host = $site->getMainDomain(); if (!empty($host)) { diff --git a/lib/Sitemap/Element/AbstractElementGenerator.php b/lib/Sitemap/Element/AbstractElementGenerator.php index c13ac0e83d9..a882c9eed60 100644 --- a/lib/Sitemap/Element/AbstractElementGenerator.php +++ b/lib/Sitemap/Element/AbstractElementGenerator.php @@ -47,7 +47,7 @@ public function __construct(array $filters = [], array $processors = []) $this->processors = $processors; } - public function addFilter(FilterInterface $filter) + public function addFilter(FilterInterface $filter): void { $this->filters[] = $filter; } @@ -60,7 +60,7 @@ public function getFilters(): array return $this->filters; } - public function addProcessor(ProcessorInterface $processor) + public function addProcessor(ProcessorInterface $processor): void { $this->processors[] = $processor; } diff --git a/lib/Sitemap/Element/GeneratorContext.php b/lib/Sitemap/Element/GeneratorContext.php index e200c094c25..e97850518c0 100644 --- a/lib/Sitemap/Element/GeneratorContext.php +++ b/lib/Sitemap/Element/GeneratorContext.php @@ -62,10 +62,7 @@ public function get(int|string $key, mixed $default = null): mixed return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } - /** - * @param int|string $key - */ - public function has($key): bool + public function has(int|string $key): bool { return array_key_exists($key, $this->parameters); } diff --git a/lib/Sitemap/Element/GeneratorContextInterface.php b/lib/Sitemap/Element/GeneratorContextInterface.php index b410f36a95f..8b64e61d6ae 100644 --- a/lib/Sitemap/Element/GeneratorContextInterface.php +++ b/lib/Sitemap/Element/GeneratorContextInterface.php @@ -32,16 +32,7 @@ public function all(): array; public function keys(): array; - /** - * @param int|string $key - * @param mixed $default - * - * @return mixed - */ public function get(int|string $key, mixed $default = null): mixed; - /** - * @param int|string $key - */ - public function has($key): bool; + public function has(int|string $key): bool; } diff --git a/lib/Sitemap/EventListener/SitemapGeneratorListener.php b/lib/Sitemap/EventListener/SitemapGeneratorListener.php index 6ee2fa31d7f..6bfe7b153a4 100644 --- a/lib/Sitemap/EventListener/SitemapGeneratorListener.php +++ b/lib/Sitemap/EventListener/SitemapGeneratorListener.php @@ -48,7 +48,7 @@ public static function getSubscribedEvents(): array ]; } - public function onPopulateSitemap(SitemapPopulateEvent $event) + public function onPopulateSitemap(SitemapPopulateEvent $event): void { $container = $event->getUrlContainer(); $section = $event->getSection(); diff --git a/lib/Sitemap/GeneratorInterface.php b/lib/Sitemap/GeneratorInterface.php index f46259a07b8..a9ff328bc9d 100644 --- a/lib/Sitemap/GeneratorInterface.php +++ b/lib/Sitemap/GeneratorInterface.php @@ -23,9 +23,6 @@ interface GeneratorInterface { /** * Populates the sitemap - * - * @param UrlContainerInterface $urlContainer - * @param string|null $section */ - public function populate(UrlContainerInterface $urlContainer, string $section = null); + public function populate(UrlContainerInterface $urlContainer, string $section = null): void; } diff --git a/lib/Sitemap/UrlGenerator.php b/lib/Sitemap/UrlGenerator.php index 0e7085dba6f..289c5fa9595 100644 --- a/lib/Sitemap/UrlGenerator.php +++ b/lib/Sitemap/UrlGenerator.php @@ -40,7 +40,7 @@ public function __construct(RequestContext $requestContext) $this->configureOptions($this->optionsResolver); } - protected function configureOptions(OptionsResolver $options) + protected function configureOptions(OptionsResolver $options): void { $options->setDefaults([ 'scheme' => $this->requestContext->getScheme(), diff --git a/lib/Targeting/ActionHandler/ActionHandlerInterface.php b/lib/Targeting/ActionHandler/ActionHandlerInterface.php index 097ab302acf..31c35590ee7 100644 --- a/lib/Targeting/ActionHandler/ActionHandlerInterface.php +++ b/lib/Targeting/ActionHandler/ActionHandlerInterface.php @@ -24,10 +24,6 @@ interface ActionHandlerInterface { /** * Applies the action - * - * @param VisitorInfo $visitorInfo - * @param array $action - * @param Rule|null $rule */ - public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null); + public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void; } diff --git a/lib/Targeting/ActionHandler/AssignTargetGroup.php b/lib/Targeting/ActionHandler/AssignTargetGroup.php index 4f009de4218..d289e17afbc 100644 --- a/lib/Targeting/ActionHandler/AssignTargetGroup.php +++ b/lib/Targeting/ActionHandler/AssignTargetGroup.php @@ -37,7 +37,7 @@ public function __construct( $this->storage = $storage; } - public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null) + public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { $targetGroupId = $action['targetGroup'] ?? null; if (!$targetGroupId) { @@ -67,7 +67,7 @@ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null $this->assignToVisitor($visitorInfo, $targetGroup, $count); } - public function reset(VisitorInfo $visitorInfo) + public function reset(VisitorInfo $visitorInfo): void { $success = $this->deleteAssignments($visitorInfo); } @@ -77,7 +77,7 @@ public function reset(VisitorInfo $visitorInfo) * * @param VisitorInfo $visitorInfo */ - public function loadStoredAssignments(VisitorInfo $visitorInfo) + public function loadStoredAssignments(VisitorInfo $visitorInfo): void { $data = $this->storage->get( $visitorInfo, @@ -136,7 +136,7 @@ protected function deleteAssignments(VisitorInfo $visitorInfo): bool return true; } - protected function assignToVisitor(VisitorInfo $visitorInfo, TargetGroup $targetGroup, int $count) + protected function assignToVisitor(VisitorInfo $visitorInfo, TargetGroup $targetGroup, int $count): void { $threshold = (int)$targetGroup->getThreshold(); diff --git a/lib/Targeting/ActionHandler/CodeSnippet.php b/lib/Targeting/ActionHandler/CodeSnippet.php index 6e97215c6eb..56797101dda 100644 --- a/lib/Targeting/ActionHandler/CodeSnippet.php +++ b/lib/Targeting/ActionHandler/CodeSnippet.php @@ -34,7 +34,7 @@ public function __construct(CodeInjector $codeInjector) /** * {@inheritdoc} */ - public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null) + public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { $code = $action['code'] ?? ''; $selector = $action['selector'] ?? ''; @@ -53,7 +53,7 @@ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null ]); } - public function transformResponse(VisitorInfo $visitorInfo, Response $response, array $actions) + public function transformResponse(VisitorInfo $visitorInfo, Response $response, array $actions): void { foreach ($actions as $action) { $this->codeInjector->inject( diff --git a/lib/Targeting/ActionHandler/DelegatingActionHandler.php b/lib/Targeting/ActionHandler/DelegatingActionHandler.php index b53e04f9e67..56ae7616a08 100644 --- a/lib/Targeting/ActionHandler/DelegatingActionHandler.php +++ b/lib/Targeting/ActionHandler/DelegatingActionHandler.php @@ -40,7 +40,7 @@ public function __construct( /** * {@inheritdoc} */ - public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null) + public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { /** @var string $type */ $type = $action['type'] ?? null; diff --git a/lib/Targeting/ActionHandler/Redirect.php b/lib/Targeting/ActionHandler/Redirect.php index 71ea6292310..a08de2f880c 100644 --- a/lib/Targeting/ActionHandler/Redirect.php +++ b/lib/Targeting/ActionHandler/Redirect.php @@ -27,7 +27,7 @@ class Redirect implements ActionHandlerInterface /** * {@inheritdoc} */ - public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null) + public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { $url = $action['url'] ?? null; if (!$url) { @@ -66,7 +66,7 @@ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null $visitorInfo->setResponse(new RedirectResponse($url, $code)); } - private function addUrlParam(string $url, string $param, $value): string + private function addUrlParam(string $url, string $param, int $value): string { // add _ptr parameter if (false !== strpos($url, '?')) { diff --git a/lib/Targeting/ActionHandler/ResponseTransformingActionHandlerInterface.php b/lib/Targeting/ActionHandler/ResponseTransformingActionHandlerInterface.php index e41ed15291c..15f4e830e1b 100644 --- a/lib/Targeting/ActionHandler/ResponseTransformingActionHandlerInterface.php +++ b/lib/Targeting/ActionHandler/ResponseTransformingActionHandlerInterface.php @@ -24,10 +24,6 @@ interface ResponseTransformingActionHandlerInterface { /** * Applies previously recorded actions to the response - * - * @param VisitorInfo $visitorInfo - * @param Response $response - * @param array $actions */ - public function transformResponse(VisitorInfo $visitorInfo, Response $response, array $actions); + public function transformResponse(VisitorInfo $visitorInfo, Response $response, array $actions): void; } diff --git a/lib/Targeting/Condition/AbstractVariableCondition.php b/lib/Targeting/Condition/AbstractVariableCondition.php index 1921611ee7f..30769d6467e 100644 --- a/lib/Targeting/Condition/AbstractVariableCondition.php +++ b/lib/Targeting/Condition/AbstractVariableCondition.php @@ -19,6 +19,9 @@ abstract class AbstractVariableCondition implements ConditionInterface, VariableConditionInterface { + /** + * @var array + */ private array $variables = []; /** @@ -29,12 +32,12 @@ public function getMatchedVariables(): array return $this->variables; } - final protected function setMatchedVariables(array $variables) + final protected function setMatchedVariables(array $variables): void { $this->variables = $variables; } - final protected function setMatchedVariable(string $key, $value) + final protected function setMatchedVariable(string $key, mixed $value): void { $this->variables[$key] = $value; } diff --git a/lib/Targeting/Condition/ConditionInterface.php b/lib/Targeting/Condition/ConditionInterface.php index dd4fcad4bc7..6f398ef542d 100644 --- a/lib/Targeting/Condition/ConditionInterface.php +++ b/lib/Targeting/Condition/ConditionInterface.php @@ -23,12 +23,8 @@ interface ConditionInterface { /** * Create an instance from a config array - * - * @param array $config - * - * @return ConditionInterface */ - public static function fromConfig(array $config): ConditionInterface; + public static function fromConfig(array $config): self; /** * Determines if the condition is able to match. E.g. if a country condition diff --git a/lib/Targeting/Condition/EventDispatchingConditionInterface.php b/lib/Targeting/Condition/EventDispatchingConditionInterface.php index 7754b9d7a07..701f4c6b57b 100644 --- a/lib/Targeting/Condition/EventDispatchingConditionInterface.php +++ b/lib/Targeting/Condition/EventDispatchingConditionInterface.php @@ -24,17 +24,11 @@ interface EventDispatchingConditionInterface { /** * Executed before condition is matched - * - * @param VisitorInfo $visitorInfo - * @param EventDispatcherInterface $eventDispatcher */ - public function preMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher); + public function preMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher): void; /** * Executed after condition is matched - * - * @param VisitorInfo $visitorInfo - * @param EventDispatcherInterface $eventDispatcher */ - public function postMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher); + public function postMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher): void; } diff --git a/lib/Targeting/Condition/Language.php b/lib/Targeting/Condition/Language.php index 67b9c25b403..b2c64603ac3 100644 --- a/lib/Targeting/Condition/Language.php +++ b/lib/Targeting/Condition/Language.php @@ -81,10 +81,7 @@ public function match(VisitorInfo $visitorInfo): bool return false; } - /** - * @return string|null - */ - protected function loadLanguage(Request $request) + protected function loadLanguage(Request $request): ?string { // handle override $language = OverrideAttributeResolver::getOverrideValue($request, 'language'); diff --git a/lib/Targeting/Condition/TargetGroup.php b/lib/Targeting/Condition/TargetGroup.php index 1a2cc7440e1..ea34b15f845 100644 --- a/lib/Targeting/Condition/TargetGroup.php +++ b/lib/Targeting/Condition/TargetGroup.php @@ -31,7 +31,7 @@ public function __construct(?int $targetGroupId = null) /** * @return self */ - public static function fromConfig(array $config): ConditionInterface|TargetGroup + public static function fromConfig(array $config): self { return new self($config['targetGroup'] ?? null); } diff --git a/lib/Targeting/Condition/VisitedPagesBefore.php b/lib/Targeting/Condition/VisitedPagesBefore.php index e557ed035d9..500d9fe79bf 100644 --- a/lib/Targeting/Condition/VisitedPagesBefore.php +++ b/lib/Targeting/Condition/VisitedPagesBefore.php @@ -79,7 +79,7 @@ public function match(VisitorInfo $visitorInfo): bool /** * {@inheritdoc} */ - public function postMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher) + public function postMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher): void { // emit event which instructs VisitedPagesCountListener to increment the count after matching $eventDispatcher->dispatch(new GenericEvent(), TargetingEvents::VISITED_PAGES_COUNT_MATCH); @@ -88,7 +88,7 @@ public function postMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $ev /** * {@inheritdoc} */ - public function preMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher) + public function preMatch(VisitorInfo $visitorInfo, EventDispatcherInterface $eventDispatcher): void { // noop } diff --git a/lib/Targeting/DataLoader.php b/lib/Targeting/DataLoader.php index 041789b5c8d..4a1b3f91444 100644 --- a/lib/Targeting/DataLoader.php +++ b/lib/Targeting/DataLoader.php @@ -36,7 +36,7 @@ public function __construct(ContainerInterface $dataProviders) /** * {@inheritdoc} */ - public function loadDataFromProviders(VisitorInfo $visitorInfo, array|string $providerKeys) + public function loadDataFromProviders(VisitorInfo $visitorInfo, array|string $providerKeys): void { if (!is_array($providerKeys)) { $providerKeys = [(string)$providerKeys]; diff --git a/lib/Targeting/DataLoaderInterface.php b/lib/Targeting/DataLoaderInterface.php index 63722f995af..ec10e8258d1 100644 --- a/lib/Targeting/DataLoaderInterface.php +++ b/lib/Targeting/DataLoaderInterface.php @@ -25,27 +25,16 @@ interface DataLoaderInterface /** * Loads data from given data providers while taking * data provider dependencies into account - * - * @param VisitorInfo $visitorInfo - * @param array|string $providerKeys */ - public function loadDataFromProviders(VisitorInfo $visitorInfo, array|string $providerKeys); + public function loadDataFromProviders(VisitorInfo $visitorInfo, array|string $providerKeys): void; /** * Checks if a data provider is registered - * - * @param string $type - * - * @return bool */ public function hasDataProvider(string $type): bool; /** * Returns the data provider instance identified by name - * - * @param string $type - * - * @return DataProviderInterface */ public function getDataProvider(string $type): DataProviderInterface; } diff --git a/lib/Targeting/DataProvider/DataProviderInterface.php b/lib/Targeting/DataProvider/DataProviderInterface.php index 2822a9a7fc2..edfa804c7c4 100644 --- a/lib/Targeting/DataProvider/DataProviderInterface.php +++ b/lib/Targeting/DataProvider/DataProviderInterface.php @@ -23,8 +23,6 @@ interface DataProviderInterface { /** * Loads data into the visitor info - * - * @param VisitorInfo $visitorInfo */ - public function load(VisitorInfo $visitorInfo); + public function load(VisitorInfo $visitorInfo): void; } diff --git a/lib/Targeting/DataProvider/Device.php b/lib/Targeting/DataProvider/Device.php index 06e91a58f95..296247753f7 100644 --- a/lib/Targeting/DataProvider/Device.php +++ b/lib/Targeting/DataProvider/Device.php @@ -54,12 +54,12 @@ public function __construct(LoggerInterface $logger) $this->logger = $logger; } - public function setCache(CoreCacheHandler $cache) + public function setCache(CoreCacheHandler $cache): void { $this->cache = $cache; } - public function setCachePool(TagAwareAdapterInterface $cachePool) + public function setCachePool(TagAwareAdapterInterface $cachePool): void { $this->cachePool = $cachePool; } @@ -67,7 +67,7 @@ public function setCachePool(TagAwareAdapterInterface $cachePool) /** * {@inheritdoc} */ - public function load(VisitorInfo $visitorInfo) + public function load(VisitorInfo $visitorInfo): void { if ($visitorInfo->has(self::PROVIDER_KEY)) { return; diff --git a/lib/Targeting/DataProvider/GeoIp.php b/lib/Targeting/DataProvider/GeoIp.php index bd94e84fb68..e51ee2fd5ab 100644 --- a/lib/Targeting/DataProvider/GeoIp.php +++ b/lib/Targeting/DataProvider/GeoIp.php @@ -46,7 +46,7 @@ public function __construct( $this->logger = $logger; } - public function setCache(CoreCacheHandler $cache) + public function setCache(CoreCacheHandler $cache): void { $this->cache = $cache; } @@ -54,7 +54,7 @@ public function setCache(CoreCacheHandler $cache) /** * {@inheritdoc} */ - public function load(VisitorInfo $visitorInfo) + public function load(VisitorInfo $visitorInfo): void { if ($visitorInfo->has(self::PROVIDER_KEY)) { return; diff --git a/lib/Targeting/DataProvider/GeoLocation.php b/lib/Targeting/DataProvider/GeoLocation.php index 2e189592812..4ee00a8760c 100644 --- a/lib/Targeting/DataProvider/GeoLocation.php +++ b/lib/Targeting/DataProvider/GeoLocation.php @@ -45,7 +45,7 @@ public function __construct( $this->logger = $logger; } - public function load(VisitorInfo $visitorInfo) + public function load(VisitorInfo $visitorInfo): void { $location = $this->loadLocation($visitorInfo); $location = $this->handleOverrides($visitorInfo->getRequest(), $location); diff --git a/lib/Targeting/DataProvider/TargetingStorage.php b/lib/Targeting/DataProvider/TargetingStorage.php index 70db87be2a4..cc3b81528b1 100644 --- a/lib/Targeting/DataProvider/TargetingStorage.php +++ b/lib/Targeting/DataProvider/TargetingStorage.php @@ -34,7 +34,7 @@ public function __construct(TargetingStorageInterface $storage) /** * {@inheritdoc} */ - public function load(VisitorInfo $visitorInfo) + public function load(VisitorInfo $visitorInfo): void { $visitorInfo->set(self::PROVIDER_KEY, $this->storage); } diff --git a/lib/Targeting/DataProvider/VisitedPagesCounter.php b/lib/Targeting/DataProvider/VisitedPagesCounter.php index c54cf4b902b..a6166f7f809 100644 --- a/lib/Targeting/DataProvider/VisitedPagesCounter.php +++ b/lib/Targeting/DataProvider/VisitedPagesCounter.php @@ -34,7 +34,7 @@ public function __construct(VisitedPagesCounterService $service) /** * {@inheritdoc} */ - public function load(VisitorInfo $visitorInfo) + public function load(VisitorInfo $visitorInfo): void { $visitorInfo->set(self::PROVIDER_KEY, $this->service); } diff --git a/lib/Targeting/Debug/Form/DeviceType.php b/lib/Targeting/Debug/Form/DeviceType.php index 36801ed3456..621ad2ce2e0 100644 --- a/lib/Targeting/Debug/Form/DeviceType.php +++ b/lib/Targeting/Debug/Form/DeviceType.php @@ -23,7 +23,7 @@ class DeviceType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('hardwarePlatform', ChoiceType::class, [ 'label' => 'Hardware Platform', diff --git a/lib/Targeting/Debug/Form/LocationType.php b/lib/Targeting/Debug/Form/LocationType.php index 5e16355ec1a..7a683ea82a1 100644 --- a/lib/Targeting/Debug/Form/LocationType.php +++ b/lib/Targeting/Debug/Form/LocationType.php @@ -24,7 +24,7 @@ class LocationType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('country', CountryType::class, [ 'label' => 'Country', diff --git a/lib/Targeting/Debug/Override/DeviceOverrideHandler.php b/lib/Targeting/Debug/Override/DeviceOverrideHandler.php index 728b4fd24c8..7d88177d3d8 100644 --- a/lib/Targeting/Debug/Override/DeviceOverrideHandler.php +++ b/lib/Targeting/Debug/Override/DeviceOverrideHandler.php @@ -25,7 +25,7 @@ class DeviceOverrideHandler implements OverrideHandlerInterface { - public function buildOverrideForm(FormBuilderInterface $form, Request $request) + public function buildOverrideForm(FormBuilderInterface $form, Request $request): void { $form->add('device', DeviceType::class, [ 'label' => 'Device', @@ -36,7 +36,7 @@ public function buildOverrideForm(FormBuilderInterface $form, Request $request) ]); } - public function overrideFromRequest(array $overrides, Request $request) + public function overrideFromRequest(array $overrides, Request $request): void { $device = $overrides['device'] ?? []; if (empty($device)) { diff --git a/lib/Targeting/Debug/Override/DocumentTargetingOverrideHandler.php b/lib/Targeting/Debug/Override/DocumentTargetingOverrideHandler.php index 580c7c13d5d..b456429462c 100644 --- a/lib/Targeting/Debug/Override/DocumentTargetingOverrideHandler.php +++ b/lib/Targeting/Debug/Override/DocumentTargetingOverrideHandler.php @@ -34,7 +34,7 @@ public function __construct(DocumentTargetingConfigurator $documentTargetingConf $this->documentTargetingConfigurator = $documentTargetingConfigurator; } - public function buildOverrideForm(FormBuilderInterface $form, Request $request) + public function buildOverrideForm(FormBuilderInterface $form, Request $request): void { $form->add('documentTargetGroup', ChoiceType::class, [ 'label' => 'Document Target Group', @@ -51,7 +51,7 @@ public function buildOverrideForm(FormBuilderInterface $form, Request $request) ]); } - public function overrideFromRequest(array $overrides, Request $request) + public function overrideFromRequest(array $overrides, Request $request): void { $targetGroup = $overrides['documentTargetGroup'] ?? null; if ($targetGroup && $targetGroup instanceof TargetGroup) { diff --git a/lib/Targeting/Debug/Override/LanguageOverrideHandler.php b/lib/Targeting/Debug/Override/LanguageOverrideHandler.php index 4329713f916..e096dc9df23 100644 --- a/lib/Targeting/Debug/Override/LanguageOverrideHandler.php +++ b/lib/Targeting/Debug/Override/LanguageOverrideHandler.php @@ -25,14 +25,14 @@ class LanguageOverrideHandler implements OverrideHandlerInterface { - public function buildOverrideForm(FormBuilderInterface $form, Request $request) + public function buildOverrideForm(FormBuilderInterface $form, Request $request): void { $form->add('language', LanguageType::class, [ 'required' => false, ]); } - public function overrideFromRequest(array $overrides, Request $request) + public function overrideFromRequest(array $overrides, Request $request): void { $language = $overrides['language'] ?? null; if (empty($language)) { diff --git a/lib/Targeting/Debug/Override/LocationOverrideHandler.php b/lib/Targeting/Debug/Override/LocationOverrideHandler.php index f391681c0d8..280aad4553a 100644 --- a/lib/Targeting/Debug/Override/LocationOverrideHandler.php +++ b/lib/Targeting/Debug/Override/LocationOverrideHandler.php @@ -25,7 +25,7 @@ class LocationOverrideHandler implements OverrideHandlerInterface { - public function buildOverrideForm(FormBuilderInterface $form, Request $request) + public function buildOverrideForm(FormBuilderInterface $form, Request $request): void { $form->add('location', LocationType::class, [ 'label' => 'Location', @@ -36,7 +36,7 @@ public function buildOverrideForm(FormBuilderInterface $form, Request $request) ]); } - public function overrideFromRequest(array $overrides, Request $request) + public function overrideFromRequest(array $overrides, Request $request): void { $location = $overrides['location'] ?? []; if (empty($location)) { diff --git a/lib/Targeting/EventListener/DocumentTargetGroupListener.php b/lib/Targeting/EventListener/DocumentTargetGroupListener.php index 7845e27e34c..ff5439b8e51 100644 --- a/lib/Targeting/EventListener/DocumentTargetGroupListener.php +++ b/lib/Targeting/EventListener/DocumentTargetGroupListener.php @@ -62,7 +62,7 @@ public static function getSubscribedEvents(): array ]; } - public function onVisitorInfoResolve(TargetingEvent $event) + public function onVisitorInfoResolve(TargetingEvent $event): void { $request = $event->getRequest(); $document = $this->documentResolver->getDocument($request); diff --git a/lib/Targeting/EventListener/FullPageCacheCookieCleanupListener.php b/lib/Targeting/EventListener/FullPageCacheCookieCleanupListener.php index 2e34468448e..25f52814b9c 100644 --- a/lib/Targeting/EventListener/FullPageCacheCookieCleanupListener.php +++ b/lib/Targeting/EventListener/FullPageCacheCookieCleanupListener.php @@ -39,7 +39,7 @@ public static function getSubscribedEvents(): array ]; } - public function onPrepareFullPageCacheResponse(PrepareResponseEvent $event) + public function onPrepareFullPageCacheResponse(PrepareResponseEvent $event): void { $response = $event->getResponse(); $cookies = $response->headers->getCookies(); diff --git a/lib/Targeting/EventListener/TargetingListener.php b/lib/Targeting/EventListener/TargetingListener.php index f7a5e2d541f..88f32593bbf 100644 --- a/lib/Targeting/EventListener/TargetingListener.php +++ b/lib/Targeting/EventListener/TargetingListener.php @@ -83,7 +83,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$this->enabled) { return; @@ -132,7 +132,7 @@ public function onKernelRequest(RequestEvent $event) } } - public function onPreResolve(TargetingEvent $event) + public function onPreResolve(TargetingEvent $event): void { $this->startStopwatch('Targeting:loadStoredAssignments', 'targeting'); @@ -146,7 +146,7 @@ public function onPreResolve(TargetingEvent $event) $this->stopStopwatch('Targeting:loadStoredAssignments'); } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (!$this->enabled) { return; diff --git a/lib/Targeting/EventListener/TargetingSessionBagListener.php b/lib/Targeting/EventListener/TargetingSessionBagListener.php index b526d8c06f0..33d3213aa77 100644 --- a/lib/Targeting/EventListener/TargetingSessionBagListener.php +++ b/lib/Targeting/EventListener/TargetingSessionBagListener.php @@ -52,7 +52,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$this->isEnabled()) { return; @@ -72,7 +72,7 @@ public function onKernelRequest(RequestEvent $event) $this->configure($session); } - public function configure(SessionInterface $session) + public function configure(SessionInterface $session): void { $sessionBag = new AttributeBag('_' . self::TARGETING_BAG_SESSION); $sessionBag->setName(self::TARGETING_BAG_SESSION); @@ -84,7 +84,7 @@ public function configure(SessionInterface $session) $session->registerBag($visitorBag); } - public function configureIgnoredSessionKeys(IgnoredSessionKeysEvent $event) + public function configureIgnoredSessionKeys(IgnoredSessionKeysEvent $event): void { if (!$this->isEnabled()) { return; @@ -102,7 +102,7 @@ public function configureIgnoredSessionKeys(IgnoredSessionKeysEvent $event) * * @param PrepareResponseEvent $event */ - public function prepareFullPageCacheResponse(PrepareResponseEvent $event) + public function prepareFullPageCacheResponse(PrepareResponseEvent $event): void { if (!$this->isEnabled()) { return; @@ -133,7 +133,7 @@ public function prepareFullPageCacheResponse(PrepareResponseEvent $event) } } - protected function isEnabled() + protected function isEnabled(): bool { return $this->config['targeting']['session']['enabled']; } diff --git a/lib/Targeting/EventListener/ToolbarListener.php b/lib/Targeting/EventListener/ToolbarListener.php index 1ec21f6117d..3db85cec390 100644 --- a/lib/Targeting/EventListener/ToolbarListener.php +++ b/lib/Targeting/EventListener/ToolbarListener.php @@ -85,7 +85,7 @@ public static function getSubscribedEvents(): array ]; } - public function onPreResolve(TargetingEvent $event) + public function onPreResolve(TargetingEvent $event): void { $request = $event->getRequest(); if (!$this->requestCanDebug($request)) { @@ -96,7 +96,7 @@ public function onPreResolve(TargetingEvent $event) $this->overrideHandler->handleRequest($request); } - public function onKernelResponse(ResponseEvent $event) + public function onKernelResponse(ResponseEvent $event): void { if (!$event->isMainRequest()) { return; diff --git a/lib/Targeting/EventListener/VisitedPagesCountListener.php b/lib/Targeting/EventListener/VisitedPagesCountListener.php index d7b27b7be9c..2e94f8f551f 100644 --- a/lib/Targeting/EventListener/VisitedPagesCountListener.php +++ b/lib/Targeting/EventListener/VisitedPagesCountListener.php @@ -46,13 +46,13 @@ public static function getSubscribedEvents(): array ]; } - public function onVisitedPagesCountMatch() + public function onVisitedPagesCountMatch(): void { // increment page count after matching proceeded $this->recordPageCount = true; } - public function onPostResolveVisitorInfo(TargetingEvent $event) + public function onPostResolveVisitorInfo(TargetingEvent $event): void { // TODO currently the pages count is only recorded if there's a condition depending on // the count. This is good for minimizing storage data and writes, but implies that the diff --git a/lib/Targeting/Maintenance/TargetingStorageTask.php b/lib/Targeting/Maintenance/TargetingStorageTask.php index 61d03237e10..30ab33cecaa 100644 --- a/lib/Targeting/Maintenance/TargetingStorageTask.php +++ b/lib/Targeting/Maintenance/TargetingStorageTask.php @@ -30,7 +30,7 @@ public function __construct(TargetingStorageInterface $targetingStorage) $this->targetingStorage = $targetingStorage; } - public function execute() + public function execute(): void { if (!$this->targetingStorage instanceof MaintenanceStorageInterface) { return; diff --git a/lib/Targeting/Model/GeoLocation.php b/lib/Targeting/Model/GeoLocation.php index 69344ac3f6a..abf72c6ed93 100644 --- a/lib/Targeting/Model/GeoLocation.php +++ b/lib/Targeting/Model/GeoLocation.php @@ -40,13 +40,6 @@ public function __construct(float $latitude, float $longitude, float $altitude = $this->altitude = $altitude; } - /** - * @param float $latitude - * @param float $longitude - * @param float|null $altitude - * - * @return self - */ public static function build(float $latitude, float $longitude, float $altitude = null): self { return new self( diff --git a/lib/Targeting/Model/VisitorInfo.php b/lib/Targeting/Model/VisitorInfo.php index b85b61551d9..bc7be1b981a 100644 --- a/lib/Targeting/Model/VisitorInfo.php +++ b/lib/Targeting/Model/VisitorInfo.php @@ -84,7 +84,7 @@ public function __construct(Request $request, string $visitorId = null, string $ $this->sessionId = $sessionId; } - public static function fromRequest(Request $request): self + public static function fromRequest(Request $request): static { $visitorId = $request->cookies->get(self::VISITOR_ID_COOKIE_NAME); if (!empty($visitorId)) { @@ -139,7 +139,7 @@ public function getMatchingTargetingRules(): array /** * @param Rule[] $targetingRules */ - public function setMatchingTargetingRules(array $targetingRules = []) + public function setMatchingTargetingRules(array $targetingRules = []): void { $this->matchingTargetingRules = []; foreach ($targetingRules as $targetingRule) { @@ -147,7 +147,7 @@ public function setMatchingTargetingRules(array $targetingRules = []) } } - public function addMatchingTargetingRule(Rule $targetingRule) + public function addMatchingTargetingRule(Rule $targetingRule): void { if (!in_array($targetingRule, $this->matchingTargetingRules, true)) { $this->matchingTargetingRules[] = $targetingRule; @@ -194,7 +194,7 @@ public function getTargetGroupAssignment(TargetGroup $targetGroup): TargetGroupA return $this->targetGroupAssignments[$targetGroup->getId()]; } - public function assignTargetGroup(TargetGroup $targetGroup, int $count = 1, bool $overwrite = false) + public function assignTargetGroup(TargetGroup $targetGroup, int $count = 1, bool $overwrite = false): void { if ($count < 1) { throw new \InvalidArgumentException('Count must be greater than 0'); @@ -214,7 +214,7 @@ public function assignTargetGroup(TargetGroup $targetGroup, int $count = 1, bool $this->sortedTargetGroupAssignments = null; } - public function clearAssignedTargetGroup(TargetGroup $targetGroup) + public function clearAssignedTargetGroup(TargetGroup $targetGroup): void { if (isset($this->targetGroupAssignments[$targetGroup->getId()])) { unset($this->targetGroupAssignments[$targetGroup->getId()]); @@ -245,7 +245,7 @@ public function getFrontendDataProviders(): array return $this->frontendDataProviders; } - public function setFrontendDataProviders(array $providers) + public function setFrontendDataProviders(array $providers): void { $this->frontendDataProviders = []; foreach ($providers as $provider) { @@ -253,7 +253,7 @@ public function setFrontendDataProviders(array $providers) } } - public function addFrontendDataProvider(string $key) + public function addFrontendDataProvider(string $key): void { if (!in_array($key, $this->frontendDataProviders, true)) { $this->frontendDataProviders[] = $key; @@ -270,7 +270,7 @@ public function getResponse(): ?Response return $this->response; } - public function setResponse(Response $response) + public function setResponse(Response $response): void { $this->response = $response; } @@ -280,7 +280,7 @@ public function getData(): array return $this->data; } - public function setData(array $data) + public function setData(array $data): void { $this->data = $data; } @@ -290,37 +290,22 @@ public function getIterator(): \ArrayIterator return new \ArrayIterator($this->data); } - /** - * @param int|string $key - */ - public function has($key): bool + public function has(int|string $key): bool { return isset($this->data[$key]); } - /** - * @param int|string $key - * @param mixed $default - * - * @return mixed - */ public function get(int|string $key, mixed $default = null): mixed { return $this->data[$key] ?? $default; } - /** - * @param int|string $key - * @param mixed $value - * - * @return void - */ - public function set($key, $value) + public function set(int|string $key, mixed $value): void { $this->data[$key] = $value; } - public function addAction(array $action) + public function addAction(array $action): void { $this->actions[] = $action; } diff --git a/lib/Targeting/OverrideHandlerInterface.php b/lib/Targeting/OverrideHandlerInterface.php index a0c63cf4975..c9e102fecce 100644 --- a/lib/Targeting/OverrideHandlerInterface.php +++ b/lib/Targeting/OverrideHandlerInterface.php @@ -30,17 +30,11 @@ interface OverrideHandlerInterface /** * Add fields to the targeting toolbar override form - * - * @param FormBuilderInterface $form - * @param Request $request */ - public function buildOverrideForm(FormBuilderInterface $form, Request $request); + public function buildOverrideForm(FormBuilderInterface $form, Request $request): void; /** * Override targeting data from the override data as gathered from the form - * - * @param array $overrides - * @param Request $request */ - public function overrideFromRequest(array $overrides, Request $request); + public function overrideFromRequest(array $overrides, Request $request): void; } diff --git a/lib/Targeting/Storage/Cookie/AbstractCookieSaveHandler.php b/lib/Targeting/Storage/Cookie/AbstractCookieSaveHandler.php index 87cbdade3fb..d1b55051378 100644 --- a/lib/Targeting/Storage/Cookie/AbstractCookieSaveHandler.php +++ b/lib/Targeting/Storage/Cookie/AbstractCookieSaveHandler.php @@ -34,7 +34,7 @@ public function __construct(array $options = []) $this->options = $resolver->resolve($options); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'domain' => null, @@ -61,7 +61,7 @@ public function load(Request $request, string $scope, string $name): array /** * {@inheritdoc} */ - public function save(Response $response, string $scope, string $name, \DateTimeInterface|int|string $expire, ?array $data) + public function save(Response $response, string $scope, string $name, \DateTimeInterface|int|string $expire, ?array $data): void { $value = $this->prepareData($scope, $name, $expire, $data); diff --git a/lib/Targeting/Storage/Cookie/CookieSaveHandlerInterface.php b/lib/Targeting/Storage/Cookie/CookieSaveHandlerInterface.php index c63c86e3f36..435f1b43c0d 100644 --- a/lib/Targeting/Storage/Cookie/CookieSaveHandlerInterface.php +++ b/lib/Targeting/Storage/Cookie/CookieSaveHandlerInterface.php @@ -24,23 +24,11 @@ interface CookieSaveHandlerInterface { /** * Loads data from cookie - * - * @param Request $request - * @param string $scope - * @param string $name - * - * @return array */ public function load(Request $request, string $scope, string $name): array; /** * Saves data to cookie - * - * @param Response $response - * @param string $scope - * @param string $name - * @param \DateTimeInterface|int|string $expire - * @param array|null $data */ - public function save(Response $response, string $scope, string $name, \DateTimeInterface|int|string $expire, ?array $data); + public function save(Response $response, string $scope, string $name, \DateTimeInterface|int|string $expire, ?array $data): void; } diff --git a/lib/Targeting/Storage/CookieStorage.php b/lib/Targeting/Storage/CookieStorage.php index 554df96267f..0c877f26a5a 100644 --- a/lib/Targeting/Storage/CookieStorage.php +++ b/lib/Targeting/Storage/CookieStorage.php @@ -102,7 +102,7 @@ public function get(VisitorInfo $visitorInfo, string $scope, string $name, mixed return $default; } - public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value) + public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value): void { $this->loadData($visitorInfo, $scope); @@ -115,7 +115,7 @@ public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed /** * {@inheritdoc } */ - public function clear(VisitorInfo $visitorInfo, string $scope = null) + public function clear(VisitorInfo $visitorInfo, string $scope = null): void { if (null === $scope) { $this->data = []; @@ -128,7 +128,7 @@ public function clear(VisitorInfo $visitorInfo, string $scope = null) $this->addSaveListener($visitorInfo); } - public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope) + public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): void { $values = $storage->all($visitorInfo, $scope); diff --git a/lib/Targeting/Storage/DbStorage.php b/lib/Targeting/Storage/DbStorage.php index ee906bc9002..07e517e3f84 100644 --- a/lib/Targeting/Storage/DbStorage.php +++ b/lib/Targeting/Storage/DbStorage.php @@ -43,12 +43,12 @@ public function __construct(Connection $db, array $options = []) $this->handleOptions($resolver->resolve($options)); } - protected function handleOptions(array $options) + protected function handleOptions(array $options): void { $this->tableName = $options['tableName']; } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'tableName' => 'targeting_storage', @@ -124,7 +124,7 @@ public function has(VisitorInfo $visitorInfo, string $scope, string $name): bool return 1 === $result; } - public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value) + public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value): void { if (!$visitorInfo->hasVisitorId()) { return; @@ -201,7 +201,7 @@ public function get(VisitorInfo $visitorInfo, string $scope, string $name, mixed /** * {@inheritdoc } */ - public function clear(VisitorInfo $visitorInfo, string $scope = null) + public function clear(VisitorInfo $visitorInfo, string $scope = null): void { if (!$visitorInfo->hasVisitorId()) { return; @@ -225,7 +225,7 @@ public function clear(VisitorInfo $visitorInfo, string $scope = null) } } - public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope) + public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): void { // only allow migration if a visitor ID is available as otherwise the fallback // would clear the original storage although data was not stored @@ -272,7 +272,7 @@ public function getUpdatedAt(VisitorInfo $visitorInfo, string $scope): ?\DateTim /** * {@inheritdoc } */ - public function maintenance() + public function maintenance(): void { // clean up expired keys scopes with an expiration foreach (self::VALID_SCOPES as $scope) { @@ -313,7 +313,7 @@ private function loadDate(VisitorInfo $visitorInfo, string $scope, string $selec return null; } - private function convertToDateTime($result = null): ?\DateTimeImmutable + private function convertToDateTime(mixed $result = null): ?\DateTimeImmutable { if (!$result) { return null; diff --git a/lib/Targeting/Storage/FallbackStorage.php b/lib/Targeting/Storage/FallbackStorage.php index 2b87bf3a270..2c23265defd 100644 --- a/lib/Targeting/Storage/FallbackStorage.php +++ b/lib/Targeting/Storage/FallbackStorage.php @@ -59,7 +59,7 @@ public function __construct( $this->options = $resolver->resolve($options); } - protected function configureOptions(OptionsResolver $resolver) + protected function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'clear_after_migration' => false, @@ -92,7 +92,7 @@ public function has(VisitorInfo $visitorInfo, string $scope, string $name): bool } } - public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value) + public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value): void { if ($visitorInfo->hasVisitorId()) { $this->primaryStorage->set($visitorInfo, $scope, $name, $value); @@ -120,7 +120,7 @@ public function get(VisitorInfo $visitorInfo, string $scope, string $name, mixed /** * {@inheritdoc } */ - public function clear(VisitorInfo $visitorInfo, string $scope = null) + public function clear(VisitorInfo $visitorInfo, string $scope = null): void { $this->fallbackStorage->clear($visitorInfo, $scope); @@ -129,7 +129,7 @@ public function clear(VisitorInfo $visitorInfo, string $scope = null) } } - public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): bool + public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): void { throw new \LogicException('migrateFromStorage() is not supported in FallbackStorage'); } diff --git a/lib/Targeting/Storage/MaintenanceStorageInterface.php b/lib/Targeting/Storage/MaintenanceStorageInterface.php index b5e21af82a4..2c42b99109f 100644 --- a/lib/Targeting/Storage/MaintenanceStorageInterface.php +++ b/lib/Targeting/Storage/MaintenanceStorageInterface.php @@ -23,5 +23,5 @@ interface MaintenanceStorageInterface * Runs maintenance tasks which can be potentially heavy and should only be executed * asynchronously (e.g. in maintenance task). */ - public function maintenance(); + public function maintenance(): void; } diff --git a/lib/Targeting/Storage/RedisStorage.php b/lib/Targeting/Storage/RedisStorage.php index 92e93f10a97..ecef8163767 100644 --- a/lib/Targeting/Storage/RedisStorage.php +++ b/lib/Targeting/Storage/RedisStorage.php @@ -75,10 +75,10 @@ public function has(VisitorInfo $visitorInfo, string $scope, string $name): bool return (bool)$result; } - public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value) + public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value): void { if (!$visitorInfo->hasVisitorId()) { - return false; + return; } $json = json_encode($value); @@ -123,7 +123,7 @@ public function get(VisitorInfo $visitorInfo, string $scope, string $name, mixed /** * {@inheritdoc } */ - public function clear(VisitorInfo $visitorInfo, string $scope = null) + public function clear(VisitorInfo $visitorInfo, string $scope = null): void { $scopes = []; if (null !== $scope) { @@ -138,7 +138,7 @@ public function clear(VisitorInfo $visitorInfo, string $scope = null) } } - public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope) + public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): void { // only allow migration if a visitor ID is available as otherwise the fallback // would clear the original storage although data was not stored diff --git a/lib/Targeting/Storage/SessionStorage.php b/lib/Targeting/Storage/SessionStorage.php index 0a5b7c405a8..206dc9f3e09 100644 --- a/lib/Targeting/Storage/SessionStorage.php +++ b/lib/Targeting/Storage/SessionStorage.php @@ -61,7 +61,7 @@ public function has(VisitorInfo $visitorInfo, string $scope, string $name): bool return $bag->has($name); } - public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value) + public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value): void { $bag = $this->getSessionBag($visitorInfo, $scope); if (null === $bag) { @@ -89,7 +89,7 @@ public function get(VisitorInfo $visitorInfo, string $scope, string $name, mixed /** * {@inheritdoc } */ - public function clear(VisitorInfo $visitorInfo, string $scope = null) + public function clear(VisitorInfo $visitorInfo, string $scope = null): void { if (null !== $scope) { $bag = $this->getSessionBag($visitorInfo, $scope, true); @@ -106,7 +106,7 @@ public function clear(VisitorInfo $visitorInfo, string $scope = null) } } - public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope) + public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): void { // only allow migration if a session bag is available as otherwise the fallback // would clear the original storage although data was not stored diff --git a/lib/Targeting/Storage/TargetingStorageInterface.php b/lib/Targeting/Storage/TargetingStorageInterface.php index 472224461a6..29035d98b50 100644 --- a/lib/Targeting/Storage/TargetingStorageInterface.php +++ b/lib/Targeting/Storage/TargetingStorageInterface.php @@ -46,25 +46,13 @@ public function all(VisitorInfo $visitorInfo, string $scope): array; public function has(VisitorInfo $visitorInfo, string $scope, string $name): bool; - public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value); + public function set(VisitorInfo $visitorInfo, string $scope, string $name, mixed $value): void; - /** - * @param VisitorInfo $visitorInfo - * @param string $scope - * @param string $name - * @param mixed $default - * - * @return mixed - */ public function get(VisitorInfo $visitorInfo, string $scope, string $name, mixed $default = null): mixed; - /** - * @param VisitorInfo $visitorInfo - * @param string|null $scope - */ - public function clear(VisitorInfo $visitorInfo, string $scope = null); + public function clear(VisitorInfo $visitorInfo, string $scope = null): void; - public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope); + public function migrateFromStorage(TargetingStorageInterface $storage, VisitorInfo $visitorInfo, string $scope): void; public function getCreatedAt(VisitorInfo $visitorInfo, string $scope): ?\DateTimeImmutable; diff --git a/lib/Targeting/VisitorInfoStorage.php b/lib/Targeting/VisitorInfoStorage.php index bdffffb81ae..11fec04113a 100644 --- a/lib/Targeting/VisitorInfoStorage.php +++ b/lib/Targeting/VisitorInfoStorage.php @@ -28,7 +28,7 @@ public function getVisitorInfo(): VisitorInfo return $this->visitorInfo; } - public function setVisitorInfo(VisitorInfo $visitorInfo) + public function setVisitorInfo(VisitorInfo $visitorInfo): void { $this->visitorInfo = $visitorInfo; } diff --git a/lib/Targeting/VisitorInfoStorageInterface.php b/lib/Targeting/VisitorInfoStorageInterface.php index 51e0250f53c..ac59e8cb5a6 100644 --- a/lib/Targeting/VisitorInfoStorageInterface.php +++ b/lib/Targeting/VisitorInfoStorageInterface.php @@ -27,7 +27,7 @@ interface VisitorInfoStorageInterface { public function getVisitorInfo(): VisitorInfo; - public function setVisitorInfo(VisitorInfo $visitorInfo); + public function setVisitorInfo(VisitorInfo $visitorInfo): void; public function hasVisitorInfo(): bool; } diff --git a/lib/Templating/TwigDefaultDelegatingEngine.php b/lib/Templating/TwigDefaultDelegatingEngine.php index 65514049b45..ce0389b0d17 100644 --- a/lib/Templating/TwigDefaultDelegatingEngine.php +++ b/lib/Templating/TwigDefaultDelegatingEngine.php @@ -20,6 +20,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Templating\DelegatingEngine as BaseDelegatingEngine; use Symfony\Component\Templating\EngineInterface; +use Symfony\Component\Templating\TemplateReferenceInterface; use Twig\Environment; use Twig\Extension\SandboxExtension; @@ -41,7 +42,7 @@ public function __construct(protected Environment $twig, protected Config $confi /** * {@inheritdoc} */ - public function exists($name): bool + public function exists(string|TemplateReferenceInterface $name): bool { if (!$this->delegate) { return $this->twig->getLoader()->exists($name); @@ -55,7 +56,7 @@ public function exists($name): bool * * @throws \Exception */ - public function render($name, array $parameters = []): string + public function render(string|TemplateReferenceInterface $name, array $parameters = []): string { if (!$this->delegate) { return $this->twig->render($name, $parameters); @@ -67,7 +68,7 @@ public function render($name, array $parameters = []): string /** * {@inheritdoc} */ - public function supports($name): bool + public function supports(string|TemplateReferenceInterface $name): bool { if (!$this->delegate) { return true; @@ -76,7 +77,7 @@ public function supports($name): bool } } - public function setDelegate(bool $delegate) + public function setDelegate(bool $delegate): void { $this->delegate = $delegate; } diff --git a/lib/Tool/Console.php b/lib/Tool/Console.php index 5b78a2c07af..0bcbcaccf95 100644 --- a/lib/Tool/Console.php +++ b/lib/Tool/Console.php @@ -51,14 +51,11 @@ public static function getSystemEnvironment(): string } /** - * @param string $name - * @param bool $throwException - * - * @return bool|string + * @return ($throwException is true ? string : string|false) * * @throws \Exception */ - public static function getExecutable(string $name, bool $throwException = false): bool|string + public static function getExecutable(string $name, bool $throwException = false): string|false { if (isset(self::$executableCache[$name])) { if (!self::$executableCache[$name] && $throwException) { @@ -163,11 +160,9 @@ protected static function checkConvert(string $executablePath): bool } /** - * @return mixed - * * @throws \Exception */ - public static function getPhpCli(): mixed + public static function getPhpCli(): string { try { return self::getExecutable('php', true); @@ -182,11 +177,16 @@ public static function getPhpCli(): mixed } } - public static function getTimeoutBinary(): bool|string + public static function getTimeoutBinary(): string|false { return self::getExecutable('timeout'); } + /** + * @param string[] $arguments + * + * @return string[] + */ protected static function buildPhpScriptCmd(string $script, array $arguments = []): array { $phpCli = self::getPhpCli(); @@ -197,20 +197,13 @@ protected static function buildPhpScriptCmd(string $script, array $arguments = [ array_push($cmd, '--env=' . Config::getEnvironment()); } - if (!empty($arguments)) { - $cmd = array_merge($cmd, $arguments); - } + $cmd = array_merge($cmd, $arguments); return $cmd; } /** - * @param string $script - * @param array $arguments - * @param string|null $outputFile - * @param float $timeout - * - * @return string + * @param string[] $arguments */ public static function runPhpScript(string $script, array $arguments = [], string $outputFile = null, float $timeout = 60): string { @@ -353,9 +346,7 @@ protected static function execInBackgroundWindows(string $cmd, string $outputFil } /** - * @param array|string $cmd - * - * @return void + * @param string[]|string $cmd * * @internal */ diff --git a/lib/Tool/Requirements/Check.php b/lib/Tool/Requirements/Check.php index c509cee9dd4..bd95fa97ffe 100644 --- a/lib/Tool/Requirements/Check.php +++ b/lib/Tool/Requirements/Check.php @@ -47,7 +47,7 @@ public function getName(): string return $this->name; } - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -57,7 +57,7 @@ public function getLink(): ?string return $this->link; } - public function setLink(string $link) + public function setLink(string $link): void { $this->link = $link; } @@ -67,7 +67,7 @@ public function getState(): int return $this->state; } - public function setState(int $state) + public function setState(int $state): void { $this->state = $state; } @@ -81,7 +81,7 @@ public function getMessage(): string return $this->message; } - public function setMessage(string $message) + public function setMessage(string $message): void { $this->message = $message; } diff --git a/lib/Tool/Session.php b/lib/Tool/Session.php index e6228da9286..28d81dd84d5 100644 --- a/lib/Tool/Session.php +++ b/lib/Tool/Session.php @@ -198,10 +198,10 @@ public static function getReadOnly(string $namespace = 'pimcore_admin'): Attribu * * @deprecated */ - public static function writeClose() + public static function writeClose(): void { trigger_deprecation('pimcore/pimcore', '10.6', sprintf('Usage of method %s is deprecated since version 10.6 and will be removed in Pimcore 11. No alternative given.', __METHOD__)); - return self::getSessionHandler()->writeClose(); + self::getSessionHandler()->writeClose(); } } diff --git a/lib/Translation/ExportDataExtractorService/DataExtractor/AbstractElementDataExtractor.php b/lib/Translation/ExportDataExtractorService/DataExtractor/AbstractElementDataExtractor.php index 7ea0fb85b91..47046523914 100644 --- a/lib/Translation/ExportDataExtractorService/DataExtractor/AbstractElementDataExtractor.php +++ b/lib/Translation/ExportDataExtractorService/DataExtractor/AbstractElementDataExtractor.php @@ -61,7 +61,7 @@ protected function doExportProperty(Property $property): bool return $property->getType() === 'text' && !$property->isInherited() && !empty($property->getData()); } - protected function addProperties(ElementInterface $element, AttributeSet $result) + protected function addProperties(ElementInterface $element, AttributeSet $result): void { foreach ($element->getProperties() ?: [] as $property) { if ($this->doExportProperty($property)) { diff --git a/lib/Translation/ExportDataExtractorService/DataExtractor/DataObjectDataExtractor.php b/lib/Translation/ExportDataExtractorService/DataExtractor/DataObjectDataExtractor.php index 76ea4555898..b4e03bc6031 100644 --- a/lib/Translation/ExportDataExtractorService/DataExtractor/DataObjectDataExtractor.php +++ b/lib/Translation/ExportDataExtractorService/DataExtractor/DataObjectDataExtractor.php @@ -167,7 +167,7 @@ protected function addLocalizedFields(DataObject\Concrete $object, AttributeSet * @param AttributeSet $result * @param array|null $exportAttributes */ - protected function addBlocksInLocalizedfields(Localizedfields $fd, Data $definition, DataObject\Concrete $object, AttributeSet $result, array $exportAttributes = null) + protected function addBlocksInLocalizedfields(Localizedfields $fd, Data $definition, DataObject\Concrete $object, AttributeSet $result, array $exportAttributes = null): void { $locale = str_replace('-', '_', $result->getSourceLanguage()); if (!Tool::isValidLanguage($locale)) { diff --git a/lib/Translation/ExportService/Exporter/Xliff12Exporter.php b/lib/Translation/ExportService/Exporter/Xliff12Exporter.php index d05588f2b61..b151a00c901 100644 --- a/lib/Translation/ExportService/Exporter/Xliff12Exporter.php +++ b/lib/Translation/ExportService/Exporter/Xliff12Exporter.php @@ -94,7 +94,7 @@ public function getExportFilePath(string $exportId): string return $exportFile; } - protected function prepareExportFile(string $exportFilePath) + protected function prepareExportFile(string $exportFilePath): void { if ($this->xliffFile === null) { $dom = new \DOMDocument(); @@ -108,7 +108,7 @@ public function getContentType(): string return 'application/x-xliff+xml'; } - protected function addTransUnitNode(\SimpleXMLElement $xml, string $name, string $sourceContent, string $sourceLang, ?string $targetContent, string $targetLang) + protected function addTransUnitNode(\SimpleXMLElement $xml, string $name, string $sourceContent, string $sourceLang, ?string $targetContent, string $targetLang): void { $transUnit = $xml->addChild('trans-unit'); $transUnit->addAttribute('id', htmlentities($name)); diff --git a/lib/Translation/ImporterService/Importer/AbstractElementImporter.php b/lib/Translation/ImporterService/Importer/AbstractElementImporter.php index 94f48fb790f..eb14cdc079a 100644 --- a/lib/Translation/ImporterService/Importer/AbstractElementImporter.php +++ b/lib/Translation/ImporterService/Importer/AbstractElementImporter.php @@ -52,13 +52,9 @@ public function import(AttributeSet $attributeSet, bool $saveElement = true): vo } /** - * @param Element\ElementInterface $element - * @param string $targetLanguage - * @param Attribute $attribute - * * @throws \Exception */ - protected function importAttribute(Element\ElementInterface $element, string $targetLanguage, Attribute $attribute) + protected function importAttribute(Element\ElementInterface $element, string $targetLanguage, Attribute $attribute): void { if ($attribute->getType() === Attribute::TYPE_PROPERTY) { $property = $element->getProperty($attribute->getName(), true); @@ -71,11 +67,9 @@ protected function importAttribute(Element\ElementInterface $element, string $ta } /** - * @param Element\ElementInterface $element - * * @throws \Exception */ - protected function saveElement(Element\ElementInterface $element) + protected function saveElement(Element\ElementInterface $element): void { try { $element->save(); diff --git a/lib/Translation/ImporterService/Importer/DataObjectImporter.php b/lib/Translation/ImporterService/Importer/DataObjectImporter.php index 39a7174acc4..4793fe1ec58 100644 --- a/lib/Translation/ImporterService/Importer/DataObjectImporter.php +++ b/lib/Translation/ImporterService/Importer/DataObjectImporter.php @@ -24,13 +24,9 @@ class DataObjectImporter extends AbstractElementImporter { /** - * @param Element\ElementInterface $element - * @param string $targetLanguage - * @param Attribute $attribute - * - * @throws \Exception + * {@inheritdoc} */ - protected function importAttribute(Element\ElementInterface $element, string $targetLanguage, Attribute $attribute) + protected function importAttribute(Element\ElementInterface $element, string $targetLanguage, Attribute $attribute): void { parent::importAttribute($element, $targetLanguage, $attribute); @@ -114,20 +110,20 @@ protected function importAttribute(Element\ElementInterface $element, string $ta } /** - * @param DataObject\Concrete $element - * - * @throws \Exception + * {@inheritdoc} */ - protected function saveElement(Element\ElementInterface $element) + protected function saveElement(Element\ElementInterface $element): void { - $isDirtyDetectionDisabled = DataObject::isDirtyDetectionDisabled(); - - try { - DataObject::disableDirtyDetection(); - $element->setOmitMandatoryCheck(true); - parent::saveElement($element); - } finally { - DataObject::setDisableDirtyDetection($isDirtyDetectionDisabled); + if ($element instanceof DataObject\Concrete) { + $isDirtyDetectionDisabled = DataObject::isDirtyDetectionDisabled(); + + try { + DataObject::disableDirtyDetection(); + $element->setOmitMandatoryCheck(true); + parent::saveElement($element); + } finally { + DataObject::setDisableDirtyDetection($isDirtyDetectionDisabled); + } } } } diff --git a/lib/Translation/ImporterService/Importer/DocumentImporter.php b/lib/Translation/ImporterService/Importer/DocumentImporter.php index bc627f310db..f27de8f6f03 100644 --- a/lib/Translation/ImporterService/Importer/DocumentImporter.php +++ b/lib/Translation/ImporterService/Importer/DocumentImporter.php @@ -25,7 +25,7 @@ class DocumentImporter extends AbstractElementImporter /** * {@inheritdoc} */ - protected function importAttribute(Element\ElementInterface $element, string $targetLanguage, Attribute $attribute) + protected function importAttribute(Element\ElementInterface $element, string $targetLanguage, Attribute $attribute): void { if ($targetLanguage != $element->getProperty('language')) { return; diff --git a/lib/Translation/Translator.php b/lib/Translation/Translator.php index 22b44a48ea8..fa31ef5abf5 100644 --- a/lib/Translation/Translator.php +++ b/lib/Translation/Translator.php @@ -110,7 +110,7 @@ public function trans(string $id, array $parameters = [], string $domain = null, /** * {@inheritdoc} */ - public function setLocale(string $locale) + public function setLocale(string $locale): void { if ($this->translator instanceof LocaleAwareInterface) { $this->translator->setLocale($locale); @@ -155,7 +155,7 @@ public function getCatalogues(): array * @param string $domain * @param string $locale */ - public function lazyInitialize(string $domain, string $locale) + public function lazyInitialize(string $domain, string $locale): void { $cacheKey = $this->getCacheKey($domain, $locale); @@ -240,7 +240,7 @@ public function resetInitialization(string $domain, string $locale): void /** * Reset Catalogues initialization */ - public function resetCache() + public function resetCache(): void { $this->initializedCatalogues = []; } @@ -346,7 +346,7 @@ public function getAdminPath(): string * * @internal */ - public function setAdminPath(string $adminPath) + public function setAdminPath(string $adminPath): void { $this->adminPath = $adminPath; } @@ -386,7 +386,7 @@ public function getKernel(): Kernel * * @internal */ - public function setKernel(Kernel $kernel) + public function setKernel(Kernel $kernel): void { $this->kernel = $kernel; } @@ -396,7 +396,7 @@ public function getDisableTranslations(): bool return $this->disableTranslations; } - public function setDisableTranslations(bool $disableTranslations) + public function setDisableTranslations(bool $disableTranslations): void { $this->disableTranslations = $disableTranslations; } @@ -412,13 +412,8 @@ private function updateLinks(string $text): string /** * Passes through all unknown calls onto the translator object. - * - * @param string $method - * @param array $args - * - * @return mixed */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { return call_user_func_array([$this->translator, $method], $args); } diff --git a/lib/Twig/Extension/CacheExtension.php b/lib/Twig/Extension/CacheExtension.php index 76d0dd423a4..c846712832d 100644 --- a/lib/Twig/Extension/CacheExtension.php +++ b/lib/Twig/Extension/CacheExtension.php @@ -118,7 +118,7 @@ public function stop(): void * @param string $key the cache key * @param bool $isLoadedFromCache true if the content origins from the cache and hasn't been created "live". */ - protected function outputContent(string $content, string $key, bool $isLoadedFromCache) + protected function outputContent(string $content, string $key, bool $isLoadedFromCache): void { echo $content; } @@ -130,7 +130,7 @@ protected function outputContent(string $content, string $key, bool $isLoadedFro * @param string $key * @param array $tags */ - protected function saveContentToCache(string $content, string $key, array $tags) + protected function saveContentToCache(string $content, string $key, array $tags): void { CacheManager::save($content, $key, $tags, $this->lifetime, 996, true); } diff --git a/lib/Twig/Extension/HelpersExtension.php b/lib/Twig/Extension/HelpersExtension.php index e5bf784daa9..4f8b137d517 100644 --- a/lib/Twig/Extension/HelpersExtension.php +++ b/lib/Twig/Extension/HelpersExtension.php @@ -107,13 +107,9 @@ public function getImageVersionPreview(string $file): string } /** - * @param string $file - * - * @return string - * * @throws \Exception */ - public function getAssetVersionPreview($file) + public function getAssetVersionPreview(string $file): string { $dataUri = 'data:'.MimeTypes::getDefault()->guessMimeType($file).';base64,'.base64_encode(file_get_contents($file)); unlink($file); diff --git a/lib/Twig/Extension/Templating/HeadLink.php b/lib/Twig/Extension/Templating/HeadLink.php index dcf688cf8da..d6c98540c68 100644 --- a/lib/Twig/Extension/Templating/HeadLink.php +++ b/lib/Twig/Extension/Templating/HeadLink.php @@ -163,13 +163,8 @@ public function __invoke(?array $attributes = null, string $placement = Containe * - offsetSetAlternate($index, $href, $type, $title, $extras) * - prependAlternate($href, $type, $title, $extras) * - setAlternate($href, $type, $title, $extras) - * - * @param string $method - * @param array $args - * - * @return mixed */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(?PStylesheet|Alternate)$/', $method, $matches)) { $argc = count($args); @@ -270,7 +265,7 @@ public function offsetSet($offset, mixed $value): void * * @param \stdClass $value */ - public function prepend($value) + public function prepend($value): void { if (!$this->_isValid($value)) { throw new Exception('prepend() expects a data token; please use one of the custom prepend*() methods'); @@ -284,7 +279,7 @@ public function prepend($value) * * @param \stdClass $value */ - public function set($value) + public function set($value): void { if (!$this->_isValid($value)) { throw new Exception('set() expects a data token; please use one of the custom set*() methods'); @@ -362,7 +357,7 @@ public function toString(int|string $indent = null): string /** * prepares entries with cache buster prefix */ - protected function prepareEntries() + protected function prepareEntries(): void { foreach ($this as &$item) { if ($this->isCacheBuster()) { diff --git a/lib/Twig/Extension/Templating/HeadMeta.php b/lib/Twig/Extension/Templating/HeadMeta.php index d300f4b7495..f082818f5b7 100644 --- a/lib/Twig/Extension/Templating/HeadMeta.php +++ b/lib/Twig/Extension/Templating/HeadMeta.php @@ -173,7 +173,7 @@ public function getItem(string $type, string $keyValue): mixed * * @return HeadMeta */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { if (preg_match('/^(?Pset|(pre|ap)pend|offsetSet)(?PName|HttpEquiv|Property)$/', $method, $matches)) { $action = $matches['action']; diff --git a/lib/Twig/Extension/Templating/HeadScript.php b/lib/Twig/Extension/Templating/HeadScript.php index c80f20f67f6..c0a0d0a1791 100644 --- a/lib/Twig/Extension/Templating/HeadScript.php +++ b/lib/Twig/Extension/Templating/HeadScript.php @@ -260,7 +260,7 @@ public function captureEnd(): void * * @throws Exception if too few arguments or invalid method */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(?PFile|Script)$/', $method, $matches)) { if (1 > count($args)) { @@ -555,7 +555,7 @@ public function toString(int|string $indent = null): string return $return; } - protected function prepareEntries() + protected function prepareEntries(): void { foreach ($this as &$item) { if (!$this->_isValid($item)) { diff --git a/lib/Twig/Extension/Templating/HeadStyle.php b/lib/Twig/Extension/Templating/HeadStyle.php index 6ec95c83f6a..366ff1a2f7b 100644 --- a/lib/Twig/Extension/Templating/HeadStyle.php +++ b/lib/Twig/Extension/Templating/HeadStyle.php @@ -163,7 +163,7 @@ public function __invoke(string $content = null, string $placement = 'APPEND', a * * @throws Exception When no $content provided or invalid method */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(Style)$/', $method, $matches)) { $index = null; diff --git a/lib/Twig/Extension/Templating/Navigation/Exception/InvalidRendererException.php b/lib/Twig/Extension/Templating/Navigation/Exception/InvalidRendererException.php index a75ab9bd5fd..87c9882427b 100644 --- a/lib/Twig/Extension/Templating/Navigation/Exception/InvalidRendererException.php +++ b/lib/Twig/Extension/Templating/Navigation/Exception/InvalidRendererException.php @@ -21,7 +21,7 @@ class InvalidRendererException extends \LogicException { - public static function create(string $name, mixed $renderer): self + public static function create(string $name, mixed $renderer): static { $type = is_object($renderer) ? get_class($renderer) : gettype($renderer); diff --git a/lib/Twig/Extension/Templating/Navigation/Exception/RendererNotFoundException.php b/lib/Twig/Extension/Templating/Navigation/Exception/RendererNotFoundException.php index 201188e261b..41eb0758e08 100644 --- a/lib/Twig/Extension/Templating/Navigation/Exception/RendererNotFoundException.php +++ b/lib/Twig/Extension/Templating/Navigation/Exception/RendererNotFoundException.php @@ -19,7 +19,7 @@ class RendererNotFoundException extends \InvalidArgumentException { - public static function create(string $name): self + public static function create(string $name): static { return new static(sprintf('The navigation renderer "%s" was not found', $name)); } diff --git a/lib/Twig/Extension/Templating/Placeholder/AbstractExtension.php b/lib/Twig/Extension/Templating/Placeholder/AbstractExtension.php index 3bcefb159ba..c5c96561198 100644 --- a/lib/Twig/Extension/Templating/Placeholder/AbstractExtension.php +++ b/lib/Twig/Extension/Templating/Placeholder/AbstractExtension.php @@ -149,13 +149,8 @@ public function getContainer(): Container /** * Overloading: set property value - * - * @param string $key - * @param mixed $value - * - * @return void */ - public function __set(string $key, mixed $value) + public function __set(string $key, mixed $value): void { $container = $this->getContainer(); $container[$key] = $value; @@ -211,13 +206,8 @@ public function __unset(string $key) * Overload * * Proxy to container methods - * - * @param string $method - * @param array $args - * - * @return mixed */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { $container = $this->getContainer(); if (method_exists($container, $method)) { diff --git a/lib/Twig/Extension/Templating/Placeholder/CacheBusterAware.php b/lib/Twig/Extension/Templating/Placeholder/CacheBusterAware.php index e97c815d2cb..71e8caa7815 100644 --- a/lib/Twig/Extension/Templating/Placeholder/CacheBusterAware.php +++ b/lib/Twig/Extension/Templating/Placeholder/CacheBusterAware.php @@ -26,14 +26,14 @@ abstract class CacheBusterAware extends AbstractExtension /** * prepares entries with cache buster prefix */ - abstract protected function prepareEntries(); + abstract protected function prepareEntries(): void; public function isCacheBuster(): bool { return $this->cacheBuster; } - public function setCacheBuster(bool $cacheBuster) + public function setCacheBuster(bool $cacheBuster): void { $this->cacheBuster = $cacheBuster; } diff --git a/lib/Twig/Node/AssetCompressNode.php b/lib/Twig/Node/AssetCompressNode.php index d8b666fe346..3e4a492b872 100644 --- a/lib/Twig/Node/AssetCompressNode.php +++ b/lib/Twig/Node/AssetCompressNode.php @@ -30,7 +30,7 @@ public function __construct(Node $body, $lineno, $tag = 'pimcoreassetcompress') parent::__construct(['body' => $body], [], $lineno, $tag); } - public function compile(Compiler $compiler) + public function compile(Compiler $compiler): void { $compiler ->addDebugInfo($this) diff --git a/lib/Twig/Sandbox/SecurityPolicy.php b/lib/Twig/Sandbox/SecurityPolicy.php index 68c05d98b7c..40959e02fa9 100644 --- a/lib/Twig/Sandbox/SecurityPolicy.php +++ b/lib/Twig/Sandbox/SecurityPolicy.php @@ -44,17 +44,17 @@ public function __construct(array $allowedTags = [], array $allowedFilters = [], $this->allowedFunctions = $allowedFunctions; } - public function setAllowedTags(array $tags) + public function setAllowedTags(array $tags): void { $this->allowedTags = $tags; } - public function setAllowedFilters(array $filters) + public function setAllowedFilters(array $filters): void { $this->allowedFilters = $filters; } - public function setAllowedFunctions(array $functions) + public function setAllowedFunctions(array $functions): void { $this->allowedFunctions = $functions; } diff --git a/lib/Video/Adapter.php b/lib/Video/Adapter.php index 6079f15a418..76ab06f0cdd 100644 --- a/lib/Video/Adapter.php +++ b/lib/Video/Adapter.php @@ -68,18 +68,9 @@ abstract public function load(string $file, array $options = []): static; abstract public function save(): bool; - /** - * @abstract - * - * @param string $file - * @param int|null $timeOffset - */ - abstract public function saveImage(string $file, int $timeOffset = null); + abstract public function saveImage(string $file, int $timeOffset = null): void; - /** - * @abstract - */ - abstract public function destroy(); + abstract public function destroy(): void; public function getMedias(): ?array { diff --git a/lib/Video/Adapter/Ffmpeg.php b/lib/Video/Adapter/Ffmpeg.php index c99daf5ad6c..211641b9259 100644 --- a/lib/Video/Adapter/Ffmpeg.php +++ b/lib/Video/Adapter/Ffmpeg.php @@ -205,11 +205,7 @@ public function save(): bool return $success; } - /** - * @param string $file - * @param int|null $timeOffset - */ - public function saveImage(string $file, int $timeOffset = null) + public function saveImage(string $file, int $timeOffset = null): void { if (!is_numeric($timeOffset)) { $timeOffset = 5; @@ -299,7 +295,7 @@ public function getDimensions(): ?array return null; } - public function destroy() + public function destroy(): void { if (file_exists($this->getConversionLogFile())) { Logger::debug("FFMPEG finished, last message was:\n" . file_get_contents($this->getConversionLogFile())); @@ -374,7 +370,7 @@ public function setAudioBitrate(int $audioBitrate): static return $this; } - public function resize(int $width, int $height) + public function resize(int $width, int $height): void { // ensure $width & $height are even (mp4 requires this) $width = ceil($width / 2) * 2; @@ -382,14 +378,14 @@ public function resize(int $width, int $height) $this->addArgument('-s', $width.'x'.$height); } - public function scaleByWidth(int $width) + public function scaleByWidth(int $width): void { // ensure $width is even (mp4 requires this) $width = ceil($width / 2) * 2; $this->videoFilter[] = 'scale='.$width.':trunc(ow/a/2)*2'; } - public function scaleByHeight(int $height) + public function scaleByHeight(int $height): void { // ensure $height is even (mp4 requires this) $height = ceil($height / 2) * 2; diff --git a/lib/Web2Print/Processor/PdfReactor.php b/lib/Web2Print/Processor/PdfReactor.php index 4d9f98d650b..5df09c9c073 100644 --- a/lib/Web2Print/Processor/PdfReactor.php +++ b/lib/Web2Print/Processor/PdfReactor.php @@ -226,7 +226,7 @@ public function getProcessingOptions(): array return (array)$event->getArguments()['options']; } - protected function includeApi() + protected function includeApi(): void { include_once(__DIR__ . '/api/PDFreactor.class.php'); } diff --git a/lib/Workflow/Dumper/GraphvizDumper.php b/lib/Workflow/Dumper/GraphvizDumper.php index 5f47567f9f2..a27ca7691fa 100644 --- a/lib/Workflow/Dumper/GraphvizDumper.php +++ b/lib/Workflow/Dumper/GraphvizDumper.php @@ -220,7 +220,7 @@ protected function endDot(): string /** * @internal */ - protected function dotize($id): string + protected function dotize(string $id): string { return strtolower(preg_replace('/[^\w]/i', '_', $id)); } diff --git a/lib/Workflow/EventSubscriber/ChangePublishedStateSubscriber.php b/lib/Workflow/EventSubscriber/ChangePublishedStateSubscriber.php index d1312f3a705..376b257eea0 100644 --- a/lib/Workflow/EventSubscriber/ChangePublishedStateSubscriber.php +++ b/lib/Workflow/EventSubscriber/ChangePublishedStateSubscriber.php @@ -35,7 +35,7 @@ class ChangePublishedStateSubscriber implements EventSubscriberInterface const SAVE_VERSION = 'save_version'; - public function onWorkflowCompleted(Event $event) + public function onWorkflowCompleted(Event $event): void { if (!$this->checkEvent($event)) { return; diff --git a/lib/Workflow/EventSubscriber/NotesSubscriber.php b/lib/Workflow/EventSubscriber/NotesSubscriber.php index f602dc6ec87..6d4549a5268 100644 --- a/lib/Workflow/EventSubscriber/NotesSubscriber.php +++ b/lib/Workflow/EventSubscriber/NotesSubscriber.php @@ -51,7 +51,7 @@ public function __construct(TranslatorInterface $translator) * * @throws ValidationException */ - public function onWorkflowEnter(Event $event) + public function onWorkflowEnter(Event $event): void { if (!$this->checkEvent($event)) { return; @@ -65,7 +65,7 @@ public function onWorkflowEnter(Event $event) $this->handleNotesPreWorkflow($transition, $subject); } - public function onWorkflowCompleted(Event $event) + public function onWorkflowCompleted(Event $event): void { if (!$this->checkEvent($event)) { return; @@ -84,7 +84,7 @@ public function onWorkflowCompleted(Event $event) * * @throws ValidationException */ - public function onPreGlobalAction(GlobalActionEvent $event) + public function onPreGlobalAction(GlobalActionEvent $event): void { if (!$this->checkGlobalActionEvent($event)) { return; @@ -96,7 +96,7 @@ public function onPreGlobalAction(GlobalActionEvent $event) $this->handleNotesPreWorkflow($globalAction, $subject); } - public function onPostGlobalAction(GlobalActionEvent $event) + public function onPostGlobalAction(GlobalActionEvent $event): void { if (!$this->checkGlobalActionEvent($event)) { return; @@ -205,7 +205,10 @@ public function setAdditionalData(array $additionalData = []): void $this->additionalData = $additionalData; } - private function getAdditionalDataForField(array $fieldConfig) + /** + * @param array $fieldConfig + */ + private function getAdditionalDataForField(array $fieldConfig): mixed { $additional = $this->getAdditionalFields(); diff --git a/lib/Workflow/EventSubscriber/NotificationSubscriber.php b/lib/Workflow/EventSubscriber/NotificationSubscriber.php index 55bd433470f..abac5ba4c1a 100644 --- a/lib/Workflow/EventSubscriber/NotificationSubscriber.php +++ b/lib/Workflow/EventSubscriber/NotificationSubscriber.php @@ -62,7 +62,7 @@ public function __construct(NotificationEmailService $mailService, Workflow\Noti $this->workflowManager = $workflowManager; } - public function onWorkflowCompleted(Event $event) + public function onWorkflowCompleted(Event $event): void { if (!$this->checkEvent($event)) { return; diff --git a/lib/Workflow/Manager.php b/lib/Workflow/Manager.php index 6f02a9d2d7e..c6c67625eaa 100644 --- a/lib/Workflow/Manager.php +++ b/lib/Workflow/Manager.php @@ -331,7 +331,7 @@ public function getTransitionByName(string $workflowName, string $transitionName * * @throws \Exception */ - public function ensureInitialPlace(string $workflowName, $subject): bool + public function ensureInitialPlace(string $workflowName, object $subject): bool { if (!$workflow = $this->getWorkflowIfExists($subject, $workflowName)) { return false; diff --git a/lib/Workflow/MarkingStore/DataObjectMultipleStateMarkingStore.php b/lib/Workflow/MarkingStore/DataObjectMultipleStateMarkingStore.php index 3acfeefc14e..0066458ee35 100644 --- a/lib/Workflow/MarkingStore/DataObjectMultipleStateMarkingStore.php +++ b/lib/Workflow/MarkingStore/DataObjectMultipleStateMarkingStore.php @@ -42,7 +42,7 @@ public function __construct(string $property = 'marking', PropertyAccessorInterf /** * @param object $subject */ - public function getMarking($subject): Marking + public function getMarking(object $subject): Marking { $this->checkIfSubjectIsValid($subject); @@ -63,7 +63,7 @@ public function getMarking($subject): Marking * * @return void */ - public function setMarking($subject, Marking $marking, array $context = []) + public function setMarking(object $subject, Marking $marking, array $context = []): void { $subject = $this->checkIfSubjectIsValid($subject); diff --git a/lib/Workflow/MarkingStore/DataObjectSplittedStateMarkingStore.php b/lib/Workflow/MarkingStore/DataObjectSplittedStateMarkingStore.php index 1b59c4ee4ef..c5bbe9a5aa9 100644 --- a/lib/Workflow/MarkingStore/DataObjectSplittedStateMarkingStore.php +++ b/lib/Workflow/MarkingStore/DataObjectSplittedStateMarkingStore.php @@ -51,7 +51,7 @@ public function __construct(string $workflowName, array $places, array $stateMap * * @return Marking */ - public function getMarking($subject): Marking + public function getMarking(object $subject): Marking { $this->checkIfSubjectIsValid($subject); @@ -85,7 +85,7 @@ public function getMarking($subject): Marking * * @return void */ - public function setMarking($subject, Marking $marking, array $context = []) + public function setMarking(object $subject, Marking $marking, array $context = []): void { $subject = $this->checkIfSubjectIsValid($subject); $places = array_keys($marking->getPlaces()); diff --git a/lib/Workflow/MarkingStore/StateTableMarkingStore.php b/lib/Workflow/MarkingStore/StateTableMarkingStore.php index 5860454221c..d9c79095799 100644 --- a/lib/Workflow/MarkingStore/StateTableMarkingStore.php +++ b/lib/Workflow/MarkingStore/StateTableMarkingStore.php @@ -37,7 +37,7 @@ public function __construct(string $workflowName) * * @return Marking */ - public function getMarking($subject): Marking + public function getMarking(object $subject): Marking { $subject = $this->checkIfSubjectIsValid($subject); @@ -67,7 +67,7 @@ public function getMarking($subject): Marking * * @return void */ - public function setMarking($subject, Marking $marking, array $context = []) + public function setMarking(object $subject, Marking $marking, array $context = []): void { $subject = $this->checkIfSubjectIsValid($subject); $type = Service::getElementType($subject); diff --git a/lib/Workflow/Notification/NotificationEmailService.php b/lib/Workflow/Notification/NotificationEmailService.php index 0845534c39d..f3b57d89ad3 100644 --- a/lib/Workflow/Notification/NotificationEmailService.php +++ b/lib/Workflow/Notification/NotificationEmailService.php @@ -56,7 +56,7 @@ public function __construct(EngineInterface $template, RouterInterface $router, * @param string $mailType * @param string $mailPath */ - public function sendWorkflowEmailNotification(array $users, array $roles, Workflow $workflow, string $subjectType, ElementInterface $subject, string $action, string $mailType, string $mailPath) + public function sendWorkflowEmailNotification(array $users, array $roles, Workflow $workflow, string $subjectType, ElementInterface $subject, string $action, string $mailType, string $mailPath): void { try { $recipients = $this->getNotificationUsersByName($users, $roles); @@ -131,7 +131,7 @@ public function sendWorkflowEmailNotification(array $users, array $roles, Workfl * @param string $mailPath * @param string $deeplink */ - protected function sendPimcoreDocumentMail(array $recipients, string $subjectType, ElementInterface $subject, Workflow $workflow, string $action, string $language, string $mailPath, string $deeplink) + protected function sendPimcoreDocumentMail(array $recipients, string $subjectType, ElementInterface $subject, Workflow $workflow, string $action, string $language, string $mailPath, string $deeplink): void { $mail = new \Pimcore\Mail(['document' => $mailPath, 'params' => $this->getNotificationEmailParameters($subjectType, $subject, $workflow, $action, $deeplink, $language)]); @@ -152,7 +152,7 @@ protected function sendPimcoreDocumentMail(array $recipients, string $subjectTyp * @param string $mailPath * @param string $deeplink */ - protected function sendTemplateMail(array $recipients, string $subjectType, ElementInterface $subject, Workflow $workflow, string $action, string $language, string $mailPath, string $deeplink) + protected function sendTemplateMail(array $recipients, string $subjectType, ElementInterface $subject, Workflow $workflow, string $action, string $language, string $mailPath, string $deeplink): void { $mail = new \Pimcore\Mail(); diff --git a/lib/Workflow/Notification/PimcoreNotificationService.php b/lib/Workflow/Notification/PimcoreNotificationService.php index d894f1e1055..4e9f23f7355 100644 --- a/lib/Workflow/Notification/PimcoreNotificationService.php +++ b/lib/Workflow/Notification/PimcoreNotificationService.php @@ -39,7 +39,7 @@ public function __construct(NotificationService $notificationService, Translator $this->translator = $translator; } - public function sendPimcoreNotification(array $users, array $roles, Workflow $workflow, string $subjectType, ElementInterface $subject, string $action) + public function sendPimcoreNotification(array $users, array $roles, Workflow $workflow, string $subjectType, ElementInterface $subject, string $action): void { try { $recipients = $this->getNotificationUsersByName($users, $roles, true); diff --git a/lib/Workflow/SupportStrategy/ExpressionSupportStrategy.php b/lib/Workflow/SupportStrategy/ExpressionSupportStrategy.php index d3e2a6cd08c..94dd49e620c 100644 --- a/lib/Workflow/SupportStrategy/ExpressionSupportStrategy.php +++ b/lib/Workflow/SupportStrategy/ExpressionSupportStrategy.php @@ -48,7 +48,7 @@ public function __construct(ExpressionService $expressionService, array|string $ $this->expression = $expression; } - public function supports(WorkflowInterface $workflow, $subject): bool + public function supports(WorkflowInterface $workflow, object $subject): bool { if (!$this->supportsClass($subject)) { return false; diff --git a/lib/helper-functions.php b/lib/helper-functions.php index 448525350ec..72937215995 100644 --- a/lib/helper-functions.php +++ b/lib/helper-functions.php @@ -532,7 +532,7 @@ function var_export_pretty(mixed $var, string $indent = ''): string } } -function to_php_data_file_format(mixed $contents, $comments = null): string +function to_php_data_file_format(mixed $contents, ?string $comments = null): string { $contents = var_export_pretty($contents); diff --git a/models/Asset.php b/models/Asset.php index 179ff85377c..de1730f5132 100644 --- a/models/Asset.php +++ b/models/Asset.php @@ -583,7 +583,7 @@ public function save(array $parameters = []): static * * @throws Exception|DuplicateFullPathException */ - public function correctPath() + public function correctPath(): void { // set path if ($this->getId() != 1) { // not for the root node @@ -649,7 +649,7 @@ public function correctPath() * * @internal */ - protected function update(array $params = []) + protected function update(array $params = []): void { $storage = Storage::get('asset'); $this->updateModificationInfos(); @@ -768,7 +768,7 @@ protected function update(array $params = []) /** * @internal */ - protected function postPersistData() + protected function postPersistData(): void { // hook for the save process, can be overwritten in implementations, such as Image } @@ -941,7 +941,7 @@ private function deletePhysicalFile(): void } } - public function delete(bool $isNested = false) + public function delete(bool $isNested = false): void { if ($this->getId() == 1) { throw new Exception('root-node cannot be deleted'); @@ -1019,7 +1019,7 @@ public function delete(bool $isNested = false) $this->dispatchEvent(new AssetEvent($this), AssetEvents::POST_DELETE); } - public function clearDependentCache(array $additionalTags = []) + public function clearDependentCache(array $additionalTags = []): void { try { $tags = [$this->getCacheTag(), 'asset_properties', 'output']; @@ -1227,7 +1227,7 @@ public function getCustomSetting(string $key): mixed return null; } - public function removeCustomSetting(string $key) + public function removeCustomSetting(string $key): void { if (is_array($this->customSettings) && array_key_exists($key, $this->customSettings)) { unset($this->customSettings[$key]); @@ -1441,7 +1441,7 @@ public function getMetadata(?string $name = null, ?string $language = null, bool return $result; } - private function transformMetadata(array $metaData) + private function transformMetadata(array $metaData): mixed { $loader = Pimcore::getContainer()->get('pimcore.implementation_loader.asset.metadata.data'); $transformedData = $metaData['data']; @@ -1518,7 +1518,7 @@ public function setParent(?ElementInterface $parent): static return $this; } - public function __wakeup() + public function __wakeup(): void { if ($this->isInDumpState()) { // set current parent and path, this is necessary because the serialized data can have a different path than the original element (element was moved) @@ -1582,7 +1582,7 @@ public function __clone() $this->closeStream(); } - public function clearThumbnails(bool $force = false) + public function clearThumbnails(bool $force = false): void { if ($this->getDataChanged() || $force) { foreach (['thumbnail', 'asset_cache'] as $storageName) { @@ -1669,7 +1669,7 @@ private function clearFolderThumbnails(Asset $asset): void } while ($asset !== null); } - public function clearThumbnail(string $name) + public function clearThumbnail(string $name): void { try { Storage::get('thumbnail')->deleteDirectory($this->getRealPath().'/'.$this->getId().'/image-thumb__'.$this->getId().'__'.$name); diff --git a/models/Asset/Dao.php b/models/Asset/Dao.php index d9e2283c8b8..06eaf50847f 100644 --- a/models/Asset/Dao.php +++ b/models/Asset/Dao.php @@ -45,7 +45,7 @@ class Dao extends Model\Element\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative("SELECT assets.*, tree_locks.locked FROM assets LEFT JOIN tree_locks ON assets.id = tree_locks.id AND tree_locks.type = 'asset' @@ -89,7 +89,7 @@ public function getById(int $id) * * @throws Model\Exception\NotFoundException */ - public function getByPath(string $path) + public function getByPath(string $path): void { $params = $this->extractKeyAndPath($path); $data = $this->db->fetchAssociative('SELECT id FROM assets WHERE `path` = :path AND `filename` = :key', $params); @@ -101,7 +101,7 @@ public function getByPath(string $path) } } - public function create() + public function create(): void { $this->db->insert('assets', [ 'filename' => $this->model->getFilename(), @@ -112,7 +112,7 @@ public function create() $this->model->setId((int) $this->db->lastInsertId()); } - public function update() + public function update(): void { $asset = $this->model->getObjectVars(); @@ -181,12 +181,12 @@ public function update() } } - public function delete() + public function delete(): void { $this->db->delete('assets', ['id' => $this->model->getId()]); } - public function updateWorkspaces() + public function updateWorkspaces(): void { $this->db->update('users_workspaces_asset', [ 'cpath' => $this->model->getRealFullPath(), @@ -285,7 +285,7 @@ public function getProperties(bool $onlyInherited = false): array /** * deletes all properties for the object from database */ - public function deleteAllProperties() + public function deleteAllProperties(): void { $this->db->delete('properties', ['cid' => $this->model->getId(), 'ctype' => 'asset']); } @@ -513,7 +513,7 @@ public function areAllowed(array $columns, User $user): array return $this->permissionByTypes($columns, $user, 'asset'); } - public function updateCustomSettings() + public function updateCustomSettings(): void { $customSettingsData = Serialize::serialize($this->model->getCustomSettings()); $this->db->update('assets', ['customSettings' => $customSettingsData], ['id' => $this->model->getId()]); diff --git a/models/Asset/Document.php b/models/Asset/Document.php index e8c3325745d..ad6edd8efd5 100644 --- a/models/Asset/Document.php +++ b/models/Asset/Document.php @@ -33,7 +33,7 @@ class Document extends Model\Asset /** * {@inheritdoc} */ - protected function update(array $params = []) + protected function update(array $params = []): void { if ($this->getDataChanged()) { $this->removeCustomSetting('document_page_count'); @@ -51,7 +51,7 @@ protected function update(array $params = []) * * @internal */ - public function processPageCount(string $path = null) + public function processPageCount(string $path = null): void { $pageCount = null; if (!\Pimcore\Document::isAvailable()) { diff --git a/models/Asset/Image.php b/models/Asset/Image.php index ba02df13c65..3b3a58356bb 100644 --- a/models/Asset/Image.php +++ b/models/Asset/Image.php @@ -42,7 +42,7 @@ class Image extends Model\Asset /** * {@inheritdoc} */ - protected function update(array $params = []) + protected function update(array $params = []): void { if ($this->getDataChanged()) { foreach (['imageWidth', 'imageHeight', 'imageDimensionsCalculated'] as $key) { diff --git a/models/Asset/Image/Thumbnail/Config.php b/models/Asset/Image/Thumbnail/Config.php index 77fa2222491..04b4186a0a1 100644 --- a/models/Asset/Image/Thumbnail/Config.php +++ b/models/Asset/Image/Thumbnail/Config.php @@ -288,7 +288,7 @@ public static function getPreviewConfig(): Config return $thumbnail; } - protected function createMediaIfNotExists(string $name) + protected function createMediaIfNotExists(string $name): void { if (!array_key_exists($name, $this->medias)) { $this->medias[$name] = []; @@ -352,7 +352,7 @@ public function addItemAt(int $position, string $name, array $parameters, ?strin /** * @internal */ - public function resetItems() + public function resetItems(): void { $this->items = []; $this->medias = []; @@ -441,7 +441,7 @@ public function getQuality(): int return $this->quality; } - public function setHighResolution(?float $highResolution) + public function setHighResolution(?float $highResolution): void { $this->highResolution = $highResolution; } @@ -451,7 +451,7 @@ public function getHighResolution(): ?float return $this->highResolution; } - public function setMedias(array $medias) + public function setMedias(array $medias): void { $this->medias = $medias; } @@ -466,7 +466,7 @@ public function hasMedias(): bool return !empty($this->medias); } - public function setFilenameSuffix(string $filenameSuffix) + public function setFilenameSuffix(string $filenameSuffix): void { $this->filenameSuffix = $filenameSuffix; } @@ -696,7 +696,7 @@ public function getModificationDate(): ?int return $this->modificationDate; } - public function setModificationDate(int $modificationDate) + public function setModificationDate(int $modificationDate): void { $this->modificationDate = $modificationDate; } @@ -706,7 +706,7 @@ public function getCreationDate(): ?int return $this->creationDate; } - public function setCreationDate(int $creationDate) + public function setCreationDate(int $creationDate): void { $this->creationDate = $creationDate; } @@ -716,7 +716,7 @@ public function isPreserveColor(): bool return $this->preserveColor; } - public function setPreserveColor(bool $preserveColor) + public function setPreserveColor(bool $preserveColor): void { $this->preserveColor = $preserveColor; } @@ -726,7 +726,7 @@ public function isPreserveMetaData(): bool return $this->preserveMetaData; } - public function setPreserveMetaData(bool $preserveMetaData) + public function setPreserveMetaData(bool $preserveMetaData): void { $this->preserveMetaData = $preserveMetaData; } diff --git a/models/Asset/Image/Thumbnail/Config/Dao.php b/models/Asset/Image/Thumbnail/Config/Dao.php index 6d7d30cb254..1ca6ffaea52 100644 --- a/models/Asset/Image/Thumbnail/Config/Dao.php +++ b/models/Asset/Image/Thumbnail/Config/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -42,7 +42,7 @@ public function configure() * * @throws \Exception */ - public function getByName(string $id = null) + public function getByName(string $id = null): void { if ($id != null) { $this->model->setName($id); @@ -75,7 +75,7 @@ public function exists(string $name): bool * * @throws \Exception */ - public function save(bool $forceClearTempFiles = false) + public function save(bool $forceClearTempFiles = false): void { $ts = time(); if (!$this->model->getCreationDate()) { @@ -132,7 +132,7 @@ protected function prepareDataStructureForYaml(string $id, mixed $data): mixed * * @param bool $forceClearTempFiles force removing generated thumbnail files of saved thumbnail config */ - public function delete(bool $forceClearTempFiles = false) + public function delete(bool $forceClearTempFiles = false): void { $this->deleteData($this->model->getName()); @@ -154,7 +154,7 @@ private function clearDatabaseCache(): void Model\Asset\Dao::$thumbnailStatusCache = []; } - protected function autoClearTempFiles() + protected function autoClearTempFiles(): void { $enabled = \Pimcore::getContainer()->getParameter('pimcore.config')['assets']['image']['thumbnails']['auto_clear_temp_files']; if ($enabled) { diff --git a/models/Asset/MetaData/ClassDefinition/Data/Data.php b/models/Asset/MetaData/ClassDefinition/Data/Data.php index 4a8c213e0d6..8079e2109ec 100644 --- a/models/Asset/MetaData/ClassDefinition/Data/Data.php +++ b/models/Asset/MetaData/ClassDefinition/Data/Data.php @@ -104,7 +104,7 @@ public function isEmpty(mixed $data, array $params = []): bool return empty($data); } - public function checkValidity(mixed $data, array $params = []) + public function checkValidity(mixed $data, array $params = []): void { } diff --git a/models/Asset/MetaData/ClassDefinition/Data/DataDefinitionInterface.php b/models/Asset/MetaData/ClassDefinition/Data/DataDefinitionInterface.php index a6d0705d751..59b0475807c 100644 --- a/models/Asset/MetaData/ClassDefinition/Data/DataDefinitionInterface.php +++ b/models/Asset/MetaData/ClassDefinition/Data/DataDefinitionInterface.php @@ -26,7 +26,7 @@ public function isEmpty(mixed $data, array $params = []): bool; * * @throws \Exception */ - public function checkValidity(mixed $data, array $params = []); + public function checkValidity(mixed $data, array $params = []): void; public function getDataForListfolderGrid(mixed $data, array $params = []): mixed; diff --git a/models/Asset/Video.php b/models/Asset/Video.php index efcd0ee460c..f6a446d677c 100644 --- a/models/Asset/Video.php +++ b/models/Asset/Video.php @@ -38,7 +38,7 @@ class Video extends Model\Asset /** * {@inheritdoc} */ - protected function update(array $params = []) + protected function update(array $params = []): void { if ($this->getDataChanged()) { foreach (['duration', 'videoWidth', 'videoHeight'] as $key) { @@ -53,7 +53,7 @@ protected function update(array $params = []) parent::update($params); } - public function clearThumbnails(bool $force = false) + public function clearThumbnails(bool $force = false): void { if ($this->getDataChanged() || $force) { // clear the thumbnail custom settings diff --git a/models/Asset/Video/Thumbnail/Config.php b/models/Asset/Video/Thumbnail/Config.php index 0da7f7223bb..44a2ba9f528 100644 --- a/models/Asset/Video/Thumbnail/Config.php +++ b/models/Asset/Video/Thumbnail/Config.php @@ -205,7 +205,7 @@ public function addItem(string $name, array $parameters, string $media = null): * * @internal */ - public function addItemAt(int $position, string $name, array $parameters, $media = null): bool + public function addItemAt(int $position, string $name, array $parameters, ?string $media = null): bool { if (!$media || $media == 'default') { $itemContainer = &$this->items; @@ -246,7 +246,7 @@ public function selectMedia(string $name): bool /** * @internal */ - public function resetItems() + public function resetItems(): void { $this->items = []; $this->medias = []; @@ -276,7 +276,7 @@ public function getItems(): array return $this->items; } - public function setMedias(array $medias) + public function setMedias(array $medias): void { $this->medias = $medias; } @@ -291,7 +291,7 @@ public function hasMedias(): bool return !empty($this->medias); } - public function setFilenameSuffix(string $filenameSuffix) + public function setFilenameSuffix(string $filenameSuffix): void { $this->filenameSuffix = $filenameSuffix; } @@ -368,7 +368,7 @@ public function getModificationDate(): ?int return $this->modificationDate; } - public function setModificationDate(int $modificationDate) + public function setModificationDate(int $modificationDate): void { $this->modificationDate = $modificationDate; } @@ -378,7 +378,7 @@ public function getCreationDate(): ?int return $this->creationDate; } - public function setCreationDate(int $creationDate) + public function setCreationDate(int $creationDate): void { $this->creationDate = $creationDate; } diff --git a/models/Asset/Video/Thumbnail/Config/Dao.php b/models/Asset/Video/Thumbnail/Config/Dao.php index 3392d593790..8dade5611a3 100644 --- a/models/Asset/Video/Thumbnail/Config/Dao.php +++ b/models/Asset/Video/Thumbnail/Config/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -42,7 +42,7 @@ public function configure() * * @throws \Exception */ - public function getByName(string $id = null) + public function getByName(string $id = null): void { if ($id != null) { $this->model->setName($id); @@ -68,7 +68,7 @@ public function getByName(string $id = null) /** * @throws \Exception */ - public function save() + public function save(): void { $ts = time(); if (!$this->model->getCreationDate()) { @@ -94,13 +94,13 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getName()); $this->autoClearTempFiles(); } - protected function autoClearTempFiles() + protected function autoClearTempFiles(): void { $enabled = \Pimcore::getContainer()->getParameter('pimcore.config')['assets']['video']['thumbnails']['auto_clear_temp_files']; if ($enabled) { diff --git a/models/Asset/WebDAV/File.php b/models/Asset/WebDAV/File.php index 2197b1c7de2..974e17edce2 100644 --- a/models/Asset/WebDAV/File.php +++ b/models/Asset/WebDAV/File.php @@ -66,7 +66,7 @@ public function setName($name): static * @throws DAV\Exception\Forbidden * @throws \Exception */ - public function delete() + public function delete(): void { if ($this->asset->isAllowed('delete')) { Asset\Service::loadAllFields($this->asset); @@ -104,7 +104,7 @@ public function getLastModified(): int * * @return null */ - public function put($data) + public function put($data): null { if ($this->asset->isAllowed('publish')) { // read from resource -> default for SabreDAV diff --git a/models/Asset/WebDAV/Folder.php b/models/Asset/WebDAV/Folder.php index 38fdd2079f7..c979e99895f 100644 --- a/models/Asset/WebDAV/Folder.php +++ b/models/Asset/WebDAV/Folder.php @@ -106,7 +106,7 @@ public function getName(): string * * @return null */ - public function createFile($name, $data = null) + public function createFile($name, $data = null): null { $tmpFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . '/asset-dav-tmp-file-' . uniqid(); if (is_resource($data)) { @@ -139,7 +139,7 @@ public function createFile($name, $data = null) * * @throws DAV\Exception\Forbidden */ - public function createDirectory($name) + public function createDirectory($name): void { $user = AdminTool::getCurrentUser(); @@ -159,7 +159,7 @@ public function createDirectory($name) * @throws DAV\Exception\Forbidden * @throws \Exception */ - public function delete() + public function delete(): void { if ($this->asset->isAllowed('delete')) { $this->asset->delete(); diff --git a/models/Asset/WebDAV/Tree.php b/models/Asset/WebDAV/Tree.php index 2bdf596a171..1f1c05f9c92 100644 --- a/models/Asset/WebDAV/Tree.php +++ b/models/Asset/WebDAV/Tree.php @@ -32,7 +32,7 @@ class Tree extends DAV\Tree * @param string $sourcePath * @param string $destinationPath */ - public function move($sourcePath, $destinationPath) + public function move($sourcePath, $destinationPath): void { $nameParts = explode('/', $sourcePath); $nameParts[count($nameParts) - 1] = Element\Service::getValidKey($nameParts[count($nameParts) - 1], 'asset'); diff --git a/models/DataObject/AbstractObject.php b/models/DataObject/AbstractObject.php index d83f0a9992e..b7d3bd03195 100644 --- a/models/DataObject/AbstractObject.php +++ b/models/DataObject/AbstractObject.php @@ -268,7 +268,7 @@ public static function getHideUnpublished(): bool * * @param bool $hideUnpublished */ - public static function setHideUnpublished(bool $hideUnpublished) + public static function setHideUnpublished(bool $hideUnpublished): void { self::$hideUnpublished = $hideUnpublished; } @@ -288,7 +288,7 @@ public static function doHideUnpublished(): bool * * @param bool $getInheritedValues */ - public static function setGetInheritedValues(bool $getInheritedValues) + public static function setGetInheritedValues(bool $getInheritedValues): void { self::$getInheritedValues = $getInheritedValues; } @@ -565,14 +565,12 @@ public function hasSiblings( * * @throws \Exception */ - protected function doDelete() + protected function doDelete(): void { // delete children $children = $this->getChildren(self::$types, true); - if (count($children) > 0) { - foreach ($children as $child) { - $child->delete(); - } + foreach ($children as $child) { + $child->delete(); } // remove dependencies @@ -586,7 +584,7 @@ protected function doDelete() /** * @throws \Exception */ - public function delete() + public function delete(): void { $this->dispatchEvent(new DataObjectEvent($this), DataObjectEvents::PRE_DELETE); @@ -776,7 +774,7 @@ public function save(array $parameters = []): static * * @throws \Exception|DuplicateFullPathException */ - protected function correctPath() + protected function correctPath(): void { // set path if ($this->getId() != 1) { // not for the root node @@ -834,7 +832,7 @@ protected function correctPath() * * @internal */ - protected function update(bool $isUpdate = null, array $params = []) + protected function update(bool $isUpdate = null, array $params = []): void { $this->updateModificationInfos(); @@ -874,7 +872,7 @@ protected function update(bool $isUpdate = null, array $params = []) RuntimeCache::set(self::getCacheKey($this->getId()), $this); } - public function clearDependentCache(array $additionalTags = []) + public function clearDependentCache(array $additionalTags = []): void { self::clearDependentCacheByObjectId($this->getId(), $additionalTags); } @@ -885,7 +883,7 @@ public function clearDependentCache(array $additionalTags = []) * * @internal */ - public static function clearDependentCacheByObjectId(int $objectId, array $additionalTags = []) + public static function clearDependentCacheByObjectId(int $objectId, array $additionalTags = []): void { if (!$objectId) { throw new \Exception('object ID missing'); @@ -906,7 +904,7 @@ public static function clearDependentCacheByObjectId(int $objectId, array $addit * * @internal */ - public function saveIndex(int $index) + public function saveIndex(int $index): void { $this->getDao()->saveIndex($index); $this->clearDependentCache(); @@ -992,7 +990,7 @@ public function setIndex(int $index): static return $this; } - public function setChildrenSortBy(?string $childrenSortBy) + public function setChildrenSortBy(?string $childrenSortBy): void { if ($this->childrenSortBy !== $childrenSortBy) { $this->children = []; @@ -1050,7 +1048,7 @@ public static function doNotRestoreKeyAndPath(): bool return self::$doNotRestoreKeyAndPath; } - public static function setDoNotRestoreKeyAndPath(bool $doNotRestoreKeyAndPath) + public static function setDoNotRestoreKeyAndPath(bool $doNotRestoreKeyAndPath): void { self::$doNotRestoreKeyAndPath = (bool) $doNotRestoreKeyAndPath; } @@ -1105,7 +1103,7 @@ public static function isDirtyDetectionDisabled(): bool * * @param bool $disableDirtyDetection */ - public static function setDisableDirtyDetection(bool $disableDirtyDetection) + public static function setDisableDirtyDetection(bool $disableDirtyDetection): void { self::$disableDirtyDetection = $disableDirtyDetection; } @@ -1113,7 +1111,7 @@ public static function setDisableDirtyDetection(bool $disableDirtyDetection) /** * @internal */ - public static function disableDirtyDetection() + public static function disableDirtyDetection(): void { self::setDisableDirtyDetection(true); } @@ -1121,7 +1119,7 @@ public static function disableDirtyDetection() /** * @internal */ - public static function enableDirtyDetection() + public static function enableDirtyDetection(): void { self::setDisableDirtyDetection(false); } diff --git a/models/DataObject/AbstractObject/Dao.php b/models/DataObject/AbstractObject/Dao.php index a3f3b876e6b..824647bc3d2 100644 --- a/models/DataObject/AbstractObject/Dao.php +++ b/models/DataObject/AbstractObject/Dao.php @@ -36,7 +36,7 @@ class Dao extends Model\Element\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative("SELECT objects.*, tree_locks.locked as locked FROM objects LEFT JOIN tree_locks ON objects.id = tree_locks.id AND tree_locks.type = 'object' @@ -56,7 +56,7 @@ public function getById(int $id) * * @throws Model\Exception\NotFoundException */ - public function getByPath(string $path) + public function getByPath(string $path): void { $params = $this->extractKeyAndPath($path); $data = $this->db->fetchAssociative('SELECT id FROM objects WHERE `path` = :path AND `key` = :key', $params); @@ -71,7 +71,7 @@ public function getByPath(string $path) /** * Create a new record for the object in database */ - public function create() + public function create(): void { $this->db->insert('objects', Helper::quoteDataIdentifiers($this->db, [ 'key' => $this->model->getKey(), @@ -89,7 +89,7 @@ public function create() * * @throws \Exception */ - public function update(bool $isUpdate = null) + public function update(bool $isUpdate = null): void { $object = $this->model->getObjectVars(); @@ -142,7 +142,7 @@ public function delete(): void $this->db->delete('objects', ['id' => $this->model->getId()]); } - public function updateWorkspaces() + public function updateWorkspaces(): void { $this->db->update('users_workspaces_object', [ 'cpath' => $this->model->getRealFullPath(), @@ -648,7 +648,7 @@ public function getChildPermissions(?string $type, User $user, bool $quote = tru return $permissions; } - public function saveIndex(int $index) + public function saveIndex(int $index): void { $this->db->update('objects', [ 'index' => $index, diff --git a/models/DataObject/ClassDefinition.php b/models/DataObject/ClassDefinition.php index cb94e7e13e0..58e102c65d5 100644 --- a/models/DataObject/ClassDefinition.php +++ b/models/DataObject/ClassDefinition.php @@ -346,7 +346,7 @@ public static function create(array $values = []): ClassDefinition * * @internal */ - public function rename(string $name) + public function rename(string $name): void { $this->deletePhpClasses(); $this->getDao()->updateClassNameInObjects($name); @@ -360,7 +360,7 @@ public function rename(string $name) * * @internal */ - public static function cleanupForExport(mixed &$data) + public static function cleanupForExport(mixed &$data): void { if (!is_object($data)) { return; @@ -402,7 +402,7 @@ private function exists(): bool * @throws \Exception * @throws DataObject\Exception\DefinitionWriteException */ - public function save(bool $saveDefinitionFile = true) + public function save(bool $saveDefinitionFile = true): void { if ($saveDefinitionFile && !$this->isWritable()) { throw new DataObject\Exception\DefinitionWriteException(); @@ -492,7 +492,7 @@ public function save(bool $saveDefinitionFile = true) * * @internal */ - public function generateClassFiles(bool $generateDefinitionFile = true) + public function generateClassFiles(bool $generateDefinitionFile = true): void { \Pimcore::getContainer()->get(PHPClassDumperInterface::class)->dumpPHPClasses($this); @@ -559,7 +559,7 @@ protected function getInfoDocBlock(): string return $cd; } - public function delete() + public function delete(): void { $this->dispatchEvent(new ClassDefinitionEvent($this), DataObjectClassDefinitionEvents::PRE_DELETE); @@ -944,7 +944,7 @@ public function setEncryption(bool $encryption): static * * @param array $tables */ - public function addEncryptedTables(array $tables) + public function addEncryptedTables(array $tables): void { $this->encryptedTables = array_unique(array_merge($this->encryptedTables, $tables)); } @@ -954,7 +954,7 @@ public function addEncryptedTables(array $tables) * * @param array $tables */ - public function removeEncryptedTables(array $tables) + public function removeEncryptedTables(array $tables): void { foreach ($tables as $table) { if (($key = array_search($table, $this->encryptedTables)) !== false) { diff --git a/models/DataObject/ClassDefinition/CustomLayout.php b/models/DataObject/ClassDefinition/CustomLayout.php index a5e2125010e..e25d31de131 100644 --- a/models/DataObject/ClassDefinition/CustomLayout.php +++ b/models/DataObject/ClassDefinition/CustomLayout.php @@ -174,7 +174,7 @@ public static function create(array $values = []): CustomLayout * * @throws DataObject\Exception\DefinitionWriteException */ - public function save() + public function save(): void { if (!$this->isWriteable()) { throw new DataObject\Exception\DefinitionWriteException(); @@ -241,7 +241,7 @@ public static function getIdentifier(string $classId): ?UuidV4 } } - public function delete() + public function delete(): void { // empty object cache try { @@ -367,7 +367,7 @@ public function getDescription(): string return $this->description; } - public function setLayoutDefinitions(?Layout $layoutDefinitions) + public function setLayoutDefinitions(?Layout $layoutDefinitions): void { $this->layoutDefinitions = $layoutDefinitions; } @@ -377,7 +377,7 @@ public function getLayoutDefinitions(): ?Layout return $this->layoutDefinitions; } - public function setClassId(string $classId) + public function setClassId(string $classId): void { $this->classId = $classId; } diff --git a/models/DataObject/ClassDefinition/CustomLayout/Dao.php b/models/DataObject/ClassDefinition/CustomLayout/Dao.php index ad4eaa80c57..49407e2a907 100644 --- a/models/DataObject/ClassDefinition/CustomLayout/Dao.php +++ b/models/DataObject/ClassDefinition/CustomLayout/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao */ protected $model; - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -48,7 +48,7 @@ public function configure() * * @throws Model\Exception\NotFoundException */ - public function getById(string $id = null) + public function getById(string $id = null): void { if ($id != null) { $this->model->setId($id); @@ -77,7 +77,7 @@ public function getById(string $id = null) } } - public function getByName(string $name) + public function getByName(string $name): void { $list = new Listing(); /** @var Model\DataObject\ClassDefinition\CustomLayout[] $definitions */ @@ -174,7 +174,7 @@ public function getLatestIdentifier(string $classId): UuidV4 * * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->model->setId((string)Uid::v4()); @@ -208,7 +208,7 @@ public function save() /** * Deletes custom layout */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getId()); } diff --git a/models/DataObject/ClassDefinition/Dao.php b/models/DataObject/ClassDefinition/Dao.php index 8cb1d4910d2..0019c7127fe 100644 --- a/models/DataObject/ClassDefinition/Dao.php +++ b/models/DataObject/ClassDefinition/Dao.php @@ -82,7 +82,7 @@ public function getIdByName(string $name): string * * @throws \Exception */ - public function save(bool $isUpdate = true) + public function save(bool $isUpdate = true): void { if (!$this->model->getId() || !$isUpdate) { $this->create(); @@ -94,7 +94,7 @@ public function save(bool $isUpdate = true) /** * @throws \Exception */ - public function update() + public function update(): void { $class = $this->model->getObjectVars(); $data = []; @@ -238,7 +238,7 @@ public function create(): void /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('classes', ['id' => $this->model->getId()]); @@ -295,7 +295,7 @@ public function delete() * * @param string $newName */ - public function updateClassNameInObjects(string $newName) + public function updateClassNameInObjects(string $newName): void { $this->db->update('objects', ['className' => $newName], ['classId' => $this->model->getId()]); diff --git a/models/DataObject/ClassDefinition/Data.php b/models/DataObject/ClassDefinition/Data.php index 88250fb71a8..d4b01df8afb 100644 --- a/models/DataObject/ClassDefinition/Data.php +++ b/models/DataObject/ClassDefinition/Data.php @@ -115,7 +115,7 @@ abstract public function getDataFromEditmode(mixed $data, DataObject\Concrete $o * * @throws \Exception */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $isEmpty = true; @@ -1227,12 +1227,12 @@ protected function getDataFromObjectParam(DataObject\Localizedfield|DataObject\F return $data; } - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { // implement in child classes } - public function adoptMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function adoptMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $vars = get_object_vars($this); $protectedFields = ['noteditable', 'invisible']; @@ -1274,7 +1274,7 @@ public function supportsDirtyDetection(): bool return false; } - public function markLazyloadedFieldAsLoaded(Localizedfield|AbstractData|Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object) + public function markLazyloadedFieldAsLoaded(Localizedfield|AbstractData|Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object): void { if ($object instanceof DataObject\LazyLoadedFieldsInterface) { $object->markLazyKeyAsLoaded($this->getName()); diff --git a/models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php b/models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php index ac50241c037..5d9d5f41342 100644 --- a/models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php +++ b/models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php @@ -377,7 +377,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -582,7 +582,7 @@ public function preGetData(mixed $container, array $params = []): array return Element\Service::filterUnpublishedAdvancedElements($data); } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { $db = Db::get(); $context = $params['context'] ?? null; @@ -691,12 +691,12 @@ public function getEnableBatchEdit(): bool return $this->enableBatchEdit; } - public function setEnableBatchEdit(bool $enableBatchEdit) + public function setEnableBatchEdit(bool $enableBatchEdit): void { $this->enableBatchEdit = (bool) $enableBatchEdit; } - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { /** @var DataObject\Data\ObjectMetadata $temp */ $temp = \Pimcore::getContainer()->get('pimcore.model.factory') @@ -735,7 +735,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * {@inheritdoc} */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { if ($masterDefinition instanceof self) { $this->allowedClassId = $masterDefinition->getAllowedClassId(); @@ -892,7 +892,7 @@ public function normalize(mixed $value, array $params = []): ?array * * @return array */ - protected function processDiffDataForEditMode($originalData, $data, $object = null, $params = []): array + protected function processDiffDataForEditMode(mixed $originalData, mixed $data, DataObject\Concrete $object = null, array $params = []): array { if ($data) { $data = $data[0]; diff --git a/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php b/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php index b75d14bfe85..70dd8641cf9 100644 --- a/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php +++ b/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php @@ -482,7 +482,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -673,7 +673,7 @@ public function preGetData(mixed $container, array $params = []): mixed return Element\Service::filterUnpublishedAdvancedElements($data); } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { $db = Db::get(); $context = $params['context'] ?? null; @@ -752,7 +752,7 @@ public function getColumnKeys(): array return $this->columnKeys; } - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { /** @var DataObject\Data\ElementMetadata $temp */ $temp = \Pimcore::getContainer()->get('pimcore.model.factory') @@ -794,7 +794,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param DataObject\ClassDefinition\Data\AdvancedManyToManyRelation $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { parent::synchronizeWithMasterDefinition($masterDefinition); $this->columns = $masterDefinition->columns; @@ -990,7 +990,7 @@ public function isOptimizedAdminLoading(): bool return $this->optimizedAdminLoading; } - public function setOptimizedAdminLoading(bool $optimizedAdminLoading) + public function setOptimizedAdminLoading(bool $optimizedAdminLoading): void { $this->optimizedAdminLoading = (bool) $optimizedAdminLoading; } @@ -1012,7 +1012,7 @@ public function getEnableBatchEdit(): bool return $this->enableBatchEdit; } - public function setEnableBatchEdit(bool $enableBatchEdit) + public function setEnableBatchEdit(bool $enableBatchEdit): void { $this->enableBatchEdit = (bool) $enableBatchEdit; } diff --git a/models/DataObject/ClassDefinition/Data/Block.php b/models/DataObject/ClassDefinition/Data/Block.php index 140268053e6..b9caee38a7d 100644 --- a/models/DataObject/ClassDefinition/Data/Block.php +++ b/models/DataObject/ClassDefinition/Data/Block.php @@ -542,7 +542,7 @@ public function getDiffVersionPreview(?array $data, Concrete $object = null, arr /** * @param Model\DataObject\ClassDefinition\Data\Block $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->disallowAddRemove = $masterDefinition->disallowAddRemove; $this->disallowReorder = $masterDefinition->disallowReorder; @@ -588,7 +588,7 @@ public function hasChildren(): bool * * @param Data|Layout $child */ - public function addChild(mixed $child) + public function addChild(mixed $child): void { $this->children[] = $child; $this->fieldDefinitionsCache = null; @@ -712,7 +712,7 @@ protected function doEnrichFieldDefinition(Data $fieldDefinition, array $context return $fieldDefinition; } - public function setReferencedFields(array $referencedFields) + public function setReferencedFields(array $referencedFields): void { $this->referencedFields = $referencedFields; $this->fieldDefinitionsCache = null; @@ -726,7 +726,7 @@ public function getReferencedFields(): array return $this->referencedFields; } - public function addReferencedField(Data $field) + public function addReferencedField(Data $field): void { $this->referencedFields[] = $field; $this->fieldDefinitionsCache = null; @@ -745,7 +745,7 @@ public function getBlockedVarsForExport(): array /** * @return array */ - public function __sleep() + public function __sleep(): array { $vars = get_object_vars($this); $blockedVars = $this->getBlockedVarsForExport(); @@ -816,7 +816,7 @@ public function isCollapsed(): bool return $this->collapsed; } - public function setCollapsed(bool $collapsed) + public function setCollapsed(bool $collapsed): void { $this->collapsed = (bool) $collapsed; } @@ -826,7 +826,7 @@ public function isCollapsible(): bool return $this->collapsible; } - public function setCollapsible(bool $collapsible) + public function setCollapsible(bool $collapsible): void { $this->collapsible = (bool) $collapsible; } @@ -949,7 +949,7 @@ public function load(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objec return $data; } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { } @@ -988,7 +988,7 @@ public function getMaxItems(): ?int return $this->maxItems; } - public function setMaxItems(?int $maxItems) + public function setMaxItems(?int $maxItems): void { $this->maxItems = $this->getAsIntegerCast($maxItems); } @@ -998,7 +998,7 @@ public function isDisallowAddRemove(): bool return $this->disallowAddRemove; } - public function setDisallowAddRemove(bool $disallowAddRemove) + public function setDisallowAddRemove(bool $disallowAddRemove): void { $this->disallowAddRemove = (bool) $disallowAddRemove; } @@ -1008,7 +1008,7 @@ public function isDisallowReorder(): bool return $this->disallowReorder; } - public function setDisallowReorder(bool $disallowReorder) + public function setDisallowReorder(bool $disallowReorder): void { $this->disallowReorder = (bool) $disallowReorder; } @@ -1016,7 +1016,7 @@ public function setDisallowReorder(bool $disallowReorder) /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck) { if (is_array($data)) { @@ -1087,7 +1087,7 @@ public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, arr * @param DataObject\ClassDefinition $class * @param array $params */ - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { $blockDefinitions = $this->getFieldDefinitions(); @@ -1113,7 +1113,7 @@ public function getReturnTypeDeclaration(): ?string return '?array'; } - private function setBlockElementOwner(DataObject\Data\BlockElement $blockElement, $params = []): void + private function setBlockElementOwner(DataObject\Data\BlockElement $blockElement, array $params = []): void { if (!isset($params['owner'])) { throw new \Error('owner missing'); @@ -1212,12 +1212,7 @@ public function denormalize(mixed $value, array $params = []): ?array return null; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = new static(); $obj->setValues($data); diff --git a/models/DataObject/ClassDefinition/Data/BooleanSelect.php b/models/DataObject/ClassDefinition/Data/BooleanSelect.php index fdacb41daa8..8df17f8edf0 100644 --- a/models/DataObject/ClassDefinition/Data/BooleanSelect.php +++ b/models/DataObject/ClassDefinition/Data/BooleanSelect.php @@ -101,7 +101,7 @@ class BooleanSelect extends Data implements /** * @internal * - * @var array|array[] + * @var array */ public array $options = self::DEFAULT_OPTIONS; @@ -265,7 +265,7 @@ public function getDiffDataForEditMode(mixed $data, DataObject\Concrete $object /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { //TODO mandatory probably doesn't make much sense if (!$omitMandatoryCheck && $this->getMandatory() && $this->isEmpty($data)) { @@ -281,7 +281,7 @@ public function isEmpty(mixed $data): bool /** * @param DataObject\ClassDefinition\Data\BooleanSelect $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->options = $masterDefinition->options; $this->width = $masterDefinition->width; @@ -300,14 +300,14 @@ public function setYesLabel(?string $yesLabel): static return $this; } - public function setOptionsEntry($value, $label) + public function setOptionsEntry(int $value, string $label): void { if (!is_array($this->options)) { $this->options = [ - ['key' => $label, - 'value' => $value, + [ + 'key' => $label, + 'value' => $value, ], - ]; } else { foreach ($this->options as $idx => $option) { @@ -326,7 +326,7 @@ public function getNoLabel(): string return $this->noLabel; } - public function setNoLabel($noLabel): static + public function setNoLabel(string $noLabel): static { $this->noLabel = $noLabel; $this->setOptionsEntry(self::NO_VALUE, $noLabel); @@ -339,7 +339,7 @@ public function getEmptyLabel(): string return $this->emptyLabel; } - public function setEmptyLabel($emptyLabel): static + public function setEmptyLabel(string $emptyLabel): static { $this->emptyLabel = $emptyLabel; $this->setOptionsEntry(self::EMPTY_VALUE_EDITMODE, $emptyLabel); diff --git a/models/DataObject/ClassDefinition/Data/CalculatedValue.php b/models/DataObject/ClassDefinition/Data/CalculatedValue.php index c44704edd81..dac98ca2e4e 100644 --- a/models/DataObject/ClassDefinition/Data/CalculatedValue.php +++ b/models/DataObject/ClassDefinition/Data/CalculatedValue.php @@ -129,7 +129,7 @@ public function getCalculatorClass(): string return $this->calculatorClass; } - public function setCalculatorClass(string $calculatorClass) + public function setCalculatorClass(string $calculatorClass): void { $this->calculatorClass = $calculatorClass; } @@ -219,7 +219,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { // nothing to do } diff --git a/models/DataObject/ClassDefinition/Data/Checkbox.php b/models/DataObject/ClassDefinition/Data/Checkbox.php index c3d3545fb86..3f1dd10c4d1 100644 --- a/models/DataObject/ClassDefinition/Data/Checkbox.php +++ b/models/DataObject/ClassDefinition/Data/Checkbox.php @@ -176,7 +176,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && $data === null) { throw new Model\Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -209,7 +209,7 @@ public function isDiffChangeAllowed(Concrete $object, array $params = []): bool /** * @param DataObject\ClassDefinition\Data\Checkbox $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->defaultValue = $masterDefinition->defaultValue; } diff --git a/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php b/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php index aa60aa7d88b..2d0437be77f 100644 --- a/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php +++ b/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php @@ -19,5 +19,5 @@ interface ClassSavedInterface { - public function classSaved(DataObject\ClassDefinition $class, array $params = []); + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void; } diff --git a/models/DataObject/ClassDefinition/Data/Classificationstore.php b/models/DataObject/ClassDefinition/Data/Classificationstore.php index e6cbf0c800b..e11c4649e1c 100644 --- a/models/DataObject/ClassDefinition/Data/Classificationstore.php +++ b/models/DataObject/ClassDefinition/Data/Classificationstore.php @@ -492,13 +492,13 @@ public function hasChildren(): bool * * @param Data|Layout $child */ - public function addChild(mixed $child) + public function addChild(mixed $child): void { $this->children[] = $child; $this->fieldDefinitionsCache = null; } - public function setReferencedFields(array $referencedFields) + public function setReferencedFields(array $referencedFields): void { $this->referencedFields = $referencedFields; $this->fieldDefinitionsCache = null; @@ -509,7 +509,7 @@ public function getReferencedFields(): array return $this->referencedFields; } - public function addReferencedField(Data $field) + public function addReferencedField(Data $field): void { $this->referencedFields[] = $field; $this->fieldDefinitionsCache = null; @@ -534,7 +534,7 @@ public function load(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objec return $classificationStore; } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { $classificationStore = $this->getDataFromObjectParam($object); @@ -551,7 +551,7 @@ public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Obj * @param DataObject\ClassDefinition $class * @param array $params */ - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { $classificationStore = new DataObject\Classificationstore(); $classificationStore->setClass($class); @@ -637,7 +637,7 @@ public function getTitle(): string /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $activeGroups = $data->getActiveGroups(); if (!$activeGroups) { @@ -756,7 +756,7 @@ public function getBlockedVarsForExport(): array /** * @return array */ - public function __sleep() + public function __sleep(): array { $vars = get_object_vars($this); $blockedVars = $this->getBlockedVarsForExport(); @@ -768,7 +768,7 @@ public function __sleep() return array_keys($vars); } - public function setMaxTabs(int $maxTabs) + public function setMaxTabs(int $maxTabs): void { $this->maxTabs = $maxTabs; } @@ -778,7 +778,7 @@ public function getMaxTabs(): int return $this->maxTabs; } - public function setLabelWidth(int $labelWidth) + public function setLabelWidth(int $labelWidth): void { $this->labelWidth = (int)$labelWidth; } @@ -788,7 +788,7 @@ public function getLabelWidth(): int return $this->labelWidth; } - public function setMaxItems(?int $maxItems) + public function setMaxItems(?int $maxItems): void { $this->maxItems = $this->getAsIntegerCast($maxItems); } @@ -803,7 +803,7 @@ public function isLocalized(): bool return $this->localized; } - public function setLocalized(bool $localized) + public function setLocalized(bool $localized): void { $this->localized = (bool) $localized; } @@ -999,7 +999,7 @@ public function getAllowedGroupIds(): array return $this->allowedGroupIds; } - public function setAllowedGroupIds(array|string $allowedGroupIds) + public function setAllowedGroupIds(array|string $allowedGroupIds): void { $parts = []; if (is_string($allowedGroupIds) && !empty($allowedGroupIds)) { @@ -1190,12 +1190,7 @@ public function getGetterCode(DataObject\Objectbrick\Definition|DataObject\Class return $code; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = new static(); $obj->setValues($data); diff --git a/models/DataObject/ClassDefinition/Data/Consent.php b/models/DataObject/ClassDefinition/Data/Consent.php index a296756341d..0a0a9bc6cb6 100644 --- a/models/DataObject/ClassDefinition/Data/Consent.php +++ b/models/DataObject/ClassDefinition/Data/Consent.php @@ -289,7 +289,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && $data === null) { throw new Model\Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -322,7 +322,7 @@ public function isDiffChangeAllowed(Concrete $object, array $params = []): bool /** * @param DataObject\ClassDefinition\Data\Consent $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->defaultValue = $masterDefinition->defaultValue; } diff --git a/models/DataObject/ClassDefinition/Data/Country.php b/models/DataObject/ClassDefinition/Data/Country.php index 2c5c29b1ebb..fc630c335f4 100644 --- a/models/DataObject/ClassDefinition/Data/Country.php +++ b/models/DataObject/ClassDefinition/Data/Country.php @@ -50,7 +50,7 @@ public function isDiffChangeAllowed(Concrete $object, array $params = []): bool return true; } - public function setRestrictTo(array|string|null $restrictTo) + public function setRestrictTo(array|string|null $restrictTo): void { /** * @extjs6 diff --git a/models/DataObject/ClassDefinition/Data/Countrymultiselect.php b/models/DataObject/ClassDefinition/Data/Countrymultiselect.php index 93099a6a5a9..1fd41b6a81e 100644 --- a/models/DataObject/ClassDefinition/Data/Countrymultiselect.php +++ b/models/DataObject/ClassDefinition/Data/Countrymultiselect.php @@ -39,7 +39,7 @@ class Countrymultiselect extends Model\DataObject\ClassDefinition\Data\Multisele */ public ?string $restrictTo = null; - public function setRestrictTo(array|string|null $restrictTo) + public function setRestrictTo(array|string|null $restrictTo): void { /** * @extjs6 diff --git a/models/DataObject/ClassDefinition/Data/CustomRecyclingMarshalInterface.php b/models/DataObject/ClassDefinition/Data/CustomRecyclingMarshalInterface.php index 40bb3cdb0e9..a6b7892d747 100644 --- a/models/DataObject/ClassDefinition/Data/CustomRecyclingMarshalInterface.php +++ b/models/DataObject/ClassDefinition/Data/CustomRecyclingMarshalInterface.php @@ -20,7 +20,7 @@ interface CustomRecyclingMarshalInterface { - public function marshalRecycleData(Concrete $object, mixed $data); + public function marshalRecycleData(Concrete $object, mixed $data): mixed; - public function unmarshalRecycleData(Concrete $object, mixed $data); + public function unmarshalRecycleData(Concrete $object, mixed $data): mixed; } diff --git a/models/DataObject/ClassDefinition/Data/CustomResourcePersistingInterface.php b/models/DataObject/ClassDefinition/Data/CustomResourcePersistingInterface.php index 68f296f1ff8..fbc9e678a13 100644 --- a/models/DataObject/ClassDefinition/Data/CustomResourcePersistingInterface.php +++ b/models/DataObject/ClassDefinition/Data/CustomResourcePersistingInterface.php @@ -22,9 +22,9 @@ interface CustomResourcePersistingInterface { - public function save(Localizedfield|\Pimcore\Model\DataObject\Fieldcollection\Data\AbstractData|AbstractData|Concrete $object, array $params = []); + public function save(Localizedfield|\Pimcore\Model\DataObject\Fieldcollection\Data\AbstractData|AbstractData|Concrete $object, array $params = []): void; public function load(Localizedfield|\Pimcore\Model\DataObject\Fieldcollection\Data\AbstractData|AbstractData|Concrete $object, array $params = []): mixed; - public function delete(Localizedfield|\Pimcore\Model\DataObject\Fieldcollection\Data\AbstractData|AbstractData|Concrete $object, array $params = []); + public function delete(Localizedfield|\Pimcore\Model\DataObject\Fieldcollection\Data\AbstractData|AbstractData|Concrete $object, array $params = []): void; } diff --git a/models/DataObject/ClassDefinition/Data/CustomVersionMarshalInterface.php b/models/DataObject/ClassDefinition/Data/CustomVersionMarshalInterface.php index 24bfcc3937c..c21833d599c 100644 --- a/models/DataObject/ClassDefinition/Data/CustomVersionMarshalInterface.php +++ b/models/DataObject/ClassDefinition/Data/CustomVersionMarshalInterface.php @@ -20,7 +20,7 @@ interface CustomVersionMarshalInterface { - public function marshalVersion(Concrete $object, mixed $data); + public function marshalVersion(Concrete $object, mixed $data): mixed; - public function unmarshalVersion(Concrete $object, mixed $data); + public function unmarshalVersion(Concrete $object, mixed $data): mixed; } diff --git a/models/DataObject/ClassDefinition/Data/DataContainerAwareInterface.php b/models/DataObject/ClassDefinition/Data/DataContainerAwareInterface.php index c5ece3069d2..7eda7446b60 100644 --- a/models/DataObject/ClassDefinition/Data/DataContainerAwareInterface.php +++ b/models/DataObject/ClassDefinition/Data/DataContainerAwareInterface.php @@ -18,7 +18,7 @@ interface DataContainerAwareInterface { - public function preSave(mixed $containerDefinition, array $params = []); + public function preSave(mixed $containerDefinition, array $params = []): void; - public function postSave(mixed $containerDefinition, array $params = []); + public function postSave(mixed $containerDefinition, array $params = []): void; } diff --git a/models/DataObject/ClassDefinition/Data/Email.php b/models/DataObject/ClassDefinition/Data/Email.php index 094848e20cd..2adaec4132f 100644 --- a/models/DataObject/ClassDefinition/Data/Email.php +++ b/models/DataObject/ClassDefinition/Data/Email.php @@ -32,7 +32,7 @@ class Email extends Model\DataObject\ClassDefinition\Data\Input /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && is_string($data) && strlen($data) > 0) { $validator = new EmailValidator(); diff --git a/models/DataObject/ClassDefinition/Data/EncryptedField.php b/models/DataObject/ClassDefinition/Data/EncryptedField.php index 56a95845ccd..1e3ac492adf 100644 --- a/models/DataObject/ClassDefinition/Data/EncryptedField.php +++ b/models/DataObject/ClassDefinition/Data/EncryptedField.php @@ -276,7 +276,7 @@ public function getDataFromGridEditor(float $data, Model\DataObject\Concrete $ob /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $fd = $this->getDelegateDatatypeDefinition(); if ($fd) { @@ -288,7 +288,7 @@ public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, arr /** * @param Model\DataObject\ClassDefinition\Data\EncryptedField $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->datatype = $masterDefinition->datatype; } @@ -384,7 +384,7 @@ public function getDelegateDatatype(): string return $this->delegateDatatype; } - public function setDelegateDatatype(string $delegateDatatype) + public function setDelegateDatatype(string $delegateDatatype): void { $this->delegateDatatype = $delegateDatatype; } @@ -399,7 +399,7 @@ public function getDelegateDatatypeDefinition(): Data|array|null * * @param mixed $data */ - public function setupDelegate(mixed $data) + public function setupDelegate(mixed $data): void { $this->delegate = null; @@ -421,7 +421,7 @@ public static function isStrictMode(): int return self::$strictMode; } - public static function setStrictMode(int $strictMode) + public static function setStrictMode(int $strictMode): void { self::$strictMode = $strictMode; } @@ -431,7 +431,7 @@ public function getDelegate(): Data|array|null return $this->delegate; } - public function setDelegate(Data|array|null $delegate) + public function setDelegate(Data|array|null $delegate): void { $this->delegate = $delegate; } diff --git a/models/DataObject/ClassDefinition/Data/Extension/Text.php b/models/DataObject/ClassDefinition/Data/Extension/Text.php index 488d09ad337..27994c64058 100644 --- a/models/DataObject/ClassDefinition/Data/Extension/Text.php +++ b/models/DataObject/ClassDefinition/Data/Extension/Text.php @@ -24,7 +24,7 @@ trait Text /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && $this->isEmpty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); diff --git a/models/DataObject/ClassDefinition/Data/ExternalImage.php b/models/DataObject/ClassDefinition/Data/ExternalImage.php index 7e009578cfc..7abc814a14f 100644 --- a/models/DataObject/ClassDefinition/Data/ExternalImage.php +++ b/models/DataObject/ClassDefinition/Data/ExternalImage.php @@ -80,7 +80,7 @@ public function getPreviewWidth(): ?int return $this->previewWidth; } - public function setPreviewWidth(?int $previewWidth) + public function setPreviewWidth(?int $previewWidth): void { $this->previewWidth = $this->getAsIntegerCast($previewWidth); } @@ -90,7 +90,7 @@ public function getPreviewHeight(): ?int return $this->previewHeight; } - public function setPreviewHeight(?int $previewHeight) + public function setPreviewHeight(?int $previewHeight): void { $this->previewHeight = $this->getAsIntegerCast($previewHeight); } @@ -100,7 +100,7 @@ public function getInputWidth(): ?int return $this->inputWidth; } - public function setInputWidth(?int $inputWidth) + public function setInputWidth(?int $inputWidth): void { $this->inputWidth = $this->getAsIntegerCast($inputWidth); } @@ -278,7 +278,7 @@ public function getDiffVersionPreview(string $data, Concrete $object = null, arr /** * @param Model\DataObject\ClassDefinition\Data\ExternalImage $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->previewHeight = $masterDefinition->previewHeight; $this->previewWidth = $masterDefinition->previewWidth; @@ -292,7 +292,7 @@ public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition * * @throws Model\Element\ValidationException */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ($this->getMandatory() && !$omitMandatoryCheck && $this->isEmpty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); diff --git a/models/DataObject/ClassDefinition/Data/Fieldcollections.php b/models/DataObject/ClassDefinition/Data/Fieldcollections.php index 7acb22a8d7d..549d72bf738 100644 --- a/models/DataObject/ClassDefinition/Data/Fieldcollections.php +++ b/models/DataObject/ClassDefinition/Data/Fieldcollections.php @@ -308,7 +308,7 @@ public function load(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objec return $container; } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { $container = new DataObject\Fieldcollection([], $this->getName()); $container->delete($object); @@ -385,7 +385,7 @@ public function getCacheTags(mixed $data, array $tags = []): array /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ($data instanceof DataObject\Fieldcollection) { $validationExceptions = []; @@ -612,7 +612,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param DataObject\ClassDefinition\Data\Fieldcollections $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->allowedTypes = $masterDefinition->allowedTypes; $this->lazyLoading = $masterDefinition->lazyLoading; @@ -625,7 +625,7 @@ public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data * @param DataObject\ClassDefinition $class * @param array $params */ - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { if (is_array($this->allowedTypes)) { foreach ($this->allowedTypes as $i => $allowedType) { @@ -649,7 +649,7 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = [] } } - public function setDisallowAddRemove(bool $disallowAddRemove) + public function setDisallowAddRemove(bool $disallowAddRemove): void { $this->disallowAddRemove = (bool) $disallowAddRemove; } @@ -659,7 +659,7 @@ public function getDisallowAddRemove(): bool return $this->disallowAddRemove; } - public function setDisallowReorder(bool $disallowReorder) + public function setDisallowReorder(bool $disallowReorder): void { $this->disallowReorder = (bool) $disallowReorder; } @@ -684,7 +684,7 @@ public function isCollapsed(): bool return $this->collapsed; } - public function setCollapsed(bool $collapsed) + public function setCollapsed(bool $collapsed): void { $this->collapsed = (bool) $collapsed; } @@ -694,7 +694,7 @@ public function isCollapsible(): bool return $this->collapsible; } - public function setCollapsible(bool $collapsible) + public function setCollapsible(bool $collapsible): void { $this->collapsible = (bool) $collapsible; } @@ -703,7 +703,7 @@ public function setCollapsible(bool $collapsible) * @param DataObject\ClassDefinition\Data[] $container * @param DataObject\ClassDefinition\Data[] $list */ - public static function collectCalculatedValueItems(array $container, array &$list = []) + public static function collectCalculatedValueItems(array $container, array &$list = []): void { if (is_array($container)) { foreach ($container as $childDef) { diff --git a/models/DataObject/ClassDefinition/Data/Gender.php b/models/DataObject/ClassDefinition/Data/Gender.php index 6ceed7ce1a6..bff40aad18f 100644 --- a/models/DataObject/ClassDefinition/Data/Gender.php +++ b/models/DataObject/ClassDefinition/Data/Gender.php @@ -30,7 +30,7 @@ class Gender extends Model\DataObject\ClassDefinition\Data\Select */ public string $fieldtype = 'gender'; - public function configureOptions() + public function configureOptions(): void { $options = [ ['key' => 'male', 'value' => 'male'], @@ -42,12 +42,7 @@ public function configureOptions() $this->setOptions($options); } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); $obj->configureOptions(); diff --git a/models/DataObject/ClassDefinition/Data/Geobounds.php b/models/DataObject/ClassDefinition/Data/Geobounds.php index 9275c915947..06dc7899af2 100644 --- a/models/DataObject/ClassDefinition/Data/Geobounds.php +++ b/models/DataObject/ClassDefinition/Data/Geobounds.php @@ -101,7 +101,7 @@ public function getDataForResource(mixed $data, Concrete $object = null, array $ /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $isEmpty = true; diff --git a/models/DataObject/ClassDefinition/Data/Geopoint.php b/models/DataObject/ClassDefinition/Data/Geopoint.php index b2480280da3..6a76ea04e7b 100644 --- a/models/DataObject/ClassDefinition/Data/Geopoint.php +++ b/models/DataObject/ClassDefinition/Data/Geopoint.php @@ -270,7 +270,7 @@ public function getDataForGrid(?DataObject\Data\GeoCoordinates $data, Concrete $ /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $isEmpty = true; diff --git a/models/DataObject/ClassDefinition/Data/Geopolygon.php b/models/DataObject/ClassDefinition/Data/Geopolygon.php index 490b2e4ea25..bb3fbb51dc6 100644 --- a/models/DataObject/ClassDefinition/Data/Geopolygon.php +++ b/models/DataObject/ClassDefinition/Data/Geopolygon.php @@ -73,7 +73,7 @@ public function getDataForResource(mixed $data, DataObject\Concrete $object = nu /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $isEmpty = true; diff --git a/models/DataObject/ClassDefinition/Data/Geopolyline.php b/models/DataObject/ClassDefinition/Data/Geopolyline.php index 36651c09bb2..9cb4844b1bc 100644 --- a/models/DataObject/ClassDefinition/Data/Geopolyline.php +++ b/models/DataObject/ClassDefinition/Data/Geopolyline.php @@ -106,7 +106,7 @@ public function getDataForQueryResource(mixed $data, DataObject\Concrete $object /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $isEmpty = true; diff --git a/models/DataObject/ClassDefinition/Data/Hotspotimage.php b/models/DataObject/ClassDefinition/Data/Hotspotimage.php index 7089e551344..10886814f28 100644 --- a/models/DataObject/ClassDefinition/Data/Hotspotimage.php +++ b/models/DataObject/ClassDefinition/Data/Hotspotimage.php @@ -80,7 +80,7 @@ class Hotspotimage extends Data implements ResourcePersistenceAwareInterface, Qu */ public string $predefinedDataTemplates; - public function setRatioX(int $ratioX) + public function setRatioX(int $ratioX): void { $this->ratioX = $ratioX; } @@ -90,7 +90,7 @@ public function getRatioX(): int return $this->ratioX; } - public function setRatioY(int $ratioY) + public function setRatioY(int $ratioY): void { $this->ratioY = $ratioY; } @@ -105,7 +105,7 @@ public function getPredefinedDataTemplates(): string return $this->predefinedDataTemplates; } - public function setPredefinedDataTemplates(string $predefinedDataTemplates) + public function setPredefinedDataTemplates(string $predefinedDataTemplates): void { $this->predefinedDataTemplates = $predefinedDataTemplates; } @@ -472,7 +472,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @internal */ - public function doRewriteIds($object, $idMapping, $params, $data) + public function doRewriteIds(mixed $object, array $idMapping, array $params, mixed $data): mixed { if ($data instanceof DataObject\Data\Hotspotimage && $data->getImage()) { $id = $data->getImage()->getId(); diff --git a/models/DataObject/ClassDefinition/Data/Image.php b/models/DataObject/ClassDefinition/Data/Image.php index 908dcdd81fe..ecafca5d760 100644 --- a/models/DataObject/ClassDefinition/Data/Image.php +++ b/models/DataObject/ClassDefinition/Data/Image.php @@ -168,7 +168,7 @@ public function getDataFromEditmode(mixed $data, DataObject\Concrete $object = n * * @throws Element\ValidationException */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && !$data instanceof Asset\Image) { throw new Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); @@ -305,7 +305,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param Model\DataObject\ClassDefinition\Data\Image $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->uploadPath = $masterDefinition->uploadPath; } diff --git a/models/DataObject/ClassDefinition/Data/ImageGallery.php b/models/DataObject/ClassDefinition/Data/ImageGallery.php index 64d83748b19..ef285021676 100644 --- a/models/DataObject/ClassDefinition/Data/ImageGallery.php +++ b/models/DataObject/ClassDefinition/Data/ImageGallery.php @@ -86,7 +86,7 @@ class ImageGallery extends Data implements ResourcePersistenceAwareInterface, Qu */ public string $predefinedDataTemplates; - public function setRatioX(int $ratioX) + public function setRatioX(int $ratioX): void { $this->ratioX = $ratioX; } @@ -96,7 +96,7 @@ public function getRatioX(): int return $this->ratioX; } - public function setRatioY(int $ratioY) + public function setRatioY(int $ratioY): void { $this->ratioY = $ratioY; } @@ -111,7 +111,7 @@ public function getPredefinedDataTemplates(): string return $this->predefinedDataTemplates; } - public function setPredefinedDataTemplates(string $predefinedDataTemplates) + public function setPredefinedDataTemplates(string $predefinedDataTemplates): void { $this->predefinedDataTemplates = $predefinedDataTemplates; } @@ -121,7 +121,7 @@ public function getUploadPath(): string return $this->uploadPath; } - public function setUploadPath(string $uploadPath) + public function setUploadPath(string $uploadPath): void { $this->uploadPath = $uploadPath; } @@ -409,7 +409,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ * * @throws Element\ValidationException */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ( $this->getMandatory() && !$omitMandatoryCheck && diff --git a/models/DataObject/ClassDefinition/Data/Input.php b/models/DataObject/ClassDefinition/Data/Input.php index 20551e4a2c3..8529e27c5c7 100644 --- a/models/DataObject/ClassDefinition/Data/Input.php +++ b/models/DataObject/ClassDefinition/Data/Input.php @@ -191,7 +191,7 @@ public function setColumnLength(?int $columnLength): static return $this; } - public function setRegex(string $regex) + public function setRegex(string $regex): void { $this->regex = $regex; } @@ -216,7 +216,7 @@ public function getUnique(): bool return $this->unique; } - public function setUnique(bool $unique) + public function setUnique(bool $unique): void { $this->unique = (bool) $unique; } @@ -226,7 +226,7 @@ public function getShowCharCount(): bool return $this->showCharCount; } - public function setShowCharCount(bool $showCharCount) + public function setShowCharCount(bool $showCharCount): void { $this->showCharCount = (bool) $showCharCount; } @@ -250,7 +250,7 @@ public function getQueryColumnType(): array|string|null /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getRegex() && is_string($data) && strlen($data) > 0) { if (!preg_match('#' . $this->getRegex() . '#' . implode('', $this->getRegexFlags()), $data)) { @@ -264,7 +264,7 @@ public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, arr /** * @param Model\DataObject\ClassDefinition\Data\Input $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->columnLength = $masterDefinition->columnLength; } diff --git a/models/DataObject/ClassDefinition/Data/InputQuantityValue.php b/models/DataObject/ClassDefinition/Data/InputQuantityValue.php index 331281e8614..4ef81c2513e 100644 --- a/models/DataObject/ClassDefinition/Data/InputQuantityValue.php +++ b/models/DataObject/ClassDefinition/Data/InputQuantityValue.php @@ -98,7 +98,7 @@ public function getDataFromEditmode(mixed $data, DataObject\Concrete $object = n /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ($omitMandatoryCheck) { return; diff --git a/models/DataObject/ClassDefinition/Data/Language.php b/models/DataObject/ClassDefinition/Data/Language.php index 9b3041e7ee0..f3c7c6aec0f 100644 --- a/models/DataObject/ClassDefinition/Data/Language.php +++ b/models/DataObject/ClassDefinition/Data/Language.php @@ -39,7 +39,7 @@ class Language extends Model\DataObject\ClassDefinition\Data\Select /** * @internal */ - public function configureOptions() + public function configureOptions(): void { $validLanguages = (array) Tool::getValidLanguages(); $locales = Tool::getSupportedLocales(); @@ -73,12 +73,7 @@ public function setOnlySystemLanguages(bool|int $value): static return $this; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); $obj->configureOptions(); diff --git a/models/DataObject/ClassDefinition/Data/Languagemultiselect.php b/models/DataObject/ClassDefinition/Data/Languagemultiselect.php index 10ec42576e3..550831fe217 100644 --- a/models/DataObject/ClassDefinition/Data/Languagemultiselect.php +++ b/models/DataObject/ClassDefinition/Data/Languagemultiselect.php @@ -41,7 +41,7 @@ class Languagemultiselect extends Model\DataObject\ClassDefinition\Data\Multisel * * @throws \Exception */ - public function configureOptions() + public function configureOptions(): void { $validLanguages = (array) Tool::getValidLanguages(); $locales = Tool::getSupportedLocales(); @@ -75,12 +75,7 @@ public function setOnlySystemLanguages(bool|int|null $value): static return $this; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); $obj->configureOptions(); diff --git a/models/DataObject/ClassDefinition/Data/Link.php b/models/DataObject/ClassDefinition/Data/Link.php index fa4a89c6ad5..98400d3313c 100644 --- a/models/DataObject/ClassDefinition/Data/Link.php +++ b/models/DataObject/ClassDefinition/Data/Link.php @@ -229,7 +229,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ($data instanceof DataObject\Data\Link) { if ((int)$data->getInternal() > 0) { diff --git a/models/DataObject/ClassDefinition/Data/Localizedfields.php b/models/DataObject/ClassDefinition/Data/Localizedfields.php index 90f6231fb0b..83edf1a2980 100644 --- a/models/DataObject/ClassDefinition/Data/Localizedfields.php +++ b/models/DataObject/ClassDefinition/Data/Localizedfields.php @@ -404,7 +404,7 @@ public function hasChildren(): bool * * @param Data|Layout $child */ - public function addChild(mixed $child) + public function addChild(mixed $child): void { $this->children[] = $child; $this->fieldDefinitionsCache = null; @@ -413,7 +413,7 @@ public function addChild(mixed $child) /** * @param Data[] $referencedFields */ - public function setReferencedFields(array $referencedFields) + public function setReferencedFields(array $referencedFields): void { $this->referencedFields = $referencedFields; $this->fieldDefinitionsCache = null; @@ -427,7 +427,7 @@ public function getReferencedFields(): array return $this->referencedFields; } - public function addReferencedField(Data $field) + public function addReferencedField(Data $field): void { $this->referencedFields[] = $field; $this->fieldDefinitionsCache = null; @@ -471,7 +471,7 @@ public function load(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objec return $localizedFields; } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { $localizedFields = $this->getDataFromObjectParam($object, $params); @@ -489,7 +489,7 @@ public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Obj * @param DataObject\ClassDefinition $class * @param array $params */ - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { // create a dummy instance just for updating the tables $localizedFields = new DataObject\Localizedfield(); @@ -772,7 +772,7 @@ public function getRegion(): string /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { $config = \Pimcore\Config::getSystemConfiguration('general'); $languages = []; @@ -994,7 +994,7 @@ public function getBlockedVarsForExport(): array /** * @return array */ - public function __sleep() + public function __sleep(): array { $vars = get_object_vars($this); $blockedVars = $this->getBlockedVarsForExport(); @@ -1039,7 +1039,7 @@ public function setHideLabelsWhenTabsReached(int $hideLabelsWhenTabsReached): st return $this; } - public function setMaxTabs(int $maxTabs) + public function setMaxTabs(int $maxTabs): void { $this->maxTabs = $maxTabs; } @@ -1049,7 +1049,7 @@ public function getMaxTabs(): int return $this->maxTabs; } - public function setLabelWidth(int $labelWidth) + public function setLabelWidth(int $labelWidth): void { $this->labelWidth = (int)$labelWidth; } @@ -1201,12 +1201,7 @@ public function denormalize(mixed $value, array $params = []): ?Localizedfield return null; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = new static(); $obj->setValues($data); diff --git a/models/DataObject/ClassDefinition/Data/ManyToManyObjectRelation.php b/models/DataObject/ClassDefinition/Data/ManyToManyObjectRelation.php index 08dfe37bc35..b7bc1e2da18 100644 --- a/models/DataObject/ClassDefinition/Data/ManyToManyObjectRelation.php +++ b/models/DataObject/ClassDefinition/Data/ManyToManyObjectRelation.php @@ -305,7 +305,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -481,7 +481,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param DataObject\ClassDefinition\Data\ManyToManyObjectRelation $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->maxItems = $masterDefinition->maxItems; $this->relationType = $masterDefinition->relationType; @@ -642,7 +642,7 @@ protected function buildUniqueKeyForDiffEditor(array $item): string * * @return array */ - protected function processDiffDataForEditMode($originalData, $data, $object = null, $params = []): array + protected function processDiffDataForEditMode(mixed $originalData, mixed $data, DataObject\Concrete $object = null, array $params = []): array { if ($data) { $data = $data[0]; @@ -754,7 +754,7 @@ public function isAllowToCreateNewObject(): bool return $this->allowToCreateNewObject; } - public function setAllowToCreateNewObject(bool $allowToCreateNewObject) + public function setAllowToCreateNewObject(bool $allowToCreateNewObject): void { $this->allowToCreateNewObject = (bool)$allowToCreateNewObject; } @@ -777,7 +777,7 @@ public function isOptimizedAdminLoading(): bool return (bool) $this->optimizedAdminLoading; } - public function setOptimizedAdminLoading(bool $optimizedAdminLoading) + public function setOptimizedAdminLoading(bool $optimizedAdminLoading): void { $this->optimizedAdminLoading = $optimizedAdminLoading; } diff --git a/models/DataObject/ClassDefinition/Data/ManyToManyRelation.php b/models/DataObject/ClassDefinition/Data/ManyToManyRelation.php index 86884ff0020..ec94151944a 100644 --- a/models/DataObject/ClassDefinition/Data/ManyToManyRelation.php +++ b/models/DataObject/ClassDefinition/Data/ManyToManyRelation.php @@ -410,7 +410,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -636,7 +636,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param DataObject\ClassDefinition\Data\ManyToManyRelation $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->maxItems = $masterDefinition->maxItems; $this->assetUploadPath = $masterDefinition->assetUploadPath; diff --git a/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php b/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php index 9ff03f24a18..bf2dfe4f2c2 100644 --- a/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php +++ b/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php @@ -331,7 +331,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); @@ -486,7 +486,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param DataObject\ClassDefinition\Data\ManyToOneRelation $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->assetUploadPath = $masterDefinition->assetUploadPath; $this->relationType = $masterDefinition->relationType; diff --git a/models/DataObject/ClassDefinition/Data/Multiselect.php b/models/DataObject/ClassDefinition/Data/Multiselect.php index d6fd533290f..d046ff8cbda 100644 --- a/models/DataObject/ClassDefinition/Data/Multiselect.php +++ b/models/DataObject/ClassDefinition/Data/Multiselect.php @@ -314,7 +314,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); @@ -455,7 +455,7 @@ public function getDiffVersionPreview(?array $data, Concrete $object = null, arr /** * @param DataObject\ClassDefinition\Data\Multiselect $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->maxItems = $masterDefinition->maxItems; $this->options = $masterDefinition->options; @@ -466,7 +466,7 @@ public function getOptionsProviderClass(): ?string return $this->optionsProviderClass; } - public function setOptionsProviderClass(?string $optionsProviderClass) + public function setOptionsProviderClass(?string $optionsProviderClass): void { $this->optionsProviderClass = $optionsProviderClass; } @@ -476,7 +476,7 @@ public function getOptionsProviderData(): ?string return $this->optionsProviderData; } - public function setOptionsProviderData(?string $optionsProviderData) + public function setOptionsProviderData(?string $optionsProviderData): void { $this->optionsProviderData = $optionsProviderData; } @@ -565,7 +565,7 @@ public function getPhpdocReturnType(): ?string * @param mixed $containerDefinition * @param array $params */ - public function preSave(mixed $containerDefinition, array $params = []) + public function preSave(mixed $containerDefinition, array $params = []): void { /** @var DataObject\ClassDefinition\DynamicOptionsProvider\MultiSelectOptionsProviderInterface|null $optionsProvider */ $optionsProvider = DataObject\ClassDefinition\Helper\OptionsProviderResolver::resolveProvider( @@ -592,7 +592,7 @@ public function preSave(mixed $containerDefinition, array $params = []) } } - public function postSave(mixed $containerDefinition, array $params = []) + public function postSave(mixed $containerDefinition, array $params = []): void { // nothing to do } diff --git a/models/DataObject/ClassDefinition/Data/Numeric.php b/models/DataObject/ClassDefinition/Data/Numeric.php index d781c8ceaf2..a99521ac408 100644 --- a/models/DataObject/ClassDefinition/Data/Numeric.php +++ b/models/DataObject/ClassDefinition/Data/Numeric.php @@ -165,7 +165,7 @@ public function setDefaultValue(float|int|string|null $defaultValue): static return $this; } - public function setInteger(bool $integer) + public function setInteger(bool $integer): void { $this->integer = $integer; } @@ -175,7 +175,7 @@ public function getInteger(): bool return $this->integer; } - public function setMaxValue(?float $maxValue) + public function setMaxValue(?float $maxValue): void { $this->maxValue = $maxValue; } @@ -185,7 +185,7 @@ public function getMaxValue(): ?float return $this->maxValue; } - public function setMinValue(?float $minValue) + public function setMinValue(?float $minValue): void { $this->minValue = $minValue; } @@ -195,7 +195,7 @@ public function getMinValue(): ?float return $this->minValue; } - public function setUnsigned(bool $unsigned) + public function setUnsigned(bool $unsigned): void { $this->unsigned = $unsigned; } @@ -210,7 +210,7 @@ public function getDecimalSize(): ?int return $this->decimalSize; } - public function setDecimalSize(?int $decimalSize) + public function setDecimalSize(?int $decimalSize): void { if (!is_numeric($decimalSize)) { $decimalSize = null; @@ -219,7 +219,7 @@ public function setDecimalSize(?int $decimalSize) $this->decimalSize = $decimalSize; } - public function setDecimalPrecision(?int $decimalPrecision) + public function setDecimalPrecision(?int $decimalPrecision): void { if (!is_numeric($decimalPrecision)) { $decimalPrecision = null; @@ -238,7 +238,7 @@ public function getUnique(): bool return $this->unique; } - public function setUnique(bool $unique) + public function setUnique(bool $unique): void { $this->unique = (bool) $unique; } @@ -421,7 +421,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && $this->isEmpty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); diff --git a/models/DataObject/ClassDefinition/Data/NumericRange.php b/models/DataObject/ClassDefinition/Data/NumericRange.php index bfbc49c6e25..9f2b0411a7f 100644 --- a/models/DataObject/ClassDefinition/Data/NumericRange.php +++ b/models/DataObject/ClassDefinition/Data/NumericRange.php @@ -140,7 +140,7 @@ public function getMinValue(): ?float return $this->minValue; } - public function setMinValue(?float $minValue) + public function setMinValue(?float $minValue): void { $this->minValue = $minValue; } diff --git a/models/DataObject/ClassDefinition/Data/Objectbricks.php b/models/DataObject/ClassDefinition/Data/Objectbricks.php index d5a0bdb55de..a1a56e65933 100644 --- a/models/DataObject/ClassDefinition/Data/Objectbricks.php +++ b/models/DataObject/ClassDefinition/Data/Objectbricks.php @@ -381,7 +381,7 @@ public function load(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objec return null; } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { $container = $this->load($object); if ($container) { @@ -522,7 +522,7 @@ public function getGetterCode(DataObject\Objectbrick\Definition|DataObject\Class /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ($data instanceof DataObject\Objectbrick) { $validationExceptions = []; @@ -795,7 +795,7 @@ public function rewriteIds(mixed $container, array $idMapping, array $params = [ /** * @param DataObject\ClassDefinition\Data\Objectbricks $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->allowedTypes = $masterDefinition->allowedTypes; $this->maxItems = $masterDefinition->maxItems; @@ -807,7 +807,7 @@ public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data * @param DataObject\ClassDefinition $class * @param array $params */ - public function classSaved(DataObject\ClassDefinition $class, array $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []): void { if (is_array($this->allowedTypes)) { foreach ($this->allowedTypes as $allowedType) { @@ -833,7 +833,7 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = [] * @param DataObject\ClassDefinition\Data[] $container * @param CalculatedValue[] $list */ - public static function collectCalculatedValueItems(array $container, array &$list = []) + public static function collectCalculatedValueItems(array $container, array &$list = []): void { if (is_array($container)) { foreach ($container as $childDef) { diff --git a/models/DataObject/ClassDefinition/Data/Password.php b/models/DataObject/ClassDefinition/Data/Password.php index b04606ed542..8e3b1f288f7 100644 --- a/models/DataObject/ClassDefinition/Data/Password.php +++ b/models/DataObject/ClassDefinition/Data/Password.php @@ -92,7 +92,7 @@ public function setMinimumLength(?int $minimumLength): void $this->minimumLength = $minimumLength; } - public function setAlgorithm(string $algorithm) + public function setAlgorithm(string $algorithm): void { $this->algorithm = $algorithm; } @@ -102,7 +102,7 @@ public function getAlgorithm(): string return $this->algorithm; } - public function setSalt(string $salt) + public function setSalt(string $salt): void { $this->salt = $salt; } @@ -112,7 +112,7 @@ public function getSalt(): string return $this->salt; } - public function setSaltlocation(string $saltlocation) + public function setSaltlocation(string $saltlocation): void { $this->saltlocation = $saltlocation; } @@ -387,7 +387,7 @@ public function getDiffDataForEditMode(mixed $data, DataObject\Concrete $object /** * @param DataObject\ClassDefinition\Data\Password $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->algorithm = $masterDefinition->algorithm; $this->salt = $masterDefinition->salt; @@ -421,7 +421,7 @@ public function getPhpdocReturnType(): ?string * * @throws Model\Element\ValidationException|\Exception */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && ($this->getMinimumLength() && is_string($data) && strlen($data) < $this->getMinimumLength())) { throw new Model\Element\ValidationException('Value in field [ ' . $this->getName() . ' ] is not at least ' . $this->getMinimumLength() . ' characters'); diff --git a/models/DataObject/ClassDefinition/Data/QuantityValue.php b/models/DataObject/ClassDefinition/Data/QuantityValue.php index 8cd43c80db5..277c8b47074 100644 --- a/models/DataObject/ClassDefinition/Data/QuantityValue.php +++ b/models/DataObject/ClassDefinition/Data/QuantityValue.php @@ -167,7 +167,7 @@ public function getUnitWidth(): int|string return $this->unitWidth; } - public function setUnitWidth(int|string $unitWidth) + public function setUnitWidth(int|string $unitWidth): void { if (is_numeric($unitWidth)) { $unitWidth = (int)$unitWidth; @@ -184,7 +184,7 @@ public function getDefaultValue(): float|int|string|null return null; } - public function setDefaultValue(float|int|string|null $defaultValue) + public function setDefaultValue(float|int|string|null $defaultValue): void { if ((string)$defaultValue !== '') { $this->defaultValue = $defaultValue; @@ -193,7 +193,7 @@ public function setDefaultValue(float|int|string|null $defaultValue) } } - public function setValidUnits(array $validUnits) + public function setValidUnits(array $validUnits): void { $this->validUnits = $validUnits; } @@ -208,12 +208,12 @@ public function getDefaultUnit(): ?string return $this->defaultUnit; } - public function setDefaultUnit(string $defaultUnit) + public function setDefaultUnit(string $defaultUnit): void { $this->defaultUnit = $defaultUnit; } - public function setInteger(bool $integer) + public function setInteger(bool $integer): void { $this->integer = $integer; } @@ -223,7 +223,7 @@ public function getInteger(): bool return $this->integer; } - public function setMaxValue(?float $maxValue) + public function setMaxValue(?float $maxValue): void { $this->maxValue = $maxValue; } @@ -233,7 +233,7 @@ public function getMaxValue(): ?float return $this->maxValue; } - public function setMinValue(?float $minValue) + public function setMinValue(?float $minValue): void { $this->minValue = $minValue; } @@ -243,7 +243,7 @@ public function getMinValue(): ?float return $this->minValue; } - public function setUnsigned(bool $unsigned) + public function setUnsigned(bool $unsigned): void { $this->unsigned = $unsigned; } @@ -258,7 +258,7 @@ public function getDecimalSize(): ?int return $this->decimalSize; } - public function setDecimalSize(?int $decimalSize) + public function setDecimalSize(?int $decimalSize): void { if (!is_numeric($decimalSize)) { $decimalSize = null; @@ -267,7 +267,7 @@ public function setDecimalSize(?int $decimalSize) $this->decimalSize = $decimalSize; } - public function setDecimalPrecision(?int $decimalPrecision) + public function setDecimalPrecision(?int $decimalPrecision): void { if (!is_numeric($decimalPrecision)) { $decimalPrecision = null; @@ -286,7 +286,7 @@ public function getUnique(): bool return $this->unique; } - public function setUnique(bool $unique) + public function setUnique(bool $unique): void { $this->unique = (bool) $unique; } @@ -296,7 +296,7 @@ public function isAutoConvert(): bool return $this->autoConvert; } - public function setAutoConvert(bool $autoConvert) + public function setAutoConvert(bool $autoConvert): void { $this->autoConvert = (bool)$autoConvert; } @@ -548,7 +548,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ( !$omitMandatoryCheck @@ -639,7 +639,7 @@ public function getDataForGrid(?Model\DataObject\Data\QuantityValue $data, Concr /** * @internal */ - public function configureOptions() + public function configureOptions(): void { if (!$this->validUnits) { $table = null; @@ -706,12 +706,7 @@ protected function doGetDefaultValue(Concrete $object, array $context = []): ?Mo return null; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); diff --git a/models/DataObject/ClassDefinition/Data/QuantityValueRange.php b/models/DataObject/ClassDefinition/Data/QuantityValueRange.php index 902846d9a93..3cf682bc11b 100644 --- a/models/DataObject/ClassDefinition/Data/QuantityValueRange.php +++ b/models/DataObject/ClassDefinition/Data/QuantityValueRange.php @@ -136,9 +136,9 @@ public function isAutoConvert(): bool return $this->autoConvert; } - public function setAutoConvert($autoConvert): void + public function setAutoConvert(bool $autoConvert): void { - $this->autoConvert = (bool) $autoConvert; + $this->autoConvert = $autoConvert; } /** @@ -411,12 +411,7 @@ public function configureOptions(): void } } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); $obj->configureOptions(); diff --git a/models/DataObject/ClassDefinition/Data/Relations/AbstractRelations.php b/models/DataObject/ClassDefinition/Data/Relations/AbstractRelations.php index e00b0db1427..bd71249b651 100644 --- a/models/DataObject/ClassDefinition/Data/Relations/AbstractRelations.php +++ b/models/DataObject/ClassDefinition/Data/Relations/AbstractRelations.php @@ -217,7 +217,7 @@ abstract protected function loadData(array $data, Localizedfield|AbstractData|\P */ abstract protected function prepareDataForPersistence(array|Element\ElementInterface $data, Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object = null, array $params = []): mixed; - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { } @@ -260,7 +260,7 @@ public function getPathFormatterClass(): ?string return $this->pathFormatterClass; } - public function setPathFormatterClass(?string $pathFormatterClass) + public function setPathFormatterClass(?string $pathFormatterClass): void { $this->pathFormatterClass = $pathFormatterClass; } @@ -383,7 +383,7 @@ public function supportsDirtyDetection(): bool * * @throws \Exception */ - protected function loadLazyFieldcollectionField(DataObject\Fieldcollection\Data\AbstractData $item) + protected function loadLazyFieldcollectionField(DataObject\Fieldcollection\Data\AbstractData $item): void { if ($item->getObject()) { /** @var DataObject\Fieldcollection|null $container */ @@ -404,7 +404,7 @@ protected function loadLazyFieldcollectionField(DataObject\Fieldcollection\Data\ * * @throws \Exception */ - protected function loadLazyBrickField(DataObject\Objectbrick\Data\AbstractData $item) + protected function loadLazyBrickField(DataObject\Objectbrick\Data\AbstractData $item): void { if ($item->getObject()) { $fieldName = $item->getFieldName(); @@ -429,7 +429,7 @@ protected function loadLazyBrickField(DataObject\Objectbrick\Data\AbstractData $ * * @internal */ - public function performMultipleAssignmentCheck(?array $data) + public function performMultipleAssignmentCheck(?array $data): void { if (is_array($data)) { if (!method_exists($this, 'getAllowMultipleAssignments') || !$this->getAllowMultipleAssignments()) { diff --git a/models/DataObject/ClassDefinition/Data/ReverseObjectRelation.php b/models/DataObject/ClassDefinition/Data/ReverseObjectRelation.php index 57189734b20..4c03c9cd411 100644 --- a/models/DataObject/ClassDefinition/Data/ReverseObjectRelation.php +++ b/models/DataObject/ClassDefinition/Data/ReverseObjectRelation.php @@ -145,7 +145,7 @@ protected function allowObjectRelation($object): bool /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { //TODO if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { diff --git a/models/DataObject/ClassDefinition/Data/RgbaColor.php b/models/DataObject/ClassDefinition/Data/RgbaColor.php index b59b4e939f0..99741bcd7fd 100644 --- a/models/DataObject/ClassDefinition/Data/RgbaColor.php +++ b/models/DataObject/ClassDefinition/Data/RgbaColor.php @@ -200,7 +200,7 @@ public function getDataFromGridEditor(?string $data, Concrete $object = null, ar /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { parent::checkValidity($data, $omitMandatoryCheck); @@ -227,7 +227,7 @@ private function checkColorComponent(?int $color): void /** * @param Model\DataObject\ClassDefinition\Data\RgbaColor $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->width = $masterDefinition->width; } diff --git a/models/DataObject/ClassDefinition/Data/Select.php b/models/DataObject/ClassDefinition/Data/Select.php index 9f94a5b320b..bb5aa0950b1 100644 --- a/models/DataObject/ClassDefinition/Data/Select.php +++ b/models/DataObject/ClassDefinition/Data/Select.php @@ -327,7 +327,7 @@ public function getDiffDataForEditMode(mixed $data, DataObject\Concrete $object /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && $this->isEmpty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ ' . $this->getName() . ' ]'); @@ -346,7 +346,7 @@ public function isEmpty(mixed $data): bool /** * @param DataObject\ClassDefinition\Data\Select $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->options = $masterDefinition->options; $this->columnLength = $masterDefinition->columnLength; @@ -360,7 +360,7 @@ public function getDefaultValue(): ?string return $this->defaultValue; } - public function setDefaultValue(?string $defaultValue) + public function setDefaultValue(?string $defaultValue): void { $this->defaultValue = $defaultValue; } @@ -370,7 +370,7 @@ public function getOptionsProviderClass(): ?string return $this->optionsProviderClass; } - public function setOptionsProviderClass(?string $optionsProviderClass) + public function setOptionsProviderClass(?string $optionsProviderClass): void { $this->optionsProviderClass = $optionsProviderClass; } @@ -380,7 +380,7 @@ public function getOptionsProviderData(): ?string return $this->optionsProviderData; } - public function setOptionsProviderData(?string $optionsProviderData) + public function setOptionsProviderData(?string $optionsProviderData): void { $this->optionsProviderData = $optionsProviderData; } @@ -547,13 +547,7 @@ public function getPhpdocReturnType(): ?string return 'string|null'; } - /** - * @param mixed $oldValue - * @param mixed $newValue - * - * @return bool - */ - public function isEqual($oldValue, $newValue): bool + public function isEqual(mixed $oldValue, mixed $newValue): bool { return $oldValue == $newValue; } diff --git a/models/DataObject/ClassDefinition/Data/Slider.php b/models/DataObject/ClassDefinition/Data/Slider.php index ca105816cc3..a44538f2c27 100644 --- a/models/DataObject/ClassDefinition/Data/Slider.php +++ b/models/DataObject/ClassDefinition/Data/Slider.php @@ -269,7 +269,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && $data === null) { throw new Model\Element\ValidationException('Empty mandatory field [ '.$this->getName().' ] '.(string)$data); @@ -291,7 +291,7 @@ public function isDiffChangeAllowed(Concrete $object, array $params = []): bool /** * @param DataObject\ClassDefinition\Data\Slider $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->minValue = $masterDefinition->minValue; $this->maxValue = $masterDefinition->maxValue; diff --git a/models/DataObject/ClassDefinition/Data/StructuredTable.php b/models/DataObject/ClassDefinition/Data/StructuredTable.php index d6f94d5724a..f4b3e6425c2 100644 --- a/models/DataObject/ClassDefinition/Data/StructuredTable.php +++ b/models/DataObject/ClassDefinition/Data/StructuredTable.php @@ -303,7 +303,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory()) { $empty = true; @@ -454,7 +454,7 @@ public function getDiffDataForEditMode(mixed $data, DataObject\Concrete $object /** * @param DataObject\ClassDefinition\Data\StructuredTable $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->labelWidth = $masterDefinition->labelWidth; $this->labelFirstCell = $masterDefinition->labelFirstCell; diff --git a/models/DataObject/ClassDefinition/Data/Table.php b/models/DataObject/ClassDefinition/Data/Table.php index bf16b7c9840..b12ee343910 100644 --- a/models/DataObject/ClassDefinition/Data/Table.php +++ b/models/DataObject/ClassDefinition/Data/Table.php @@ -384,7 +384,7 @@ public function getVersionPreview(mixed $data, DataObject\Concrete $object = nul /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); @@ -491,7 +491,7 @@ public function getDiffVersionPreview(?array $data, Concrete $object = null, arr /** * @param DataObject\ClassDefinition\Data\Table $masterDefinition */ - public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(DataObject\ClassDefinition\Data $masterDefinition): void { $this->cols = $masterDefinition->cols; $this->colsFixed = $masterDefinition->colsFixed; diff --git a/models/DataObject/ClassDefinition/Data/TargetGroup.php b/models/DataObject/ClassDefinition/Data/TargetGroup.php index 3b3acccc892..1552e08a6d0 100644 --- a/models/DataObject/ClassDefinition/Data/TargetGroup.php +++ b/models/DataObject/ClassDefinition/Data/TargetGroup.php @@ -79,7 +79,7 @@ public function getDataForResource(mixed $data, DataObject\Concrete $object = nu /** * @internal */ - public function configureOptions() + public function configureOptions(): void { /** @var Tool\Targeting\TargetGroup\Listing|Tool\Targeting\TargetGroup\Listing\Dao $list */ $list = new Tool\Targeting\TargetGroup\Listing(); @@ -102,7 +102,7 @@ public function configureOptions() /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); @@ -117,12 +117,7 @@ public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, arr } } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); $options = $obj->getOptions(); diff --git a/models/DataObject/ClassDefinition/Data/TargetGroupMultiselect.php b/models/DataObject/ClassDefinition/Data/TargetGroupMultiselect.php index f528f27fe56..0153ad89185 100644 --- a/models/DataObject/ClassDefinition/Data/TargetGroupMultiselect.php +++ b/models/DataObject/ClassDefinition/Data/TargetGroupMultiselect.php @@ -34,7 +34,7 @@ class TargetGroupMultiselect extends Model\DataObject\ClassDefinition\Data\Multi /** * @internal */ - public function configureOptions() + public function configureOptions(): void { /** @var Tool\Targeting\TargetGroup\Listing|Tool\Targeting\TargetGroup\Listing\Dao $list */ $list = new Tool\Targeting\TargetGroup\Listing(); @@ -54,12 +54,7 @@ public function configureOptions() $this->setOptions($options); } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); $options = $obj->getOptions(); diff --git a/models/DataObject/ClassDefinition/Data/Textarea.php b/models/DataObject/ClassDefinition/Data/Textarea.php index 4ae09cb84b4..448f867f5c3 100644 --- a/models/DataObject/ClassDefinition/Data/Textarea.php +++ b/models/DataObject/ClassDefinition/Data/Textarea.php @@ -80,7 +80,7 @@ public function getMaxLength(): ?int return $this->maxLength; } - public function setMaxLength(?int $maxLength) + public function setMaxLength(?int $maxLength): void { $this->maxLength = $maxLength; } @@ -90,7 +90,7 @@ public function isShowCharCount(): bool return $this->showCharCount; } - public function setShowCharCount(bool $showCharCount) + public function setShowCharCount(bool $showCharCount): void { $this->showCharCount = (bool) $showCharCount; } @@ -216,7 +216,7 @@ public function getDataForSearchIndex(DataObject\Localizedfield|DataObject\Field /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMaxLength() !== null) { if (mb_strlen($data) > $this->getMaxLength()) { diff --git a/models/DataObject/ClassDefinition/Data/Time.php b/models/DataObject/ClassDefinition/Data/Time.php index 038ac410850..1e205819309 100644 --- a/models/DataObject/ClassDefinition/Data/Time.php +++ b/models/DataObject/ClassDefinition/Data/Time.php @@ -66,7 +66,7 @@ public function getMinValue(): ?string return $this->minValue; } - public function setMinValue(?string $minValue) + public function setMinValue(?string $minValue): void { if (is_string($minValue) && strlen($minValue)) { $this->minValue = $this->toTime($minValue); @@ -80,7 +80,7 @@ public function getMaxValue(): ?string return $this->maxValue; } - public function setMaxValue(?string $maxValue) + public function setMaxValue(?string $maxValue): void { if (is_string($maxValue) && strlen($maxValue)) { $this->maxValue = $this->toTime($maxValue); @@ -92,7 +92,7 @@ public function setMaxValue(?string $maxValue) /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { parent::checkValidity($data, $omitMandatoryCheck); @@ -206,7 +206,7 @@ public function getIncrement(): int return $this->increment; } - public function setIncrement(int $increment) + public function setIncrement(int $increment): void { $this->increment = (int) $increment; } diff --git a/models/DataObject/ClassDefinition/Data/UrlSlug.php b/models/DataObject/ClassDefinition/Data/UrlSlug.php index 15e887d7112..01c73a4e5f2 100644 --- a/models/DataObject/ClassDefinition/Data/UrlSlug.php +++ b/models/DataObject/ClassDefinition/Data/UrlSlug.php @@ -142,7 +142,7 @@ public function getDataFromGridEditor(float $data, Concrete $object = null, arra /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if ($data && !is_array($data)) { throw new Model\Element\ValidationException('Invalid slug data'); @@ -370,7 +370,7 @@ public function load(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objec return $result; } - public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []) + public function delete(Localizedfield|AbstractData|\Pimcore\Model\DataObject\Objectbrick\Data\AbstractData|Concrete $object, array $params = []): void { if (!isset($params['isUpdate']) || !$params['isUpdate']) { $db = Db::get(); @@ -386,7 +386,7 @@ public function getUnique(): bool /** * @param Model\DataObject\ClassDefinition\Data\UrlSlug $masterDefinition */ - public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition) + public function synchronizeWithMasterDefinition(Model\DataObject\ClassDefinition\Data $masterDefinition): void { $this->action = $masterDefinition->action; } diff --git a/models/DataObject/ClassDefinition/Data/User.php b/models/DataObject/ClassDefinition/Data/User.php index 137fe13341e..09e2102b517 100644 --- a/models/DataObject/ClassDefinition/Data/User.php +++ b/models/DataObject/ClassDefinition/Data/User.php @@ -101,7 +101,7 @@ public function getDataForResource(mixed $data, DataObject\Concrete $object = nu /** * @internal */ - public function configureOptions() + public function configureOptions(): void { $list = new Model\User\Listing(); $list->setOrder('asc'); @@ -131,7 +131,7 @@ public function configureOptions() /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Model\Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); @@ -150,12 +150,7 @@ public function getDataForSearchIndex(DataObject\Localizedfield|DataObject\Field return ''; } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = parent::__set_state($data); @@ -166,10 +161,7 @@ public static function __set_state($data) return $obj; } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { $vars = get_object_vars($this); unset($vars['options']); @@ -177,7 +169,7 @@ public function __sleep() return array_keys($vars); } - public function __wakeup() + public function __wakeup(): void { //loads select list options $this->init(); @@ -208,7 +200,7 @@ public function getUnique(): bool return $this->unique; } - public function setUnique(bool $unique) + public function setUnique(bool $unique): void { $this->unique = (bool) $unique; } diff --git a/models/DataObject/ClassDefinition/Data/Wysiwyg.php b/models/DataObject/ClassDefinition/Data/Wysiwyg.php index 6b581a6cf25..230e0b1043a 100644 --- a/models/DataObject/ClassDefinition/Data/Wysiwyg.php +++ b/models/DataObject/ClassDefinition/Data/Wysiwyg.php @@ -77,7 +77,7 @@ class Wysiwyg extends Data implements ResourcePersistenceAwareInterface, QueryRe */ public string|int $maxCharacters = 0; - public function setToolbarConfig(string $toolbarConfig) + public function setToolbarConfig(string $toolbarConfig): void { $this->toolbarConfig = $toolbarConfig; } @@ -104,7 +104,7 @@ public function getMaxCharacters(): int|string return $this->maxCharacters; } - public function setMaxCharacters(int|string $maxCharacters) + public function setMaxCharacters(int|string $maxCharacters): void { $this->maxCharacters = $maxCharacters; } @@ -204,7 +204,7 @@ public function resolveDependencies(mixed $data): array return Text::getDependenciesOfWysiwygText($data); } - public function getCacheTags(mixed $data, $tags = []): array + public function getCacheTags(mixed $data, array $tags = []): array { return Text::getCacheTagsOfWysiwygText($data, $tags); } @@ -212,7 +212,7 @@ public function getCacheTags(mixed $data, $tags = []): array /** * {@inheritdoc} */ - public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []) + public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, array $params = []): void { if (!$omitMandatoryCheck && $this->getMandatory() && empty($data)) { throw new Element\ValidationException('Empty mandatory field [ '.$this->getName().' ]'); diff --git a/models/DataObject/ClassDefinition/DefaultValueGeneratorInterface.php b/models/DataObject/ClassDefinition/DefaultValueGeneratorInterface.php index 0f0031ecf7c..1e97459693a 100644 --- a/models/DataObject/ClassDefinition/DefaultValueGeneratorInterface.php +++ b/models/DataObject/ClassDefinition/DefaultValueGeneratorInterface.php @@ -20,8 +20,5 @@ interface DefaultValueGeneratorInterface { - /** - * @return mixed - */ - public function getValue(Concrete $object, Data $fieldDefinition, array $context); + public function getValue(Concrete $object, Data $fieldDefinition, array $context): mixed; } diff --git a/models/DataObject/ClassDefinition/Helper/Dao.php b/models/DataObject/ClassDefinition/Helper/Dao.php index 4b0705a6bf3..56d245dea8f 100644 --- a/models/DataObject/ClassDefinition/Helper/Dao.php +++ b/models/DataObject/ClassDefinition/Helper/Dao.php @@ -24,7 +24,7 @@ */ trait Dao { - protected function addIndexToField(DataObject\ClassDefinition\Data $field, string $table, string $columnTypeGetter = 'getColumnType', $considerUniqueIndex = false, $isLocalized = false, $isFieldcollection = false): void + protected function addIndexToField(DataObject\ClassDefinition\Data $field, string $table, string $columnTypeGetter = 'getColumnType', bool $considerUniqueIndex = false, bool $isLocalized = false, bool $isFieldcollection = false): void { $columnType = $field->$columnTypeGetter(); diff --git a/models/DataObject/ClassDefinition/Helper/VarExport.php b/models/DataObject/ClassDefinition/Helper/VarExport.php index 1217f87c33c..891d55a9671 100644 --- a/models/DataObject/ClassDefinition/Helper/VarExport.php +++ b/models/DataObject/ClassDefinition/Helper/VarExport.php @@ -21,10 +21,7 @@ */ trait VarExport { - /** - * @var array - */ - protected $blockedVarsForExport = []; + protected array $blockedVarsForExport = []; public function getBlockedVarsForExport(): array { @@ -42,12 +39,7 @@ public function resolveBlockedVars(): array return array_merge($defaultBlockedVars, $this->getBlockedVarsForExport()); } - /** - * @param array $data - * - * @return static - */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = new static(); $obj->setValues($data); diff --git a/models/DataObject/ClassDefinition/Layout.php b/models/DataObject/ClassDefinition/Layout.php index e49da89943b..9e0e5b9b8bd 100644 --- a/models/DataObject/ClassDefinition/Layout.php +++ b/models/DataObject/ClassDefinition/Layout.php @@ -234,7 +234,7 @@ public function hasChildren(): bool * * @param Data|Layout $child */ - public function addChild(mixed $child) + public function addChild(mixed $child): void { $this->children[] = $child; } @@ -329,7 +329,7 @@ public function __sleep(): array /** * {@inheritdoc} */ - public static function __set_state($data) + public static function __set_state(array $data): static { $obj = new static(); $obj->setValues($data); diff --git a/models/DataObject/ClassDefinition/Layout/Text.php b/models/DataObject/ClassDefinition/Layout/Text.php index f25aaea2464..467b9ef628d 100644 --- a/models/DataObject/ClassDefinition/Layout/Text.php +++ b/models/DataObject/ClassDefinition/Layout/Text.php @@ -77,7 +77,7 @@ public function getRenderingClass(): string return $this->renderingClass; } - public function setRenderingClass(string $renderingClass) + public function setRenderingClass(string $renderingClass): void { $this->renderingClass = $renderingClass; } @@ -87,7 +87,7 @@ public function getRenderingData(): string return $this->renderingData; } - public function setRenderingData(string $renderingData) + public function setRenderingData(string $renderingData): void { $this->renderingData = $renderingData; } diff --git a/models/DataObject/Classificationstore.php b/models/DataObject/Classificationstore.php index de30f114a6c..bf9e165af5e 100644 --- a/models/DataObject/Classificationstore.php +++ b/models/DataObject/Classificationstore.php @@ -83,7 +83,7 @@ public function __construct(array $items = null) } } - public function addItem(array $item) + public function addItem(array $item): void { $this->items[] = $item; $this->markFieldDirty('_self'); @@ -235,7 +235,7 @@ public function setLocalizedKeyValue(int $groupId, int $keyId, mixed $value, str * * @param int $groupId */ - public function removeGroupData(int $groupId) + public function removeGroupData(int $groupId): void { unset($this->items[$groupId]); } @@ -253,7 +253,7 @@ public function getFieldname(): string return $this->fieldname; } - public function setFieldname(string $fieldname) + public function setFieldname(string $fieldname): void { $this->fieldname = $fieldname; } @@ -278,7 +278,7 @@ private function sanitizeActiveGroups(array $activeGroups): array return $newList; } - public function setActiveGroups(array $activeGroups) + public function setActiveGroups(array $activeGroups): void { $activeGroups = $this->sanitizeActiveGroups($activeGroups); $diff1 = array_diff(array_keys($activeGroups), array_keys($this->activeGroups)); diff --git a/models/DataObject/Classificationstore/CollectionConfig.php b/models/DataObject/Classificationstore/CollectionConfig.php index 222b9febba2..b97db2e9f51 100644 --- a/models/DataObject/Classificationstore/CollectionConfig.php +++ b/models/DataObject/Classificationstore/CollectionConfig.php @@ -176,7 +176,7 @@ public function setDescription(string $description): static /** * Deletes the key value collection configuration */ - public function delete() + public function delete(): void { $this->dispatchEvent(new CollectionConfigEvent($this), DataObjectClassificationStoreEvents::COLLECTION_CONFIG_PRE_DELETE); if ($this->getId()) { @@ -190,7 +190,7 @@ public function delete() /** * Saves the collection config */ - public function save() + public function save(): void { $isUpdate = false; @@ -203,15 +203,13 @@ public function save() $this->dispatchEvent(new CollectionConfigEvent($this), DataObjectClassificationStoreEvents::COLLECTION_CONFIG_PRE_ADD); } - $model = $this->getDao()->save(); + $this->getDao()->save(); if ($isUpdate) { $this->dispatchEvent(new CollectionConfigEvent($this), DataObjectClassificationStoreEvents::COLLECTION_CONFIG_POST_UPDATE); } else { $this->dispatchEvent(new CollectionConfigEvent($this), DataObjectClassificationStoreEvents::COLLECTION_CONFIG_POST_ADD); } - - return $model; } public function setModificationDate(int $modificationDate): static @@ -257,7 +255,7 @@ public function getStoreId(): int return $this->storeId; } - public function setStoreId(int $storeId) + public function setStoreId(int $storeId): void { $this->storeId = $storeId; } diff --git a/models/DataObject/Classificationstore/CollectionConfig/Dao.php b/models/DataObject/Classificationstore/CollectionConfig/Dao.php index 06a36e3d047..bd9b4a6e2dd 100644 --- a/models/DataObject/Classificationstore/CollectionConfig/Dao.php +++ b/models/DataObject/Classificationstore/CollectionConfig/Dao.php @@ -33,7 +33,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -53,7 +53,7 @@ public function getById(int $id = null) * * @throws Model\Exception\NotFoundException */ - public function getByName(string $name = null) + public function getByName(string $name = null): void { if ($name != null) { $this->model->setName($name); @@ -71,7 +71,7 @@ public function getByName(string $name = null) } } - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -83,7 +83,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME_COLLECTIONS, ['id' => $this->model->getId()]); } @@ -91,7 +91,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $ts = time(); $this->model->setModificationDate($ts); @@ -115,7 +115,7 @@ public function update() $this->db->update(self::TABLE_NAME_COLLECTIONS, $data, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $ts = time(); $this->model->setModificationDate($ts); diff --git a/models/DataObject/Classificationstore/CollectionGroupRelation.php b/models/DataObject/Classificationstore/CollectionGroupRelation.php index 11b54eb89ee..e4d8564a40f 100644 --- a/models/DataObject/Classificationstore/CollectionGroupRelation.php +++ b/models/DataObject/Classificationstore/CollectionGroupRelation.php @@ -30,32 +30,24 @@ final class CollectionGroupRelation extends Model\AbstractModel protected int $groupId; - /** The key - * @var string + /** + * The key */ protected string $name; /** * The key description. - * - * @var string */ protected string $description = ''; protected int $sorter; - public static function create(): CollectionGroupRelation + public static function create(): self { return new self(); } - /** - * @param int|null $groupId - * @param int|null $colId - * - * @return self|null - */ - public static function getByGroupAndColId(int $groupId = null, int $colId = null): ?CollectionGroupRelation + public static function getByGroupAndColId(int $groupId = null, int $colId = null): ?self { try { $config = new self(); @@ -72,7 +64,7 @@ public function getGroupId(): int return $this->groupId; } - public function setGroupId(int $groupId) + public function setGroupId(int $groupId): void { $this->groupId = $groupId; } @@ -82,7 +74,7 @@ public function getName(): string return $this->name; } - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -92,7 +84,7 @@ public function getDescription(): string return $this->description; } - public function setDescription(string $description) + public function setDescription(string $description): void { $this->description = $description; } @@ -102,7 +94,7 @@ public function getColId(): int return $this->colId; } - public function setColId(int $colId) + public function setColId(int $colId): void { $this->colId = $colId; } @@ -112,7 +104,7 @@ public function getSorter(): int return $this->sorter; } - public function setSorter(int $sorter) + public function setSorter(int $sorter): void { $this->sorter = (int) $sorter; } diff --git a/models/DataObject/Classificationstore/CollectionGroupRelation/Dao.php b/models/DataObject/Classificationstore/CollectionGroupRelation/Dao.php index 35683951ee5..10d04ff5bd0 100644 --- a/models/DataObject/Classificationstore/CollectionGroupRelation/Dao.php +++ b/models/DataObject/Classificationstore/CollectionGroupRelation/Dao.php @@ -64,7 +64,7 @@ public function getById(int $colId, int $groupId): void /** * @throws \Exception */ - public function save() + public function save(): void { $this->update(); } @@ -72,7 +72,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME_RELATIONS, [ 'colId' => $this->model->getColId(), @@ -83,7 +83,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $type = $this->model->getObjectVars(); $validTableColumns = $this->getValidTableColumns(self::TABLE_NAME_RELATIONS); diff --git a/models/DataObject/Classificationstore/Dao.php b/models/DataObject/Classificationstore/Dao.php index 5e211dc702c..3598b76015f 100644 --- a/models/DataObject/Classificationstore/Dao.php +++ b/models/DataObject/Classificationstore/Dao.php @@ -46,7 +46,7 @@ public function getGroupsTableName(): string /** * @throws \Exception */ - public function save() + public function save(): void { if (!DataObject::isDirtyDetectionDisabled() && !$this->model->hasDirtyFields()) { return; @@ -137,7 +137,7 @@ public function save() } } - public function delete() + public function delete(): void { $object = $this->model->getObject(); $objectId = $object->getId(); @@ -152,7 +152,7 @@ public function delete() /** * @throws \Exception */ - public function load() + public function load(): void { $classificationStore = $this->model; $object = $this->model->getObject(); @@ -227,7 +227,7 @@ public function load() $classificationStore->resetDirtyMap(); } - public function createUpdateTable() + public function createUpdateTable(): void { $groupsTable = $this->getGroupsTableName(); $dataTable = $this->getDataTableName(); diff --git a/models/DataObject/Classificationstore/GroupConfig.php b/models/DataObject/Classificationstore/GroupConfig.php index e0af5d1851d..d8fb7a37cfe 100644 --- a/models/DataObject/Classificationstore/GroupConfig.php +++ b/models/DataObject/Classificationstore/GroupConfig.php @@ -154,7 +154,7 @@ public function getParentId(): ?int return $this->parentId; } - public function setParentId(int $parentId) + public function setParentId(int $parentId): void { $this->parentId = $parentId; } @@ -198,7 +198,7 @@ public function setDescription(string $description): static /** * Deletes the key value group configuration */ - public function delete() + public function delete(): void { $this->dispatchEvent(new GroupConfigEvent($this), DataObjectClassificationStoreEvents::GROUP_CONFIG_PRE_DELETE); if ($this->getId()) { @@ -212,7 +212,7 @@ public function delete() /** * Saves the group config */ - public function save() + public function save(): void { $isUpdate = false; @@ -225,15 +225,13 @@ public function save() $this->dispatchEvent(new GroupConfigEvent($this), DataObjectClassificationStoreEvents::GROUP_CONFIG_PRE_ADD); } - $model = $this->getDao()->save(); + $this->getDao()->save(); if ($isUpdate) { $this->dispatchEvent(new GroupConfigEvent($this), DataObjectClassificationStoreEvents::GROUP_CONFIG_POST_UPDATE); } else { $this->dispatchEvent(new GroupConfigEvent($this), DataObjectClassificationStoreEvents::GROUP_CONFIG_POST_ADD); } - - return $model; } public function setModificationDate(int $modificationDate): static @@ -279,7 +277,7 @@ public function getStoreId(): int return $this->storeId; } - public function setStoreId(int $storeId) + public function setStoreId(int $storeId): void { $this->storeId = $storeId; } diff --git a/models/DataObject/Classificationstore/GroupConfig/Dao.php b/models/DataObject/Classificationstore/GroupConfig/Dao.php index c7502e09825..cd62ec4c0bc 100644 --- a/models/DataObject/Classificationstore/GroupConfig/Dao.php +++ b/models/DataObject/Classificationstore/GroupConfig/Dao.php @@ -33,7 +33,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -53,7 +53,7 @@ public function getById(int $id = null) * * @throws \Exception */ - public function getByName(string $name = null) + public function getByName(string $name = null): void { if ($name != null) { $this->model->setName($name); @@ -83,7 +83,7 @@ public function hasChildren(): bool /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -95,7 +95,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME_GROUPS, ['id' => $this->model->getId()]); } @@ -103,7 +103,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $ts = time(); $this->model->setModificationDate($ts); @@ -127,7 +127,7 @@ public function update() $this->db->update(self::TABLE_NAME_GROUPS, $data, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $ts = time(); $this->model->setModificationDate($ts); diff --git a/models/DataObject/Classificationstore/KeyConfig.php b/models/DataObject/Classificationstore/KeyConfig.php index 7d81be72533..7baea527129 100644 --- a/models/DataObject/Classificationstore/KeyConfig.php +++ b/models/DataObject/Classificationstore/KeyConfig.php @@ -195,7 +195,7 @@ public function setDescription(string $description): static /** * Deletes the key value key configuration */ - public function delete() + public function delete(): void { DefinitionCache::clear($this); @@ -211,7 +211,7 @@ public function delete() /** * Saves the key config */ - public function save() + public function save(): void { DefinitionCache::clear($this); @@ -247,7 +247,7 @@ public function getCreationDate(): ?int return $this->creationDate; } - public function setCreationDate(int $creationDate) + public function setCreationDate(int $creationDate): void { $this->creationDate = $creationDate; } @@ -257,7 +257,7 @@ public function getModificationDate(): ?int return $this->modificationDate; } - public function setModificationDate(int $modificationDate) + public function setModificationDate(int $modificationDate): void { $this->modificationDate = $modificationDate; } @@ -267,7 +267,7 @@ public function getType(): string return $this->type; } - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } @@ -277,7 +277,7 @@ public function getDefinition(): string return $this->definition; } - public function setDefinition(string $definition) + public function setDefinition(string $definition): void { $this->definition = $definition; } @@ -287,7 +287,7 @@ public function getEnabled(): bool return $this->enabled; } - public function setEnabled(bool $enabled) + public function setEnabled(bool $enabled): void { $this->enabled = $enabled; } @@ -297,7 +297,7 @@ public function getTitle(): ?string return $this->title; } - public function setTitle(string $title) + public function setTitle(string $title): void { $this->title = $title; } @@ -307,7 +307,7 @@ public function getStoreId(): int return $this->storeId; } - public function setStoreId(int $storeId) + public function setStoreId(int $storeId): void { $this->storeId = $storeId; } diff --git a/models/DataObject/Classificationstore/KeyConfig/Dao.php b/models/DataObject/Classificationstore/KeyConfig/Dao.php index aa23ecee6f7..872dd7808a8 100644 --- a/models/DataObject/Classificationstore/KeyConfig/Dao.php +++ b/models/DataObject/Classificationstore/KeyConfig/Dao.php @@ -33,7 +33,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -53,7 +53,7 @@ public function getById(int $id = null) * * @throws \Exception */ - public function getByName(string $name = null) + public function getByName(string $name = null): void { if ($name != null) { $this->model->setName($name); @@ -76,7 +76,7 @@ public function getByName(string $name = null) /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -88,7 +88,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME_KEYS, ['id' => $this->model->getId()]); } @@ -96,7 +96,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $ts = time(); $this->model->setModificationDate($ts); @@ -130,7 +130,7 @@ public function update() $this->db->update(self::TABLE_NAME_KEYS, $data, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $ts = time(); $this->model->setCreationDate($ts); diff --git a/models/DataObject/Classificationstore/KeyConfig/Listing.php b/models/DataObject/Classificationstore/KeyConfig/Listing.php index 4eb5b7a7d42..813d723beb0 100644 --- a/models/DataObject/Classificationstore/KeyConfig/Listing.php +++ b/models/DataObject/Classificationstore/KeyConfig/Listing.php @@ -51,7 +51,7 @@ public function getIncludeDisabled(): bool return $this->includeDisabled; } - public function setIncludeDisabled(bool $includeDisabled) + public function setIncludeDisabled(bool $includeDisabled): void { $this->includeDisabled = (bool) $includeDisabled; } diff --git a/models/DataObject/Classificationstore/KeyGroupRelation.php b/models/DataObject/Classificationstore/KeyGroupRelation.php index 335aa816b17..b8b8f32caf2 100644 --- a/models/DataObject/Classificationstore/KeyGroupRelation.php +++ b/models/DataObject/Classificationstore/KeyGroupRelation.php @@ -30,36 +30,30 @@ final class KeyGroupRelation extends Model\AbstractModel protected int $groupId; - /** The key - * @var string + /** + * The key */ protected string $name; /** * The key description. - * - * @var string */ protected string $description = ''; /** * Field definition - * - * @var string */ protected string $definition; /** * Field type - * - * @var string */ protected string $type; protected int $sorter; - /** The group name - * @var string + /** + * The group name */ protected string $groupName; @@ -67,7 +61,7 @@ final class KeyGroupRelation extends Model\AbstractModel protected bool $enabled; - public static function create(): KeyGroupRelation + public static function create(): self { return new self(); } @@ -77,7 +71,7 @@ public function getGroupId(): int return $this->groupId; } - public function setGroupId(int $groupId) + public function setGroupId(int $groupId): void { $this->groupId = $groupId; } @@ -87,7 +81,7 @@ public function getKeyId(): int return $this->keyId; } - public function setKeyId(int $keyId) + public function setKeyId(int $keyId): void { $this->keyId = $keyId; } @@ -97,7 +91,7 @@ public function getName(): string return $this->name; } - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -107,7 +101,7 @@ public function getDescription(): string return $this->description; } - public function setDescription(string $description) + public function setDescription(string $description): void { $this->description = $description; } @@ -117,7 +111,7 @@ public function getDefinition(): string return $this->definition; } - public function setDefinition(string $definition) + public function setDefinition(string $definition): void { $this->definition = $definition; } @@ -127,7 +121,7 @@ public function getType(): string return $this->type; } - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } @@ -137,7 +131,7 @@ public function getSorter(): int return $this->sorter; } - public function setSorter(int $sorter) + public function setSorter(int $sorter): void { $this->sorter = (int) $sorter; } @@ -147,7 +141,7 @@ public function isMandatory(): bool return $this->mandatory; } - public function setMandatory(bool $mandatory) + public function setMandatory(bool $mandatory): void { $this->mandatory = (bool)$mandatory; } @@ -157,7 +151,7 @@ public function isEnabled(): bool return $this->enabled; } - public function setEnabled(bool $enabled) + public function setEnabled(bool $enabled): void { $this->enabled = $enabled; } diff --git a/models/DataObject/Classificationstore/KeyGroupRelation/Dao.php b/models/DataObject/Classificationstore/KeyGroupRelation/Dao.php index f6b093bcb65..4b0e8aebeac 100644 --- a/models/DataObject/Classificationstore/KeyGroupRelation/Dao.php +++ b/models/DataObject/Classificationstore/KeyGroupRelation/Dao.php @@ -61,7 +61,7 @@ public function getById(int $keyId, int $groupId): void } } - public function save() + public function save(): void { $this->update(); } @@ -69,7 +69,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME_RELATIONS, [ 'keyId' => $this->model->getKeyId(), @@ -77,7 +77,7 @@ public function delete() ]); } - public function update() + public function update(): void { $type = $this->model->getObjectVars(); $validTableColumns = $this->getValidTableColumns(self::TABLE_NAME_RELATIONS); diff --git a/models/DataObject/Classificationstore/KeyGroupRelation/Listing.php b/models/DataObject/Classificationstore/KeyGroupRelation/Listing.php index 539c44959f7..daa2e067ade 100644 --- a/models/DataObject/Classificationstore/KeyGroupRelation/Listing.php +++ b/models/DataObject/Classificationstore/KeyGroupRelation/Listing.php @@ -51,7 +51,7 @@ public function getResolveGroupName(): bool return $this->resolveGroupName; } - public function setResolveGroupName(bool $resolveGroupName) + public function setResolveGroupName(bool $resolveGroupName): void { $this->resolveGroupName = (bool) $resolveGroupName; } diff --git a/models/DataObject/Classificationstore/StoreConfig.php b/models/DataObject/Classificationstore/StoreConfig.php index 9de6307a15d..faa6c29fff2 100644 --- a/models/DataObject/Classificationstore/StoreConfig.php +++ b/models/DataObject/Classificationstore/StoreConfig.php @@ -115,7 +115,7 @@ public function setDescription(string $description): static /** * Deletes the key value group configuration */ - public function delete() + public function delete(): void { $this->dispatchEvent(new StoreConfigEvent($this), DataObjectClassificationStoreEvents::STORE_CONFIG_PRE_DELETE); $this->getDao()->delete(); @@ -125,7 +125,7 @@ public function delete() /** * Saves the store config */ - public function save() + public function save(): void { $isUpdate = false; @@ -136,15 +136,13 @@ public function save() $this->dispatchEvent(new StoreConfigEvent($this), DataObjectClassificationStoreEvents::STORE_CONFIG_PRE_ADD); } - $model = $this->getDao()->save(); + $this->getDao()->save(); if ($isUpdate) { $this->dispatchEvent(new StoreConfigEvent($this), DataObjectClassificationStoreEvents::STORE_CONFIG_POST_UPDATE); } else { $this->dispatchEvent(new StoreConfigEvent($this), DataObjectClassificationStoreEvents::STORE_CONFIG_POST_ADD); } - - return $model; } public function getId(): ?int @@ -152,7 +150,7 @@ public function getId(): ?int return $this->id; } - public function setId(int $id) + public function setId(int $id): void { $this->id = $id; } diff --git a/models/DataObject/Classificationstore/StoreConfig/Dao.php b/models/DataObject/Classificationstore/StoreConfig/Dao.php index edde909739d..dc110355cef 100644 --- a/models/DataObject/Classificationstore/StoreConfig/Dao.php +++ b/models/DataObject/Classificationstore/StoreConfig/Dao.php @@ -33,7 +33,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -53,7 +53,7 @@ public function getById(int $id = null) * * @throws Model\Exception\NotFoundException */ - public function getByName(string $name = null) + public function getByName(string $name = null): void { if ($name != null) { $this->model->setName($name); @@ -73,7 +73,7 @@ public function getByName(string $name = null) /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -85,7 +85,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME_STORES, ['id' => $this->model->getId()]); } @@ -93,7 +93,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $data = []; $type = $this->model->getObjectVars(); @@ -114,7 +114,7 @@ public function update() $this->db->update(self::TABLE_NAME_STORES, $data, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $this->db->insert(self::TABLE_NAME_STORES, []); $this->model->setId((int) $this->db->lastInsertId()); diff --git a/models/DataObject/Concrete.php b/models/DataObject/Concrete.php index 6038848881c..49f844befd0 100644 --- a/models/DataObject/Concrete.php +++ b/models/DataObject/Concrete.php @@ -122,7 +122,7 @@ public static function classId(): string /** * {@inheritdoc} */ - protected function update(bool $isUpdate = null, array $params = []) + protected function update(bool $isUpdate = null, array $params = []): void { $fieldDefinitions = $this->getClass()->getFieldDefinitions(); @@ -225,7 +225,7 @@ private function saveChildData(): void /** * {@inheritdoc} */ - protected function doDelete() + protected function doDelete(): void { // Dispatch Symfony Message Bus to delete versions \Pimcore::getContainer()->get('messenger.bus.pimcore-core')->dispatch( @@ -712,12 +712,12 @@ public function isAllLazyKeysMarkedAsLoaded(): bool return $this->allLazyKeysMarkedAsLoaded; } - public function markAllLazyLoadedKeysAsLoaded() + public function markAllLazyLoadedKeysAsLoaded(): void { $this->allLazyKeysMarkedAsLoaded = true; } - public function __sleep() + public function __sleep(): array { $parentVars = parent::__sleep(); @@ -741,7 +741,7 @@ public function __sleep() return $finalVars; } - public function __wakeup() + public function __wakeup(): void { parent::__wakeup(); diff --git a/models/DataObject/Concrete/Dao.php b/models/DataObject/Concrete/Dao.php index d988f754eb1..c6b82ae1f0e 100644 --- a/models/DataObject/Concrete/Dao.php +++ b/models/DataObject/Concrete/Dao.php @@ -37,12 +37,12 @@ class Dao extends Model\DataObject\AbstractObject\Dao protected ?Dao\InheritanceHelper $inheritanceHelper = null; - public function init() + public function init(): void { return; } - protected function getInheritanceHelper() + protected function getInheritanceHelper(): Dao\InheritanceHelper { if (!$this->inheritanceHelper) { $this->inheritanceHelper = new DataObject\Concrete\Dao\InheritanceHelper($this->model->getClassId()); @@ -58,7 +58,7 @@ protected function getInheritanceHelper() * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative("SELECT objects.*, tree_locks.locked as locked FROM objects LEFT JOIN tree_locks ON objects.id = tree_locks.id AND tree_locks.type = 'object' @@ -137,7 +137,7 @@ public function getRelationData(string $field, bool $forOwner, ?string $remoteCl /** * Get all data-elements for all fields that are not lazy-loaded. */ - public function getData() + public function getData(): void { if (empty($this->model->getClass())) { return; @@ -188,7 +188,7 @@ public function getData() * * @param bool|null $isUpdate */ - public function update(bool $isUpdate = null) + public function update(bool $isUpdate = null): void { parent::update($isUpdate); @@ -407,7 +407,7 @@ public function update(bool $isUpdate = null) DataObject::setGetInheritedValues($inheritedValues); } - public function saveChildData() + public function saveChildData(): void { $this->getInheritanceHelper()->doUpdate($this->model->getId(), false, [ 'inheritanceRelationContext' => [ diff --git a/models/DataObject/Data/AbstractMetadata/Dao.php b/models/DataObject/Data/AbstractMetadata/Dao.php index 5caa8f2bc84..af1e8dc0ad6 100644 --- a/models/DataObject/Data/AbstractMetadata/Dao.php +++ b/models/DataObject/Data/AbstractMetadata/Dao.php @@ -28,7 +28,7 @@ class Dao extends Model\Dao\AbstractDao protected ?array $tableDefinitions = null; - public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index, string $type = 'object') + public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index, string $type = 'object'): void { throw new \Exception('Needs to be implemented by child class'); } @@ -43,7 +43,7 @@ public function load(DataObject\Concrete $source, int $destinationId, string $fi throw new \Exception('Needs to be implemented by child class'); } - public function createOrUpdateTable(DataObject\ClassDefinition $class) + public function createOrUpdateTable(DataObject\ClassDefinition $class): void { $classId = $class->getId(); $table = 'object_metadata_' . $classId; diff --git a/models/DataObject/Data/AbstractQuantityValue.php b/models/DataObject/Data/AbstractQuantityValue.php index e9555d97ac4..3d32ce08730 100644 --- a/models/DataObject/Data/AbstractQuantityValue.php +++ b/models/DataObject/Data/AbstractQuantityValue.php @@ -45,7 +45,7 @@ public function __construct(Unit|string $unit = null) $this->markMeDirty(); } - public function setUnitId(string $unitId) + public function setUnitId(string $unitId): void { $this->unitId = $unitId; $this->unit = null; @@ -93,7 +93,7 @@ public function convertTo(Unit|string $unit): AbstractQuantityValue return $converter->convert($this, $unit); } - abstract public function getValue(); + abstract public function getValue(): mixed; abstract public function __toString(); } diff --git a/models/DataObject/Data/BlockElement.php b/models/DataObject/Data/BlockElement.php index e1aba883584..64b391485bd 100644 --- a/models/DataObject/Data/BlockElement.php +++ b/models/DataObject/Data/BlockElement.php @@ -69,7 +69,7 @@ public function getName(): string return $this->name; } - public function setName(string $name) + public function setName(string $name): void { if ($name != $this->name) { $this->name = $name; @@ -82,7 +82,7 @@ public function getType(): string return $this->type; } - public function setType(string $type) + public function setType(string $type): void { if ($type != $this->type) { $this->type = $type; @@ -100,13 +100,13 @@ public function getData(): mixed return $this->data; } - public function setData(mixed $data) + public function setData(mixed $data): void { $this->data = $data; $this->markMeDirty(); } - protected function renewReferences() + protected function renewReferences(): void { $copier = new DeepCopy(); $copier->skipUncloneable(true); @@ -154,7 +154,7 @@ public function __toString() return $this->name . '; ' . $this->type; } - public function __wakeup() + public function __wakeup(): void { $this->needsRenewReferences = true; @@ -180,12 +180,12 @@ public function getNeedsRenewReferences(): bool * * @param bool $needsRenewReferences */ - public function setNeedsRenewReferences(bool $needsRenewReferences) + public function setNeedsRenewReferences(bool $needsRenewReferences): void { $this->needsRenewReferences = (bool) $needsRenewReferences; } - public function setLanguage(string $language) + public function setLanguage(string $language): void { $this->_language = $language; } diff --git a/models/DataObject/Data/CalculatedValue.php b/models/DataObject/Data/CalculatedValue.php index 84c7b120d54..f69fc318e44 100644 --- a/models/DataObject/Data/CalculatedValue.php +++ b/models/DataObject/Data/CalculatedValue.php @@ -62,7 +62,7 @@ public function __construct(string $fieldname) * @internal * */ - public function setContextualData(string $ownerType, ?string $ownerName, int|string|null $index, ?string $position, int $groupId = null, int $keyId = null, mixed $keyDefinition = null) + public function setContextualData(string $ownerType, ?string $ownerName, int|string|null $index, ?string $position, int $groupId = null, int $keyId = null, mixed $keyDefinition = null): void { $this->ownerType = $ownerType; $this->ownerName = $ownerName; diff --git a/models/DataObject/Data/ElementMetadata.php b/models/DataObject/Data/ElementMetadata.php index e4f60c1b0ca..45c6f43ff3c 100644 --- a/models/DataObject/Data/ElementMetadata.php +++ b/models/DataObject/Data/ElementMetadata.php @@ -51,7 +51,7 @@ public function __construct(?string $fieldname = null, array $columns = [], Mode $this->setElement($element); } - public function setElementTypeAndId(?string $elementType, ?int $elementId) + public function setElementTypeAndId(?string $elementType, ?int $elementId): void { $this->elementType = $elementType; $this->elementId = $elementId; @@ -95,7 +95,7 @@ public function __call(string $method, array $args) } } - public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index) + public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index): void { $element = $this->getElement(); $type = Model\Element\Service::getElementType($element); diff --git a/models/DataObject/Data/ElementMetadata/Dao.php b/models/DataObject/Data/ElementMetadata/Dao.php index 77f6b46c07b..091ca80bed3 100644 --- a/models/DataObject/Data/ElementMetadata/Dao.php +++ b/models/DataObject/Data/ElementMetadata/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends DataObject\Data\AbstractMetadata\Dao { - public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index, string $type = 'object') + public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index, string $type = 'object'): void { $table = $this->getTablename($object); diff --git a/models/DataObject/Data/EncryptedField.php b/models/DataObject/Data/EncryptedField.php index 5f52169b33e..0c3c0b3e31d 100644 --- a/models/DataObject/Data/EncryptedField.php +++ b/models/DataObject/Data/EncryptedField.php @@ -50,7 +50,7 @@ public function getDelegate(): Data return $this->delegate; } - public function setDelegate(Data $delegate) + public function setDelegate(Data $delegate): void { $this->delegate = $delegate; } @@ -60,7 +60,7 @@ public function getPlain(): mixed return $this->plain; } - public function setPlain(mixed $plain) + public function setPlain(mixed $plain): void { $this->plain = $plain; $this->markMeDirty(); @@ -71,7 +71,7 @@ public function setPlain(mixed $plain) * * @throws \Exception */ - public function __sleep() + public function __sleep(): array { if ($this->plain) { try { @@ -102,7 +102,7 @@ public function __sleep() /** * @throws \Exception */ - public function __wakeup() + public function __wakeup(): void { if ($this->encrypted) { try { diff --git a/models/DataObject/Data/ExternalImage.php b/models/DataObject/Data/ExternalImage.php index 771d72e2a72..a0007f56f70 100644 --- a/models/DataObject/Data/ExternalImage.php +++ b/models/DataObject/Data/ExternalImage.php @@ -39,7 +39,7 @@ public function getUrl(): ?string return $this->url; } - public function setUrl(?string $url) + public function setUrl(?string $url): void { $this->url = $url; $this->markMeDirty(); diff --git a/models/DataObject/Data/Hotspotimage.php b/models/DataObject/Data/Hotspotimage.php index ca174f35cef..91ef2a4465c 100644 --- a/models/DataObject/Data/Hotspotimage.php +++ b/models/DataObject/Data/Hotspotimage.php @@ -122,7 +122,7 @@ public function getMarker(): ?array /** * @param array[]|null $crop */ - public function setCrop(?array $crop) + public function setCrop(?array $crop): void { $this->crop = $crop; $this->markMeDirty(); @@ -211,7 +211,7 @@ public function __toString() return ''; } - public function __wakeup() + public function __wakeup(): void { if ($this->image instanceof ElementDescriptor) { $image = Service::getElementById($this->image->getType(), $this->image->getId()); diff --git a/models/DataObject/Data/ImageGallery.php b/models/DataObject/Data/ImageGallery.php index 78ad433ac81..a347ce47160 100644 --- a/models/DataObject/Data/ImageGallery.php +++ b/models/DataObject/Data/ImageGallery.php @@ -73,7 +73,7 @@ public function getItems(): array /** * @param Hotspotimage[] $items */ - public function setItems(array $items) + public function setItems(array $items): void { if (!is_array($items)) { $items = []; diff --git a/models/DataObject/Data/InputQuantityValue.php b/models/DataObject/Data/InputQuantityValue.php index 6fae3452810..bab75c8c6f9 100644 --- a/models/DataObject/Data/InputQuantityValue.php +++ b/models/DataObject/Data/InputQuantityValue.php @@ -32,7 +32,7 @@ public function __construct(?string $value = null, Unit|string $unit = null) parent::__construct($value, $unit); } - public function setValue(float|int|string|null $value) + public function setValue(float|int|string|null $value): void { $this->value = $value; $this->markMeDirty(); diff --git a/models/DataObject/Data/Link.php b/models/DataObject/Data/Link.php index 1d58b33e034..198b1003763 100644 --- a/models/DataObject/Data/Link.php +++ b/models/DataObject/Data/Link.php @@ -215,7 +215,7 @@ public function setTabindex(string $tabindex): static return $this; } - public function setAttributes(string $attributes) + public function setAttributes(string $attributes): void { $this->attributes = $attributes; $this->markMeDirty(); @@ -226,7 +226,7 @@ public function getAttributes(): string return $this->attributes; } - public function setClass(string $class) + public function setClass(string $class): void { $this->class = $class; $this->markMeDirty(); diff --git a/models/DataObject/Data/ObjectMetadata.php b/models/DataObject/Data/ObjectMetadata.php index 952802972a1..cd47dcc001e 100644 --- a/models/DataObject/Data/ObjectMetadata.php +++ b/models/DataObject/Data/ObjectMetadata.php @@ -102,7 +102,7 @@ public function __call(string $method, array $args) } } - public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index) + public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index): void { $this->getDao()->save($object, $ownertype, $ownername, $position, $index); } @@ -191,12 +191,12 @@ public function getObjectId(): int return (int) $this->objectId; } - public function setObjectId(?int $objectId) + public function setObjectId(?int $objectId): void { $this->objectId = $objectId; } - public function __wakeup() + public function __wakeup(): void { if ($this->object) { $this->objectId = $this->object->getId(); @@ -206,7 +206,7 @@ public function __wakeup() /** * @return array */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $blockedVars = ['object']; diff --git a/models/DataObject/Data/ObjectMetadata/Dao.php b/models/DataObject/Data/ObjectMetadata/Dao.php index 315d94d3c01..ddd7f0757fa 100644 --- a/models/DataObject/Data/ObjectMetadata/Dao.php +++ b/models/DataObject/Data/ObjectMetadata/Dao.php @@ -29,7 +29,7 @@ class Dao extends DataObject\Data\AbstractMetadata\Dao protected ?array $tableDefinitions = null; - public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index, string $type = 'object') + public function save(DataObject\Concrete $object, string $ownertype, string $ownername, string $position, int $index, string $type = 'object'): void { $table = $this->getTablename($object); @@ -79,7 +79,7 @@ public function load(DataObject\Concrete $source, int $destinationId, string $fi } } - public function createOrUpdateTable(DataObject\ClassDefinition $class) + public function createOrUpdateTable(DataObject\ClassDefinition $class): void { $classId = $class->getId(); $table = 'object_metadata_' . $classId; diff --git a/models/DataObject/Data/QuantityValue.php b/models/DataObject/Data/QuantityValue.php index 57fec5cb977..ad19e1cfa72 100644 --- a/models/DataObject/Data/QuantityValue.php +++ b/models/DataObject/Data/QuantityValue.php @@ -36,7 +36,7 @@ public function __construct(float|int|string|null $value = null, Unit|string $un parent::__construct($unit); } - public function setValue(float|int|string|null $value) + public function setValue(float|int|string|null $value): void { $this->value = $value; $this->markMeDirty(); diff --git a/models/DataObject/Data/RgbaColor.php b/models/DataObject/Data/RgbaColor.php index 65304e77763..3ac9812d3d7 100644 --- a/models/DataObject/Data/RgbaColor.php +++ b/models/DataObject/Data/RgbaColor.php @@ -136,7 +136,7 @@ public function getHex(bool $withAlpha = false, bool $withHash = true): string * * @throws \Exception */ - public function setHex(string $hexValue) + public function setHex(string $hexValue): void { $hexValue = ltrim($hexValue, '#'); $length = strlen($hexValue); @@ -163,7 +163,7 @@ public function setHex(string $hexValue) * @param int|null $b * @param int|null $a */ - public function setRgba(int $r = null, int $g = null, int $b = null, int $a = null) + public function setRgba(int $r = null, int $g = null, int $b = null, int $a = null): void { $this->setR($r); $this->setG($g); diff --git a/models/DataObject/Data/StructuredTable.php b/models/DataObject/Data/StructuredTable.php index fe9d97ec204..8fa6681ce4e 100644 --- a/models/DataObject/Data/StructuredTable.php +++ b/models/DataObject/Data/StructuredTable.php @@ -50,7 +50,7 @@ public function getData(): array * @param string $name * @param array $arguments * - * @return mixed + * @return mixed|void * * @throws \Exception */ diff --git a/models/DataObject/Data/UrlSlug.php b/models/DataObject/Data/UrlSlug.php index a6e2c8923a8..906202c3318 100644 --- a/models/DataObject/Data/UrlSlug.php +++ b/models/DataObject/Data/UrlSlug.php @@ -362,7 +362,7 @@ public function getAction(): string /** * @throws \Exception */ - public function delete() + public function delete(): void { $db = Db::get(); $db->delete(self::TABLE_NAME, ['slug' => $this->getSlug(), 'siteId' => $this->getSiteId()]); @@ -375,7 +375,7 @@ public function delete() * * @throws \Exception */ - public static function handleSiteDeleted(int $siteId) + public static function handleSiteDeleted(int $siteId): void { $db = Db::get(); $db->delete(self::TABLE_NAME, ['siteId' => $siteId]); @@ -386,7 +386,7 @@ public static function handleSiteDeleted(int $siteId) * * @throws \Exception */ - public static function handleClassDeleted(string $classId) + public static function handleClassDeleted(string $classId): void { $db = Db::get(); $db->delete(self::TABLE_NAME, ['classId' => $classId]); diff --git a/models/DataObject/Data/Video.php b/models/DataObject/Data/Video.php index 228bd6a1b29..b15c340cc14 100644 --- a/models/DataObject/Data/Video.php +++ b/models/DataObject/Data/Video.php @@ -37,7 +37,7 @@ class Video implements OwnerAwareFieldInterface protected string $description; - public function setData(Asset|int|string $data) + public function setData(Asset|int|string $data): void { $this->data = $data; $this->markMeDirty(); @@ -48,7 +48,7 @@ public function getData(): Asset|int|string return $this->data; } - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; $this->markMeDirty(); @@ -59,7 +59,7 @@ public function getType(): string return $this->type; } - public function setDescription(string $description) + public function setDescription(string $description): void { $this->description = $description; $this->markMeDirty(); @@ -70,7 +70,7 @@ public function getDescription(): string return $this->description; } - public function setPoster(Asset|int|string|null $poster) + public function setPoster(Asset|int|string|null $poster): void { $this->poster = $poster; $this->markMeDirty(); @@ -81,7 +81,7 @@ public function getPoster(): Asset|int|string|null return $this->poster; } - public function setTitle(string $title) + public function setTitle(string $title): void { $this->title = $title; $this->markMeDirty(); diff --git a/models/DataObject/Fieldcollection.php b/models/DataObject/Fieldcollection.php index c13d6d21f69..62fc3b45131 100644 --- a/models/DataObject/Fieldcollection.php +++ b/models/DataObject/Fieldcollection.php @@ -108,7 +108,7 @@ public function getItemDefinitions(): array * * @throws \Exception */ - public function save(Concrete $object, array $params = []) + public function save(Concrete $object, array $params = []): void { $saveRelationalData = $this->getDao()->save($object, $params); @@ -142,14 +142,14 @@ public function isEmpty(): bool return count($this->getItems()) < 1; } - public function add(mixed $item) + public function add(mixed $item): void { $this->items[] = $item; $this->markFieldDirty('_self', true); } - public function remove(int $index) + public function remove(int $index): void { if (isset($this->items[$index])) { array_splice($this->items, $index, 1); @@ -227,7 +227,7 @@ public function valid(): bool * * @internal */ - public function loadLazyField(Concrete $object, string $type, string $fcField, int $index, string $field) + public function loadLazyField(Concrete $object, string $type, string $fcField, int $index, string $field): void { // lazy loading existing can be data if the item already had an index $item = $this->getByOriginalIndex($index); @@ -285,7 +285,7 @@ public function setObject(?Concrete $object): static /** * @internal */ - public function loadLazyData() + public function loadLazyData(): void { $items = $this->getItems(); if (is_array($items)) { diff --git a/models/DataObject/Fieldcollection/Data/AbstractData.php b/models/DataObject/Fieldcollection/Data/AbstractData.php index 9c8b40f05ed..79ad1c343fc 100644 --- a/models/DataObject/Fieldcollection/Data/AbstractData.php +++ b/models/DataObject/Fieldcollection/Data/AbstractData.php @@ -147,7 +147,7 @@ public function isAllLazyKeysMarkedAsLoaded(): bool /** * @return array */ - public function __sleep() + public function __sleep(): array { $parentVars = parent::__sleep(); $blockedVars = ['loadedLazyKeys', 'object']; @@ -167,7 +167,7 @@ public function __sleep() return $finalVars; } - public function __wakeup() + public function __wakeup(): void { if ($this->object) { $this->objectId = $this->object->getId(); diff --git a/models/DataObject/Fieldcollection/Data/Dao.php b/models/DataObject/Fieldcollection/Data/Dao.php index b3bda3e57f2..8b30fde5fa4 100644 --- a/models/DataObject/Fieldcollection/Data/Dao.php +++ b/models/DataObject/Fieldcollection/Data/Dao.php @@ -34,7 +34,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws \Exception */ - public function save(Model\DataObject\Concrete $object, array $params = [], bool|array $saveRelationalData = true) + public function save(Model\DataObject\Concrete $object, array $params = [], bool|array $saveRelationalData = true): void { $tableName = $this->model->getDefinition()->getTableName($object->getClass()); $data = [ diff --git a/models/DataObject/Fieldcollection/Definition.php b/models/DataObject/Fieldcollection/Definition.php index dc6627dbb93..b7060590800 100644 --- a/models/DataObject/Fieldcollection/Definition.php +++ b/models/DataObject/Fieldcollection/Definition.php @@ -55,7 +55,7 @@ protected function doEnrichFieldDefinition(Data $fieldDefinition, array $context * * @param DataObject\ClassDefinition\Layout|DataObject\ClassDefinition\Data $def */ - protected function extractDataDefinitions(DataObject\ClassDefinition\Data|DataObject\ClassDefinition\Layout $def) + protected function extractDataDefinitions(DataObject\ClassDefinition\Data|DataObject\ClassDefinition\Layout $def): void { if ($def instanceof DataObject\ClassDefinition\Layout) { if ($def->hasChildren()) { @@ -119,7 +119,7 @@ public static function getByKey(string $key): ?Definition * * @throws \Exception */ - public function save(bool $saveDefinitionFile = true) + public function save(bool $saveDefinitionFile = true): void { if (!$this->getKey()) { throw new \Exception('A field-collection needs a key to be saved!'); @@ -173,7 +173,7 @@ public function save(bool $saveDefinitionFile = true) * * @internal */ - protected function generateClassFiles(bool $generateDefinitionFile = true) + protected function generateClassFiles(bool $generateDefinitionFile = true): void { if ($generateDefinitionFile && !$this->isWritable()) { throw new DataObject\Exception\DefinitionWriteException(); @@ -210,7 +210,7 @@ protected function generateClassFiles(bool $generateDefinitionFile = true) } } - public function delete() + public function delete(): void { @unlink($this->getDefinitionFile()); @unlink($this->getPhpClassFile()); diff --git a/models/DataObject/Fieldcollection/Definition/Dao.php b/models/DataObject/Fieldcollection/Definition/Dao.php index 4d4d7824c9a..1dad5f8205b 100644 --- a/models/DataObject/Fieldcollection/Definition/Dao.php +++ b/models/DataObject/Fieldcollection/Definition/Dao.php @@ -39,13 +39,13 @@ public function getLocalizedTableName(DataObject\ClassDefinition $class): string return 'object_collection_' . $this->model->getKey() . '_localized_' . $class->getId(); } - public function delete(DataObject\ClassDefinition $class) + public function delete(DataObject\ClassDefinition $class): void { $table = $this->getTableName($class); $this->db->executeQuery('DROP TABLE IF EXISTS `' . $table . '`'); } - public function createUpdateTable(DataObject\ClassDefinition $class) + public function createUpdateTable(DataObject\ClassDefinition $class): void { $table = $this->getTableName($class); @@ -101,7 +101,7 @@ public function createUpdateTable(DataObject\ClassDefinition $class) $this->tableDefinitions = []; } - public function classSaved(DataObject\ClassDefinition $classDefinition) + public function classSaved(DataObject\ClassDefinition $classDefinition): void { $this->handleEncryption($classDefinition, [$this->getTableName($classDefinition)]); } diff --git a/models/DataObject/Folder.php b/models/DataObject/Folder.php index c184cd72c43..0724af26adf 100644 --- a/models/DataObject/Folder.php +++ b/models/DataObject/Folder.php @@ -42,7 +42,7 @@ public static function create(array $values): Folder /** * {@inheritdoc} */ - protected function update(bool $isUpdate = null, array $params = []) + protected function update(bool $isUpdate = null, array $params = []): void { parent::update($isUpdate, $params); $this->getDao()->update($isUpdate); @@ -51,7 +51,7 @@ protected function update(bool $isUpdate = null, array $params = []) /** * {@inheritdoc} */ - public function delete() + public function delete(): void { if ($this->getId() == 1) { throw new \Exception('root-node cannot be deleted'); diff --git a/models/DataObject/LazyLoadedFieldsInterface.php b/models/DataObject/LazyLoadedFieldsInterface.php index db1b9b5c77f..4b4b3470262 100644 --- a/models/DataObject/LazyLoadedFieldsInterface.php +++ b/models/DataObject/LazyLoadedFieldsInterface.php @@ -20,7 +20,7 @@ interface LazyLoadedFieldsInterface { const LAZY_KEY_SEPARATOR = '~~'; - public function markLazyKeyAsLoaded(string $key); + public function markLazyKeyAsLoaded(string $key): void; public function isLazyKeyLoaded(string $key): bool; diff --git a/models/DataObject/Listing/Concrete.php b/models/DataObject/Listing/Concrete.php index cbd5d692670..f85b6011a8b 100644 --- a/models/DataObject/Listing/Concrete.php +++ b/models/DataObject/Listing/Concrete.php @@ -130,7 +130,7 @@ public function getIgnoreLocalizedFields(): bool * * @throws \Exception */ - public function addFieldCollection(string $type, string $fieldname = null) + public function addFieldCollection(string $type, string $fieldname = null): void { $this->setData(null); @@ -177,7 +177,7 @@ public function getFieldCollections(): array * * @throws \Exception */ - public function addObjectbrick(string $type) + public function addObjectbrick(string $type): void { $this->setData(null); diff --git a/models/DataObject/Localizedfield.php b/models/DataObject/Localizedfield.php index 7c28825b30c..22223d3c5ce 100644 --- a/models/DataObject/Localizedfield.php +++ b/models/DataObject/Localizedfield.php @@ -133,7 +133,7 @@ public function __construct(array $items = null) $this->markAllLanguagesAsDirty(); } - public function addItem(mixed $item) + public function addItem(mixed $item): void { $this->items[] = $item; $this->markFieldDirty('_self'); @@ -167,7 +167,7 @@ public function loadLazyData(): void * * @internal */ - public function setLoadedAllLazyData(bool $mark = true) + public function setLoadedAllLazyData(bool $mark = true): void { $this->_loadedAllLazyData = $mark; } diff --git a/models/DataObject/Localizedfield/Dao.php b/models/DataObject/Localizedfield/Dao.php index b22b5203ef9..5d5cd7c16ca 100644 --- a/models/DataObject/Localizedfield/Dao.php +++ b/models/DataObject/Localizedfield/Dao.php @@ -80,7 +80,7 @@ public function getQueryTableName(): string * * @throws \Exception */ - public function save(array $params = []) + public function save(array $params = []): void { $context = $this->model->getContext(); @@ -572,7 +572,7 @@ public function delete(bool $deleteQuery = true, bool $isUpdate = true): bool return false; } - public function load(DataObject\Fieldcollection\Data\AbstractData|DataObject\Objectbrick\Data\AbstractData|DataObject\Concrete $object, array $params = []) + public function load(DataObject\Fieldcollection\Data\AbstractData|DataObject\Objectbrick\Data\AbstractData|DataObject\Concrete $object, array $params = []): void { $validLanguages = Tool::getValidLanguages(); foreach ($validLanguages as &$language) { @@ -672,7 +672,7 @@ public function load(DataObject\Fieldcollection\Data\AbstractData|DataObject\Obj } } - public function createLocalizedViews() + public function createLocalizedViews(): void { // init $languages = Tool::getValidLanguages(); @@ -782,7 +782,7 @@ public function createLocalizedViews() * * @throws \Exception */ - public function createUpdateTable(array $params = []) + public function createUpdateTable(array $params = []): void { $table = $this->getTableName(); diff --git a/models/DataObject/Objectbrick.php b/models/DataObject/Objectbrick.php index 6768e3a58aa..a03b27fc778 100644 --- a/models/DataObject/Objectbrick.php +++ b/models/DataObject/Objectbrick.php @@ -265,7 +265,7 @@ public function __sleep(): array return $finalVars; } - public function __wakeup() + public function __wakeup(): void { // for backwards compatibility if ($this->object) { @@ -310,7 +310,7 @@ public function set(string $fieldName, mixed $value): mixed * * @internal */ - public function loadLazyField(string $brick, string $brickField, string $field) + public function loadLazyField(string $brick, string $brickField, string $field): void { $item = $this->get($brick); if ($item && !$item->isLazyKeyLoaded($field)) { @@ -338,7 +338,7 @@ public function loadLazyField(string $brick, string $brickField, string $field) /** * @internal */ - public function loadLazyData() + public function loadLazyData(): void { $allowedBrickTypes = $this->getAllowedBrickTypes(); if (is_array($allowedBrickTypes)) { diff --git a/models/DataObject/Objectbrick/Data/AbstractData.php b/models/DataObject/Objectbrick/Data/AbstractData.php index 6b80c558ff8..503c8e1029d 100644 --- a/models/DataObject/Objectbrick/Data/AbstractData.php +++ b/models/DataObject/Objectbrick/Data/AbstractData.php @@ -95,7 +95,7 @@ public function getBaseObject(): ?Concrete return $this->getObject(); } - public function delete(Concrete $object) + public function delete(Concrete $object): void { $this->doDelete = true; $this->getDao()->delete($object); @@ -106,7 +106,7 @@ public function delete(Concrete $object) * @internal * Flushes the already collected items of the container object */ - protected function flushContainer() + protected function flushContainer(): void { $object = $this->getObject(); if ($object) { @@ -229,7 +229,7 @@ public function isAllLazyKeysMarkedAsLoaded(): bool /** * @return array */ - public function __sleep() + public function __sleep(): array { $parentVars = parent::__sleep(); $blockedVars = ['loadedLazyKeys', 'object']; @@ -249,7 +249,7 @@ public function __sleep() return $finalVars; } - public function __wakeup() + public function __wakeup(): void { if ($this->object) { $this->objectId = $this->object->getId(); diff --git a/models/DataObject/Objectbrick/Data/Dao.php b/models/DataObject/Objectbrick/Data/Dao.php index 4496a4ecc7b..4ab3c868956 100644 --- a/models/DataObject/Objectbrick/Data/Dao.php +++ b/models/DataObject/Objectbrick/Data/Dao.php @@ -39,7 +39,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws \Exception */ - public function save(DataObject\Concrete $object, array $params = []) + public function save(DataObject\Concrete $object, array $params = []): void { // HACK: set the pimcore admin mode to false to get the inherited values from parent if this source one is empty $inheritedValues = DataObject::doGetInheritedValues(); @@ -286,7 +286,7 @@ public function save(DataObject\Concrete $object, array $params = []) DataObject::setGetInheritedValues($inheritedValues); } - public function delete(DataObject\Concrete $object) + public function delete(DataObject\Concrete $object): void { // update data for store table $storeTable = $this->model->getDefinition()->getTableName($object->getClass(), false); diff --git a/models/DataObject/Objectbrick/Definition.php b/models/DataObject/Objectbrick/Definition.php index 27474cea544..29d3f552bc4 100644 --- a/models/DataObject/Objectbrick/Definition.php +++ b/models/DataObject/Objectbrick/Definition.php @@ -140,7 +140,7 @@ private function checkTablenames(): void * * @throws \Exception */ - public function save(bool $saveDefinitionFile = true) + public function save(bool $saveDefinitionFile = true): void { if (!$this->getKey()) { throw new \Exception('A object-brick needs a key to be saved!'); @@ -229,7 +229,7 @@ private function checkContainerRestrictions(): void /** * {@inheritdoc} */ - protected function generateClassFiles(bool $generateDefinitionFile = true) + protected function generateClassFiles(bool $generateDefinitionFile = true): void { if ($generateDefinitionFile && !$this->isWritable()) { throw new DataObject\Exception\DefinitionWriteException(); @@ -482,7 +482,7 @@ public function getContainerClassFolder(string $classname): string /** * Delete Brick Definition */ - public function delete() + public function delete(): void { @unlink($this->getDefinitionFile()); @unlink($this->getPhpClassFile()); diff --git a/models/DataObject/Objectbrick/Definition/Dao.php b/models/DataObject/Objectbrick/Definition/Dao.php index 905bbafb35a..a68dfc5b6ad 100644 --- a/models/DataObject/Objectbrick/Definition/Dao.php +++ b/models/DataObject/Objectbrick/Definition/Dao.php @@ -48,7 +48,7 @@ public function getLocalizedTableName(DataObject\ClassDefinition $class, bool $q } } - public function delete(DataObject\ClassDefinition $class) + public function delete(DataObject\ClassDefinition $class): void { $table = $this->getTableName($class, false); $this->db->executeQuery('DROP TABLE IF EXISTS `' . $table . '`'); @@ -57,7 +57,7 @@ public function delete(DataObject\ClassDefinition $class) $this->db->executeQuery('DROP TABLE IF EXISTS `' . $table . '`'); } - public function createUpdateTable(DataObject\ClassDefinition $class) + public function createUpdateTable(DataObject\ClassDefinition $class): void { $tableStore = $this->getTableName($class, false); $tableQuery = $this->getTableName($class, true); @@ -145,7 +145,7 @@ public function createUpdateTable(DataObject\ClassDefinition $class) $this->removeUnusedColumns($tableQuery, $columnsToRemoveQuery, $protectedColumnsQuery); } - public function classSaved(DataObject\ClassDefinition $classDefinition) + public function classSaved(DataObject\ClassDefinition $classDefinition): void { $tableStore = $this->getTableName($classDefinition, false); $tableQuery = $this->getTableName($classDefinition, true); @@ -153,12 +153,7 @@ public function classSaved(DataObject\ClassDefinition $classDefinition) $this->handleEncryption($classDefinition, [$tableQuery, $tableStore]); } - /** - * @param string $table - * @param array $columnsToRemove - * @param array $protectedColumns - */ - protected function removeIndices($table, $columnsToRemove, $protectedColumns) + protected function removeIndices(string $table, array $columnsToRemove, array $protectedColumns): void { if (is_array($columnsToRemove) && count($columnsToRemove) > 0) { $indexPrefix = str_starts_with($table, 'object_brick_query_') ? 'p_index_' : 'u_index_'; diff --git a/models/DataObject/PreGetValueHookInterface.php b/models/DataObject/PreGetValueHookInterface.php index 98973a03466..cb2a4275b4d 100644 --- a/models/DataObject/PreGetValueHookInterface.php +++ b/models/DataObject/PreGetValueHookInterface.php @@ -18,8 +18,5 @@ interface PreGetValueHookInterface { - /** - * @return mixed - */ - public function preGetValue(string $key); + public function preGetValue(string $key): mixed; } diff --git a/models/DataObject/QuantityValue/Unit.php b/models/DataObject/QuantityValue/Unit.php index 60bc4aa4cfe..1066f3e5418 100644 --- a/models/DataObject/QuantityValue/Unit.php +++ b/models/DataObject/QuantityValue/Unit.php @@ -117,7 +117,7 @@ public static function create(array $values = []): Unit return $unit; } - public function save() + public function save(): void { $isUpdate = false; if ($this->getId()) { @@ -138,7 +138,7 @@ public function save() } } - public function delete() + public function delete(): void { $this->dispatchEvent(new QuantityValueUnitEvent($this), DataObjectQuantityValueEvents::UNIT_PRE_DELETE); $this->getDao()->delete(); diff --git a/models/DataObject/QuantityValue/Unit/Dao.php b/models/DataObject/QuantityValue/Unit/Dao.php index 95f2211d926..d65055ea929 100644 --- a/models/DataObject/QuantityValue/Unit/Dao.php +++ b/models/DataObject/QuantityValue/Unit/Dao.php @@ -38,7 +38,7 @@ class Dao extends Model\Dao\AbstractDao * Get the valid columns from the database * */ - public function init() + public function init(): void { $this->validColumns = $this->getValidTableColumns(self::TABLE_NAME); } @@ -48,7 +48,7 @@ public function init() * * @throws Model\Exception\NotFoundException */ - public function getByAbbreviation(string $abbreviation) + public function getByAbbreviation(string $abbreviation): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE abbreviation=' . $this->db->quote($abbreviation)); if (empty($classRaw)) { @@ -62,7 +62,7 @@ public function getByAbbreviation(string $abbreviation) * * @throws Model\Exception\NotFoundException */ - public function getByReference(string $reference) + public function getByReference(string $reference): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE reference=' . $this->db->quote($reference)); if (empty($classRaw)) { @@ -76,7 +76,7 @@ public function getByReference(string $reference) * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $classRaw = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME . ' WHERE id=' . $this->db->quote($id)); if (empty($classRaw)) { @@ -88,7 +88,7 @@ public function getById(int $id) /** * Create a new record for the object in database */ - public function create() + public function create(): void { $this->update(); } @@ -96,12 +96,12 @@ public function create() /** * Save object to database */ - public function save() + public function save(): void { $this->update(); } - public function update() + public function update(): void { if (!$this->model->getId()) { // mimic autoincrement @@ -130,7 +130,7 @@ public function update() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::TABLE_NAME, ['id' => $this->model->getId()]); } diff --git a/models/DataObject/Service.php b/models/DataObject/Service.php index a4e53adac14..382b6639110 100644 --- a/models/DataObject/Service.php +++ b/models/DataObject/Service.php @@ -761,7 +761,7 @@ public static function hasInheritableParentObject(Concrete $object): ?Concrete * * @param AbstractObject $object */ - public static function loadAllObjectFields(AbstractObject $object) + public static function loadAllObjectFields(AbstractObject $object): void { $object->getProperties(); @@ -1035,7 +1035,7 @@ public static function getSuperLayoutDefinition(Concrete $object): mixed return $superLayout; } - public static function createSuperLayout(ClassDefinition\Data|ClassDefinition\Layout $layout) + public static function createSuperLayout(ClassDefinition\Data|ClassDefinition\Layout $layout): void { if ($layout instanceof ClassDefinition\Data) { $layout->setInvisible(false); @@ -1096,7 +1096,7 @@ private static function synchronizeCustomLayoutFieldWithMaster(array $masterDefi /** Synchronizes a custom layout with its master layout * @param ClassDefinition\CustomLayout $customLayout */ - public static function synchronizeCustomLayout(ClassDefinition\CustomLayout $customLayout) + public static function synchronizeCustomLayout(ClassDefinition\CustomLayout $customLayout): void { $classId = $customLayout->getClassId(); $class = ClassDefinition::getById($classId); @@ -1374,7 +1374,7 @@ public static function getUniqueKey(ElementInterface $element, int $nr = 0): str * * @internal */ - public static function enrichLayoutDefinition(ClassDefinition\Data|ClassDefinition\Layout|null &$layout, Concrete $object = null, array $context = []) + public static function enrichLayoutDefinition(ClassDefinition\Data|ClassDefinition\Layout|null &$layout, Concrete $object = null, array $context = []): void { if (is_null($layout)) { return; @@ -1421,7 +1421,7 @@ public static function enrichLayoutDefinition(ClassDefinition\Data|ClassDefiniti * * @internal */ - public static function enrichLayoutPermissions(ClassDefinition\Data &$layout, array $allowedView, array $allowedEdit) + public static function enrichLayoutPermissions(ClassDefinition\Data &$layout, array $allowedView, array $allowedEdit): void { if ($layout instanceof Model\DataObject\ClassDefinition\Data\Localizedfields || $layout instanceof Model\DataObject\ClassDefinition\Data\Classificationstore && $layout->localized === true) { if (is_array($allowedView) && count($allowedView) > 0) { @@ -1624,7 +1624,7 @@ public static function getSystemFields(): array return self::$systemFields; } - public static function doResetDirtyMap(Model\AbstractModel $container, ClassDefinition|ClassDefinition\Data $fd) + public static function doResetDirtyMap(Model\AbstractModel $container, ClassDefinition|ClassDefinition\Data $fd): void { if (!method_exists($fd, 'getFieldDefinitions')) { return; @@ -1648,7 +1648,7 @@ public static function doResetDirtyMap(Model\AbstractModel $container, ClassDefi } } - public static function recursiveResetDirtyMap(AbstractObject $object) + public static function recursiveResetDirtyMap(AbstractObject $object): void { if ($object instanceof DirtyIndicatorInterface) { $object->resetDirtyMap(); diff --git a/models/DataObject/Traits/FieldcollectionObjectbrickDefinitionTrait.php b/models/DataObject/Traits/FieldcollectionObjectbrickDefinitionTrait.php index 88c20760001..3da642e3df4 100644 --- a/models/DataObject/Traits/FieldcollectionObjectbrickDefinitionTrait.php +++ b/models/DataObject/Traits/FieldcollectionObjectbrickDefinitionTrait.php @@ -122,7 +122,7 @@ public function setLayoutDefinitions(?Layout $layoutDefinitions): static * * @return Data[] */ - public function getFieldDefinitions(array $context = []) + public function getFieldDefinitions(array $context = []): array { if (!\Pimcore::inAdmin() || (isset($context['suppressEnrichment']) && $context['suppressEnrichment'])) { return $this->fieldDefinitions; diff --git a/models/DataObject/Traits/OwnerAwareFieldTrait.php b/models/DataObject/Traits/OwnerAwareFieldTrait.php index a8b89867cce..44cc8a0a365 100644 --- a/models/DataObject/Traits/OwnerAwareFieldTrait.php +++ b/models/DataObject/Traits/OwnerAwareFieldTrait.php @@ -90,7 +90,7 @@ public function _setOwnerLanguage(?string $language): static /** * @internal */ - protected function markMeDirty($dirty = true): void + protected function markMeDirty(bool $dirty = true): void { if ($this->_owner && $this->_owner instanceof DirtyIndicatorInterface) { $this->_owner->markFieldDirty($this->_fieldname, $dirty); diff --git a/models/Dependency.php b/models/Dependency.php index 7250809880f..1a0802e2fea 100644 --- a/models/Dependency.php +++ b/models/Dependency.php @@ -67,7 +67,7 @@ public static function getBySourceId(int $id, string $type): Dependency * @param int $id * @param string $type */ - public function addRequirement(int $id, string $type) + public function addRequirement(int $id, string $type): void { $this->requires[] = [ 'type' => $type, @@ -81,7 +81,7 @@ public function addRequirement(int $id, string $type) * * @param Element\ElementInterface $element */ - public function cleanAllForElement(Element\ElementInterface $element) + public function cleanAllForElement(Element\ElementInterface $element): void { $this->getDao()->cleanAllForElement($element); } @@ -90,7 +90,7 @@ public function cleanAllForElement(Element\ElementInterface $element) * Cleanup the dependencies for current source id. * Can be used for updating the dependencies. */ - public function clean() + public function clean(): void { $this->requires = []; $this->getDao()->clear(); diff --git a/models/Document.php b/models/Document.php index 536798ad8f3..7037717074c 100644 --- a/models/Document.php +++ b/models/Document.php @@ -483,7 +483,7 @@ private function correctPath(): void * * @internal */ - protected function update(array $params = []) + protected function update(array $params = []): void { $disallowedKeysInFirstLevel = ['install', 'admin', 'plugin']; if ($this->getParentId() == 1 && in_array($this->getKey(), $disallowedKeysInFirstLevel)) { @@ -536,13 +536,13 @@ protected function update(array $params = []) * * @internal */ - public function saveIndex(int $index) + public function saveIndex(int $index): void { $this->getDao()->saveIndex($index); $this->clearDependentCache(); } - public function clearDependentCache(array $additionalTags = []) + public function clearDependentCache(array $additionalTags = []): void { try { $tags = [$this->getCacheTag(), 'document_properties', 'output']; @@ -674,7 +674,7 @@ public function hasSiblings(bool $includingUnpublished = null): bool * * @throws \Exception */ - protected function doDelete() + protected function doDelete(): void { // remove children if ($this->hasChildren()) { @@ -701,7 +701,7 @@ protected function doDelete() $service->removeTranslation($this); } - public function delete() + public function delete(): void { $this->dispatchEvent(new DocumentEvent($this), DocumentEvents::PRE_DELETE); @@ -1008,7 +1008,7 @@ public function setParent(?ElementInterface $parent): static * * @param bool $hideUnpublished */ - public static function setHideUnpublished(bool $hideUnpublished) + public static function setHideUnpublished(bool $hideUnpublished): void { self::$hideUnpublished = $hideUnpublished; } diff --git a/models/Document/Dao.php b/models/Document/Dao.php index bd2ecbb8344..297073f73f3 100644 --- a/models/Document/Dao.php +++ b/models/Document/Dao.php @@ -37,7 +37,7 @@ class Dao extends Model\Element\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative("SELECT documents.*, tree_locks.locked FROM documents LEFT JOIN tree_locks ON documents.id = tree_locks.id AND tree_locks.type = 'document' @@ -46,7 +46,7 @@ public function getById(int $id) if (!empty($data['id'])) { $this->assignVariablesToModel($data); } else { - throw new Model\Exception\NotFoundException('document with id ' . $id . ' not found'); + throw new Model\Exception\NotFoundException('document with id ' . $id . ' not found'); } } @@ -57,7 +57,7 @@ public function getById(int $id) * * @throws Model\Exception\NotFoundException */ - public function getByPath(string $path) + public function getByPath(string $path): void { $params = $this->extractKeyAndPath($path); $data = $this->db->fetchAssociative('SELECT id FROM documents WHERE `path` = BINARY :path AND `key` = BINARY :key', $params); @@ -78,7 +78,7 @@ public function getByPath(string $path) } } - public function create() + public function create(): void { $this->db->insert('documents', Helper::quoteDataIdentifiers($this->db, [ 'key' => $this->model->getKey(), @@ -98,7 +98,7 @@ public function create() /** * @throws \Exception */ - public function update() + public function update(): void { $typeSpecificTable = null; $validColumnsTypeSpecific = []; @@ -162,7 +162,7 @@ public function update() * * @throws \Exception */ - public function delete() + public function delete(): void { $this->db->delete('documents', ['id' => $this->model->getId()]); } @@ -172,7 +172,7 @@ public function delete() * * @throws \Exception */ - public function updateWorkspaces() + public function updateWorkspaces(): void { $this->db->update('users_workspaces_document', [ 'cpath' => $this->model->getRealFullPath(), @@ -314,7 +314,7 @@ public function getProperties(bool $onlyInherited = false, bool $onlyDirect = fa /** * Deletes all object properties from the database. */ - public function deleteAllProperties() + public function deleteAllProperties(): void { $this->db->delete('properties', ['cid' => $this->model->getId(), 'ctype' => 'document']); } @@ -455,7 +455,7 @@ public function isLocked(): bool * * @throws \Exception */ - public function updateLocks() + public function updateLocks(): void { $this->db->delete('tree_locks', ['id' => $this->model->getId(), 'type' => 'document']); if ($this->model->getLocked()) { @@ -564,7 +564,7 @@ public function areAllowed(array $columns, User $user): array * * @param int $index */ - public function saveIndex(int $index) + public function saveIndex(int $index): void { $this->db->update('documents', [ 'index' => $index, diff --git a/models/Document/DocType/Dao.php b/models/Document/DocType/Dao.php index 01878ee223b..91df3254597 100644 --- a/models/Document/DocType/Dao.php +++ b/models/Document/DocType/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -65,7 +65,7 @@ public function getById(?string $id = null): void /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->model->setId((string)Uid::v4()); @@ -92,7 +92,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getId()); } diff --git a/models/Document/Editable.php b/models/Document/Editable.php index bd1cf98127b..afa660aea51 100644 --- a/models/Document/Editable.php +++ b/models/Document/Editable.php @@ -239,7 +239,7 @@ protected function getEditmodeElementClasses(): array /** * Sends data to the output stream */ - protected function outputEditmode(string $value) + protected function outputEditmode(string $value): void { if ($this->getEditmode()) { echo $value . "\n"; @@ -256,6 +256,9 @@ public function getName(): string return $this->name; } + /** + * @return $this + */ public function setName(string $name): static { $this->name = $name; @@ -263,6 +266,9 @@ public function setName(string $name): static return $this; } + /** + * @return $this + */ public function setDocumentId(int $id): static { $this->documentId = (int) $id; @@ -279,6 +285,9 @@ public function getDocumentId(): ?int return $this->documentId; } + /** + * @return $this + */ public function setDocument(Document\PageSnippet $document): static { $this->document = $document; @@ -301,6 +310,9 @@ public function getConfig(): array return $this->config; } + /** + * @return $this + */ public function setConfig(array $config): static { $this->config = $config; @@ -327,19 +339,14 @@ public function getRealName(): string return $this->realName; } - public function setRealName(string $realName) + public function setRealName(string $realName): void { $this->realName = $realName; } - final public function setParentBlockNames($parentNames) + final public function setParentBlockNames(array $parentNames): void { - if (is_array($parentNames)) { - // unfortunately we cannot make a type hint here, because of compatibility reasons - // old versions where 'parentBlockNames' was not excluded in __sleep() have still this property - // in the serialized data, and mostly with the value NULL, on restore this would lead to an error - $this->parentBlockNames = $parentNames; - } + $this->parentBlockNames = $parentNames; } final public function getParentBlockNames(): array @@ -352,7 +359,7 @@ final public function getParentBlockNames(): array * * @return array */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Document/Editable/Areablock.php b/models/Document/Editable/Areablock.php index cdbff7238f6..ddaae283c28 100644 --- a/models/Document/Editable/Areablock.php +++ b/models/Document/Editable/Areablock.php @@ -107,6 +107,8 @@ public function frontend() /** * @internal + * + * @return ($return is true ? string : void) */ public function renderIndex(int $index, bool $return = false) { @@ -295,7 +297,7 @@ public function setDataFromEditmode(mixed $data): static /** * {@inheritdoc} */ - public function blockConstruct() + public function blockConstruct(): void { // set the current block suffix for the child elements (0, 1, 3, ...) // this will be removed in blockDestruct @@ -305,7 +307,7 @@ public function blockConstruct() /** * {@inheritdoc} */ - public function blockDestruct() + public function blockDestruct(): void { $this->getBlockState()->popIndex(); } @@ -354,7 +356,7 @@ protected function getEditmodeElementAttributes(): array /** * @param bool $return */ - public function start($return = false): string|static + public function start(bool $return = false) { if (($this->config['manual'] ?? false) === true) { // in manual mode $this->render() is not called for the areablock, so we need to add @@ -376,17 +378,15 @@ public function start($return = false): string|static if ($return) { return $html; - } else { - $this->outputEditmode($html); } - return $this; + $this->outputEditmode($html); } /** * @param bool $return */ - public function end($return = false) + public function end(bool $return = false) { $this->current = 0; @@ -397,15 +397,15 @@ public function end($return = false) if ($return) { return $html; - } else { - $this->outputEditmode($html); } + + $this->outputEditmode($html); } /** * @param Document\Editable\Area\Info $info */ - public function blockStart($info = null): array + public function blockStart(Area\Info $info = null): array { $this->blockStarted = true; $attributes = [ @@ -474,7 +474,7 @@ public function blockStart($info = null): array * * @internal */ - protected function renderDialogBoxEditables(array $config, EditableRenderer $editableRenderer, string $dialogId, string &$html) + protected function renderDialogBoxEditables(array $config, EditableRenderer $editableRenderer, string $dialogId, string &$html): void { if (isset($config['items']) && is_array($config['items'])) { // layout component @@ -652,7 +652,7 @@ public function getIndices(): array /** * If object was serialized, set the counter back to 0 */ - public function __wakeup() + public function __wakeup(): void { $this->current = 0; reset($this->indices); diff --git a/models/Document/Editable/Block.php b/models/Document/Editable/Block.php index ead1507b655..0576c15de6c 100644 --- a/models/Document/Editable/Block.php +++ b/models/Document/Editable/Block.php @@ -219,7 +219,7 @@ protected function getEditmodeElementAttributes(): array /** * {@inheritdoc} */ - public function start(): static + public function start() { // set name suffix for the whole block element, this will be added to all child elements of the block $this->getBlockState()->pushBlock(BlockName::createFromEditable($this)); @@ -228,14 +228,12 @@ public function start(): static $attributeString = HtmlUtils::assembleAttributeString($attributes); $this->outputEditmode('
'); - - return $this; } /** * {@inheritdoc} */ - public function end() + public function end(bool $return = false) { $this->current = 0; @@ -251,7 +249,7 @@ public function end() /** * {@inheritdoc} */ - public function blockConstruct() + public function blockConstruct(): void { // set the current block suffix for the child elements (0, 1, 3, ...) // this will be removed in blockDestruct @@ -261,7 +259,7 @@ public function blockConstruct() /** * {@inheritdoc} */ - public function blockDestruct() + public function blockDestruct(): void { $blockState = $this->getBlockState(); if ($blockState->hasIndexes()) { @@ -274,7 +272,7 @@ public function blockDestruct() * @param bool $return * @param string $additionalClass */ - public function blockStart($showControls = true, $return = false, $additionalClass = '') + public function blockStart(bool $showControls = true, bool $return = false, string $additionalClass = '') { $attr = $this->getBlockAttributes(); @@ -304,6 +302,7 @@ public function blockStart($showControls = true, $return = false, $additionalCla /** * Custom position of button controls between blockStart -> blockEnd * + * @return ($return is true ? string : void) */ public function blockControls(bool $return = false) { @@ -332,7 +331,7 @@ public function blockControls(bool $return = false) /** * @param bool $return */ - public function blockEnd($return = false) + public function blockEnd(bool $return = false) { // close outer element $html = '
'; @@ -391,7 +390,7 @@ public function getIndices(): array /** * If object was serialized, set the counter back to 0 */ - public function __wakeup() + public function __wakeup(): void { $this->current = 0; } diff --git a/models/Document/Editable/Block/AbstractBlockItem.php b/models/Document/Editable/Block/AbstractBlockItem.php index e7ed4a7232d..2cde1ba3285 100644 --- a/models/Document/Editable/Block/AbstractBlockItem.php +++ b/models/Document/Editable/Block/AbstractBlockItem.php @@ -62,13 +62,7 @@ public function getEditable(string $name): ?Document\Editable return $editable; } - /** - * @param string $func - * @param array $args - * - * @return Document\Editable|null - */ - public function __call(string $func, array $args) + public function __call(string $func, array $args): ?Document\Editable { $element = $this->getEditable($args[0]); $class = 'Pimcore\\Model\\Document\\Editable\\' . str_replace('get', '', $func); diff --git a/models/Document/Editable/Block/Item.php b/models/Document/Editable/Block/Item.php index 51104112d51..629eafa60c3 100644 --- a/models/Document/Editable/Block/Item.php +++ b/models/Document/Editable/Block/Item.php @@ -25,13 +25,7 @@ protected function getItemType(): string return 'block'; } - /** - * @param string $func - * @param array $args - * - * @return Document\Editable|null - */ - public function __call(string $func, array $args) + public function __call(string $func, array $args): ?Document\Editable { $element = $this->getEditable($args[0]); $class = 'Pimcore\\Model\\Document\\Editable\\' . str_replace('get', '', $func); diff --git a/models/Document/Editable/BlockInterface.php b/models/Document/Editable/BlockInterface.php index d08c5d0066e..b7fd82e252d 100644 --- a/models/Document/Editable/BlockInterface.php +++ b/models/Document/Editable/BlockInterface.php @@ -23,31 +23,39 @@ public function getIterator(): \Generator; /** * Is executed at the beginning of the loop and setup some general settings + * + * @return void|string */ public function start(); /** * Is executed at the end of the loop and removes the settings set in start() + * + * @return void|string */ public function end(); /** * Called before the block is rendered */ - public function blockConstruct(); + public function blockConstruct(): void; /** * Called when the block was rendered */ - public function blockDestruct(); + public function blockDestruct(): void; /** * Is called evertime a new iteration starts (new entry of the block while looping) + * + * @return void|string|array */ public function blockStart(); /** * Is called evertime a new iteration ends (new entry of the block while looping) + * + * @return void|string */ public function blockEnd(); diff --git a/models/Document/Editable/Dao.php b/models/Document/Editable/Dao.php index f69d247b5f9..10eacdcb75d 100644 --- a/models/Document/Editable/Dao.php +++ b/models/Document/Editable/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends Model\Dao\AbstractDao { - public function save() + public function save(): void { $data = $this->model->getDataForResource(); @@ -43,7 +43,7 @@ public function save() Helper::insertOrUpdate($this->db, 'documents_editables', $element); } - public function delete() + public function delete(): void { $this->db->delete('documents_editables', [ 'documentId' => $this->model->getDocumentId(), diff --git a/models/Document/Editable/Image.php b/models/Document/Editable/Image.php index 6fbf75d3611..7a20aeda05e 100644 --- a/models/Document/Editable/Image.php +++ b/models/Document/Editable/Image.php @@ -377,7 +377,7 @@ public function setDataFromEditmode(mixed $data): static return $this; } - private function setData(array $data) + private function setData(array $data): void { $this->id = $data['id'] ?? null; $this->alt = (string)($data['alt'] ?? ''); @@ -396,7 +396,7 @@ public function getText(): string return $this->alt; } - public function setText(string $text) + public function setText(string $text): void { $this->alt = $text; } @@ -651,7 +651,7 @@ public function getCropWidth(): float return $this->cropWidth; } - public function setHotspots(array $hotspots) + public function setHotspots(array $hotspots): void { $this->hotspots = $hotspots; } @@ -661,7 +661,7 @@ public function getHotspots(): array return $this->hotspots; } - public function setMarker(array $marker) + public function setMarker(array $marker): void { $this->marker = $marker; } @@ -687,10 +687,7 @@ public function rewriteIds(array $idMapping): void } } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Document/Editable/Link.php b/models/Document/Editable/Link.php index e05dae702e6..9f6fe850ca6 100644 --- a/models/Document/Editable/Link.php +++ b/models/Document/Editable/Link.php @@ -68,7 +68,7 @@ public function getDataEditmode(): ?array /** * {@inheritdoc} */ - protected function getEditmodeElementClasses($options = []): array + protected function getEditmodeElementClasses(array $options = []): array { // we don't want the class attribute being applied to the editable container element (
, only to the tag inside // the default behavior of the parent method is to include the "class" attribute @@ -302,7 +302,7 @@ public function getText(): string return $this->data['text'] ?? ''; } - public function setText(string $text) + public function setText(string $text): void { $this->data['text'] = $text; } diff --git a/models/Document/Editable/Pdf.php b/models/Document/Editable/Pdf.php index 11763c49ed2..54ade6a51a1 100644 --- a/models/Document/Editable/Pdf.php +++ b/models/Document/Editable/Pdf.php @@ -210,7 +210,7 @@ public function getElement(): ?Asset return Asset::getById($data['id']); } - public function setId(?int $id) + public function setId(?int $id): void { $this->id = $id; } diff --git a/models/Document/Editable/Relation.php b/models/Document/Editable/Relation.php index 87db2ed2e80..dbcb083b2ee 100644 --- a/models/Document/Editable/Relation.php +++ b/models/Document/Editable/Relation.php @@ -257,7 +257,7 @@ public function checkValidity(): bool /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Document/Editable/Relations.php b/models/Document/Editable/Relations.php index 688368ede90..6528bb6b785 100644 --- a/models/Document/Editable/Relations.php +++ b/models/Document/Editable/Relations.php @@ -228,7 +228,7 @@ public function rewriteIds(array $idMapping): void /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Document/Editable/Renderlet.php b/models/Document/Editable/Renderlet.php index b7d62118601..27ab12c201f 100644 --- a/models/Document/Editable/Renderlet.php +++ b/models/Document/Editable/Renderlet.php @@ -284,7 +284,7 @@ public function checkValidity(): bool /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Document/Editable/Scheduledblock.php b/models/Document/Editable/Scheduledblock.php index 65624e8e5eb..c5de825f52f 100644 --- a/models/Document/Editable/Scheduledblock.php +++ b/models/Document/Editable/Scheduledblock.php @@ -162,7 +162,7 @@ public function loop(): bool /** * {@inheritdoc} */ - public function start(): static + public function start(): void { if ($this->getEditmode()) { // this is actually to add the block to the EditmodeEditableDefinitionCollector @@ -179,14 +179,12 @@ public function start(): static $this->outputEditmode('
'); $this->outputEditmode('
'); - - return $this; } /** * {@inheritdoc} */ - public function blockConstruct() + public function blockConstruct(): void { // set the current block suffix for the child elements (0, 1, 3, ...) // this will be removed in blockDestruct @@ -198,7 +196,7 @@ public function blockConstruct() /** * {@inheritdoc} */ - public function blockStart($showControls = true, $return = false, $additionalClass = '') + public function blockStart(bool $showControls = true, bool $return = false, string $additionalClass = '') { $attributes = [ 'data-name' => $this->getName(), @@ -263,7 +261,7 @@ public function setConfig(array $config): static /** * If object was serialized, set cached elements to null */ - public function __wakeup() + public function __wakeup(): void { parent::__wakeup(); $this->cachedCurrentElement = null; diff --git a/models/Document/Editable/Snippet.php b/models/Document/Editable/Snippet.php index c1388232fa4..9164540f059 100644 --- a/models/Document/Editable/Snippet.php +++ b/models/Document/Editable/Snippet.php @@ -59,7 +59,7 @@ public function getData(): mixed return $this->id; } - public function setId(int $id) + public function setId(int $id): void { $this->id = $id; } @@ -210,7 +210,7 @@ public function resolveDependencies(): array /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); @@ -245,7 +245,7 @@ public function rewriteIds(array $idMapping): void } } - public function setSnippet(Document\Snippet $snippet) + public function setSnippet(Document\Snippet $snippet): void { if ($snippet instanceof Document\Snippet) { $this->id = $snippet->getId(); diff --git a/models/Document/Editable/Video.php b/models/Document/Editable/Video.php index c0ad9361199..b0218ad7eea 100644 --- a/models/Document/Editable/Video.php +++ b/models/Document/Editable/Video.php @@ -222,7 +222,7 @@ public function getData(): mixed /** * @return mixed */ - protected function getDataEditmode() + protected function getDataEditmode(): mixed { $data = $this->getData(); diff --git a/models/Document/Email/Dao.php b/models/Document/Email/Dao.php index 9c8398fdafb..0856325588a 100644 --- a/models/Document/Email/Dao.php +++ b/models/Document/Email/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Document\PageSnippet\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -49,7 +49,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); @@ -61,7 +61,7 @@ public function create() /** * @throws \Exception */ - public function delete() + public function delete(): void { $this->deleteAllProperties(); diff --git a/models/Document/Folder/Dao.php b/models/Document/Folder/Dao.php index f3bf9688e1f..74f078e6f9b 100644 --- a/models/Document/Folder/Dao.php +++ b/models/Document/Folder/Dao.php @@ -27,7 +27,7 @@ class Dao extends Model\Document\Dao /** * Deletes the folder */ - public function delete() + public function delete(): void { parent::delete(); } diff --git a/models/Document/Hardlink.php b/models/Document/Hardlink.php index d1887adf6df..2eccbe08723 100644 --- a/models/Document/Hardlink.php +++ b/models/Document/Hardlink.php @@ -202,7 +202,7 @@ public function hasChildren(bool $includingUnpublished = false): bool /** * {@inheritdoc} */ - protected function doDelete() + protected function doDelete(): void { // check for redirects pointing to this document, and delete them too $redirects = new Redirect\Listing(); @@ -219,7 +219,7 @@ protected function doDelete() /** * {@inheritdoc} */ - protected function update(array $params = []) + protected function update(array $params = []): void { parent::update($params); $this->saveScheduledTasks(); diff --git a/models/Document/Hardlink/Dao.php b/models/Document/Hardlink/Dao.php index 624f8f5ff72..db215b1ca1f 100644 --- a/models/Document/Hardlink/Dao.php +++ b/models/Document/Hardlink/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Document\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -49,7 +49,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); diff --git a/models/Document/Hardlink/Wrapper.php b/models/Document/Hardlink/Wrapper.php index d74dadf4ce7..307988e1aad 100644 --- a/models/Document/Hardlink/Wrapper.php +++ b/models/Document/Hardlink/Wrapper.php @@ -45,7 +45,7 @@ public function save(array $parameters = []): static * * @throws \Exception */ - protected function update(array $params = []) + protected function update(array $params = []): void { throw $this->getHardlinkError(); } @@ -53,7 +53,7 @@ protected function update(array $params = []) /** * @throws \Exception */ - public function delete() + public function delete(): void { throw $this->getHardlinkError(); } @@ -189,7 +189,7 @@ public function getSourceDocument(): ?Document return $this->sourceDocument; } - public function setSourceDocument(Document $sourceDocument): void + public function setSourceDocument(Document $sourceDocument): static { $this->sourceDocument = $sourceDocument; diff --git a/models/Document/Hardlink/Wrapper/WrapperInterface.php b/models/Document/Hardlink/Wrapper/WrapperInterface.php index 50d844dc38b..b428d3378c7 100644 --- a/models/Document/Hardlink/Wrapper/WrapperInterface.php +++ b/models/Document/Hardlink/Wrapper/WrapperInterface.php @@ -21,11 +21,17 @@ interface WrapperInterface extends ElementInterface { - public function setHardLinkSource(Document\Hardlink $hardLinkSource); + /** + * @return $this + */ + public function setHardLinkSource(Document\Hardlink $hardLinkSource): static; public function getHardLinkSource(): Document\Hardlink; - public function setSourceDocument(Document $sourceDocument); + /** + * @return $this + */ + public function setSourceDocument(Document $sourceDocument): static; public function getSourceDocument(): ?Document; } diff --git a/models/Document/Link.php b/models/Document/Link.php index c2eff475cae..2cc919ae220 100644 --- a/models/Document/Link.php +++ b/models/Document/Link.php @@ -382,17 +382,14 @@ public function getHtml(): string /** * {@inheritdoc} */ - protected function update(array $params = []) + protected function update(array $params = []): void { parent::update($params); $this->saveScheduledTasks(); } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Document/Link/Dao.php b/models/Document/Link/Dao.php index d7790b5dbf1..10211edc07b 100644 --- a/models/Document/Link/Dao.php +++ b/models/Document/Link/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Document\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -50,7 +50,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); diff --git a/models/Document/Newsletter.php b/models/Document/Newsletter.php index 3fe577be7e2..a506ec07fbf 100644 --- a/models/Document/Newsletter.php +++ b/models/Document/Newsletter.php @@ -158,7 +158,7 @@ public function getEnableTrackingParameters(): bool return $this->enableTrackingParameters; } - public function setEnableTrackingParameters(bool $enableTrackingParameters) + public function setEnableTrackingParameters(bool $enableTrackingParameters): void { $this->enableTrackingParameters = $enableTrackingParameters; } @@ -168,7 +168,7 @@ public function getTrackingParameterSource(): string return $this->trackingParameterSource; } - public function setTrackingParameterSource(string $trackingParameterSource) + public function setTrackingParameterSource(string $trackingParameterSource): void { $this->trackingParameterSource = $trackingParameterSource; } @@ -178,7 +178,7 @@ public function getTrackingParameterMedium(): string return $this->trackingParameterMedium; } - public function setTrackingParameterMedium(string $trackingParameterMedium) + public function setTrackingParameterMedium(string $trackingParameterMedium): void { $this->trackingParameterMedium = $trackingParameterMedium; } @@ -197,7 +197,7 @@ public function getTrackingParameterName(): ?string return $this->trackingParameterName; } - public function setTrackingParameterName(string $trackingParameterName) + public function setTrackingParameterName(string $trackingParameterName): void { $this->trackingParameterName = $trackingParameterName; } @@ -207,7 +207,7 @@ public function getSendingMode(): string return $this->sendingMode; } - public function setSendingMode(string $sendingMode) + public function setSendingMode(string $sendingMode): void { $this->sendingMode = $sendingMode; } diff --git a/models/Document/Newsletter/Dao.php b/models/Document/Newsletter/Dao.php index 16258f38782..998a9de82c6 100644 --- a/models/Document/Newsletter/Dao.php +++ b/models/Document/Newsletter/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Document\PageSnippet\Dao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -49,7 +49,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); @@ -63,7 +63,7 @@ public function create() * * @throws \Exception */ - public function delete() + public function delete(): void { $this->deleteAllProperties(); diff --git a/models/Document/Page.php b/models/Document/Page.php index da6e52b6d2c..4d6fac35fe7 100644 --- a/models/Document/Page.php +++ b/models/Document/Page.php @@ -74,7 +74,7 @@ class Page extends TargetingDocument /** * {@inheritdoc} */ - protected function doDelete() + protected function doDelete(): void { // check for redirects pointing to this document, and delete them too $redirects = new Redirect\Listing(); @@ -164,7 +164,7 @@ public function getPrettyUrl(): ?string * * @param array|string $targetGroupIds */ - public function setTargetGroupIds(array|string $targetGroupIds) + public function setTargetGroupIds(array|string $targetGroupIds): void { if (is_array($targetGroupIds)) { $targetGroupIds = implode(',', $targetGroupIds); @@ -194,7 +194,7 @@ public function getTargetGroupIds(): string * * @param TargetGroup[]|int[] $targetGroups */ - public function setTargetGroups(array $targetGroups) + public function setTargetGroups(array $targetGroups): void { $ids = array_map(function ($targetGroup) { if (is_numeric($targetGroup)) { diff --git a/models/Document/Page/Dao.php b/models/Document/Page/Dao.php index 299756f531a..baa55882063 100644 --- a/models/Document/Page/Dao.php +++ b/models/Document/Page/Dao.php @@ -34,7 +34,7 @@ class Dao extends Model\Document\PageSnippet\Dao implements TargetingDocumentDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -58,7 +58,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); @@ -70,7 +70,7 @@ public function create() /** * @throws \Exception */ - public function delete() + public function delete(): void { $this->deleteAllProperties(); diff --git a/models/Document/PageSnippet.php b/models/Document/PageSnippet.php index 9d4b9af738d..bd5e0e4ca77 100644 --- a/models/Document/PageSnippet.php +++ b/models/Document/PageSnippet.php @@ -123,7 +123,7 @@ public function save(array $parameters = []): static /** * {@inheritdoc} */ - protected function update(array $params = []) + protected function update(array $params = []): void { // update elements $editables = $this->getEditables(); @@ -215,7 +215,7 @@ public function saveVersion(bool $setModificationDate = true, bool $saveOnlyVers /** * {@inheritdoc} */ - protected function doDelete() + protected function doDelete(): void { // Dispatch Symfony Message Bus to delete versions \Pimcore::getContainer()->get('messenger.bus.pimcore-core')->dispatch( @@ -505,7 +505,7 @@ public function getHref(): string /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); @@ -601,7 +601,7 @@ public function supportsContentMaster(): bool * * @internal */ - protected function checkMissingRequiredEditable() + protected function checkMissingRequiredEditable(): void { // load data which must be requested $this->getProperties(); diff --git a/models/Document/PageSnippet/Dao.php b/models/Document/PageSnippet/Dao.php index 1957c964bba..7daffea1139 100644 --- a/models/Document/PageSnippet/Dao.php +++ b/models/Document/PageSnippet/Dao.php @@ -30,7 +30,7 @@ abstract class Dao extends Model\Document\Dao /** * Delete all editables containing the content from the database */ - public function deleteAllEditables() + public function deleteAllEditables(): void { $this->db->delete('documents_editables', ['documentId' => $this->model->getId()]); } diff --git a/models/Document/PrintAbstract.php b/models/Document/PrintAbstract.php index 4b6bdcb6177..fb6e63bb5b0 100644 --- a/models/Document/PrintAbstract.php +++ b/models/Document/PrintAbstract.php @@ -46,7 +46,7 @@ abstract class PrintAbstract extends Document\PageSnippet */ protected ?string $controller = 'web2print'; - public function setLastGeneratedDate(\DateTime $lastGenerated) + public function setLastGeneratedDate(\DateTime $lastGenerated): void { $this->lastGenerated = $lastGenerated->getTimestamp(); } @@ -68,7 +68,7 @@ public function getInProgress(): ?TmpStore return TmpStore::get($this->getLockKey()); } - public function setLastGenerated(int $lastGenerated) + public function setLastGenerated(int $lastGenerated): void { $this->lastGenerated = $lastGenerated; } @@ -78,7 +78,7 @@ public function getLastGenerated(): ?int return $this->lastGenerated; } - public function setLastGenerateMessage(string $lastGenerateMessage) + public function setLastGenerateMessage(string $lastGenerateMessage): void { $this->lastGenerateMessage = $lastGenerateMessage; } diff --git a/models/Document/PrintAbstract/Dao.php b/models/Document/PrintAbstract/Dao.php index bf8583b1dce..27789037699 100644 --- a/models/Document/PrintAbstract/Dao.php +++ b/models/Document/PrintAbstract/Dao.php @@ -36,7 +36,7 @@ class Dao extends Document\PageSnippet\Dao /** * Get the valid columns from the database */ - public function init() + public function init(): void { // page $this->validColumnsPage = $this->getValidTableColumns('documents_printpage'); @@ -49,7 +49,7 @@ public function init() * * @throws \Exception */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -67,7 +67,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); @@ -79,7 +79,7 @@ public function create() /** * @throws \Exception */ - public function update() + public function update(): void { $this->model->setModificationDate(time()); $document = $this->model->getObjectVars(); @@ -120,7 +120,7 @@ public function update() /** * @throws \Exception */ - public function delete() + public function delete(): void { $this->deleteAllProperties(); diff --git a/models/Document/Service/Dao.php b/models/Document/Service/Dao.php index 5d38a01a8ad..65d3d0ea961 100644 --- a/models/Document/Service/Dao.php +++ b/models/Document/Service/Dao.php @@ -93,7 +93,7 @@ public function getTranslations(Document $document, string $task = 'open'): arra * @param Document $translation * @param string|null $language */ - public function addTranslation(Document $document, Document $translation, string $language = null) + public function addTranslation(Document $document, Document $translation, string $language = null): void { $sourceId = $this->getTranslationSourceId($document); @@ -108,7 +108,7 @@ public function addTranslation(Document $document, Document $translation, string ]); } - public function removeTranslation(Document $document) + public function removeTranslation(Document $document): void { // if $document is a source-document, we need to move them over to a new document $newSourceId = $this->db->fetchOne('SELECT id FROM documents_translations WHERE sourceId = ?', [$document->getId()]); @@ -118,7 +118,7 @@ public function removeTranslation(Document $document) } } - public function removeTranslationLink(Document $document, Document $targetDocument) + public function removeTranslationLink(Document $document, Document $targetDocument): void { $sourceId = $this->getTranslationSourceId($document); diff --git a/models/Document/Snippet/Dao.php b/models/Document/Snippet/Dao.php index f800d033ad0..da047a38859 100644 --- a/models/Document/Snippet/Dao.php +++ b/models/Document/Snippet/Dao.php @@ -34,7 +34,7 @@ class Dao extends Model\Document\PageSnippet\Dao implements TargetingDocumentDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -52,7 +52,7 @@ public function getById(int $id = null) } } - public function create() + public function create(): void { parent::create(); diff --git a/models/Document/Targeting/TargetingDocumentInterface.php b/models/Document/Targeting/TargetingDocumentInterface.php index 1c6be96b33c..781b8f84819 100644 --- a/models/Document/Targeting/TargetingDocumentInterface.php +++ b/models/Document/Targeting/TargetingDocumentInterface.php @@ -51,7 +51,7 @@ public function getTargetGroupEditableName(string $name): string; * * @param int|null $useTargetGroup */ - public function setUseTargetGroup(int $useTargetGroup = null); + public function setUseTargetGroup(int $useTargetGroup = null): void; /** * Returns the target group to use diff --git a/models/Document/TargetingDocument.php b/models/Document/TargetingDocument.php index 6287d295203..302a7bb9876 100644 --- a/models/Document/TargetingDocument.php +++ b/models/Document/TargetingDocument.php @@ -29,7 +29,7 @@ abstract class TargetingDocument extends PageSnippet implements TargetingDocumen /** * {@inheritdoc} */ - public function setUseTargetGroup(int $useTargetGroup = null) + public function setUseTargetGroup(int $useTargetGroup = null): void { $this->useTargetGroup = $useTargetGroup; } @@ -150,7 +150,7 @@ public function getEditable(string $name): ?Editable /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { $finalVars = []; $parentVars = parent::__sleep(); diff --git a/models/Element/AbstractElement.php b/models/Element/AbstractElement.php index 307faa3928c..3c7ade5b4f1 100644 --- a/models/Element/AbstractElement.php +++ b/models/Element/AbstractElement.php @@ -296,7 +296,7 @@ public function setProperty(string $name, string $type, mixed $data, bool $inher /** * @internal */ - protected function updateModificationInfos() + protected function updateModificationInfos(): void { if (Model\Version::isEnabled() === true) { $this->setVersionCount($this->getDao()->getVersionCountForUpdate() + 1); @@ -356,7 +356,7 @@ public function hasProperty(string $name): bool return array_key_exists($name, $properties); } - public function removeProperty(string $name) + public function removeProperty(string $name): void { $properties = $this->getProperties(); unset($properties[$name]); @@ -526,7 +526,7 @@ public function isAllowed(string $type, ?User $user = null): bool /** * @internal */ - public function unlockPropagate() + public function unlockPropagate(): void { $type = Service::getElementType($this); @@ -546,7 +546,7 @@ public function unlockPropagate() * * @throws \Exception */ - protected function validatePathLength() + protected function validatePathLength(): void { if (mb_strlen($this->getRealFullPath()) > 765) { throw new \Exception("Full path is limited to 765 characters, reduce the length of your parent's path"); @@ -566,7 +566,7 @@ public function __getDataVersionTimestamp(): ?int return $this->__dataVersionTimestamp; } - public function __setDataVersionTimestamp(int $_dataVersionTimestamp) + public function __setDataVersionTimestamp(int $_dataVersionTimestamp): void { $this->__dataVersionTimestamp = $_dataVersionTimestamp; } @@ -667,7 +667,7 @@ protected function getBlockedVars(): array /** * {@inheritdoc} */ - public function __sleep() + public function __sleep(): array { if ($this->isInDumpState()) { // this is if we want to make a full dump of the object (eg. for a new version), including children for recyclebin @@ -677,7 +677,7 @@ public function __sleep() return array_diff(parent::__sleep(), $this->getBlockedVars()); } - public function __wakeup() + public function __wakeup(): void { if ($this->isInDumpState()) { // set current key and path this is necessary because the serialized data can have a different path than the original element ( element was renamed or moved ) @@ -708,7 +708,7 @@ public function __clone() * * @internal */ - public function deleteAutoSaveVersions(int $userId = null) + public function deleteAutoSaveVersions(int $userId = null): void { $list = new Model\Version\Listing(); $list->setLoadAutoSave(true); @@ -726,7 +726,7 @@ public function deleteAutoSaveVersions(int $userId = null) /** * @internal */ - protected function removeInheritedProperties() + protected function removeInheritedProperties(): void { $myProperties = $this->getProperties(); @@ -744,7 +744,7 @@ protected function removeInheritedProperties() /** * @internal */ - protected function renewInheritedProperties() + protected function renewInheritedProperties(): void { $this->removeInheritedProperties(); diff --git a/models/Element/Data/MarkerHotspotItem.php b/models/Element/Data/MarkerHotspotItem.php index 0ea7ae4d37f..1e227363524 100644 --- a/models/Element/Data/MarkerHotspotItem.php +++ b/models/Element/Data/MarkerHotspotItem.php @@ -44,7 +44,7 @@ public function getName(): string return $this->name; } - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -54,7 +54,7 @@ public function getType(): string return $this->type; } - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } @@ -64,7 +64,7 @@ public function getValue(): mixed return $this->value; } - public function setValue(mixed $value) + public function setValue(mixed $value): void { $this->value = $value; } diff --git a/models/Element/DeepCopy/PimcoreClassDefinitionReplaceFilter.php b/models/Element/DeepCopy/PimcoreClassDefinitionReplaceFilter.php index f48e59f929d..6979d94ef5c 100644 --- a/models/Element/DeepCopy/PimcoreClassDefinitionReplaceFilter.php +++ b/models/Element/DeepCopy/PimcoreClassDefinitionReplaceFilter.php @@ -38,7 +38,7 @@ public function __construct(callable $callable) $this->callback = $callable; } - public function apply($object, $property, $objectCopier) + public function apply($object, $property, $objectCopier): void { if (!$object instanceof Concrete) { return; diff --git a/models/Element/DirtyIndicatorInterface.php b/models/Element/DirtyIndicatorInterface.php index 24fba4d3a68..c7cdd25aab6 100644 --- a/models/Element/DirtyIndicatorInterface.php +++ b/models/Element/DirtyIndicatorInterface.php @@ -24,11 +24,8 @@ public function isFieldDirty(string $key): bool; /** * marks the given field as dirty - * - * @param string $field - * @param bool $dirty */ - public function markFieldDirty(string $field, bool $dirty = true); + public function markFieldDirty(string $field, bool $dirty = true): void; - public function resetDirtyMap(); + public function resetDirtyMap(): void; } diff --git a/models/Element/Editlock/Dao.php b/models/Element/Editlock/Dao.php index f086e6ff4b2..db4404ffa22 100644 --- a/models/Element/Editlock/Dao.php +++ b/models/Element/Editlock/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getByElement(int $cid, string $ctype) + public function getByElement(int $cid, string $ctype): void { $data = $this->db->fetchAssociative('SELECT * FROM edit_lock WHERE cid = ? AND ctype = ?', [$cid, $ctype]); @@ -79,12 +79,12 @@ public function save(): bool /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('edit_lock', ['id' => $this->model->getId()]); } - public function clearSession(string $sessionId) + public function clearSession(string $sessionId): void { $this->db->delete('edit_lock', ['sessionId' => $sessionId]); } diff --git a/models/Element/ElementDumpStateInterface.php b/models/Element/ElementDumpStateInterface.php index 5aca56c2524..48bcd738fe1 100644 --- a/models/Element/ElementDumpStateInterface.php +++ b/models/Element/ElementDumpStateInterface.php @@ -25,7 +25,7 @@ interface ElementDumpStateInterface * * @param bool $dumpState */ - public function setInDumpState(bool $dumpState); + public function setInDumpState(bool $dumpState): void; public function isInDumpState(): bool; } diff --git a/models/Element/ElementInterface.php b/models/Element/ElementInterface.php index 357c47fc34d..4649ac43089 100644 --- a/models/Element/ElementInterface.php +++ b/models/Element/ElementInterface.php @@ -153,9 +153,9 @@ public function getVersionCount(): int; */ public function save(array $parameters = []): static; - public function delete(); + public function delete(): void; - public function clearDependentCache(array $additionalTags = []); + public function clearDependentCache(array $additionalTags = []): void; public function setId(?int $id): static; diff --git a/models/Element/Note.php b/models/Element/Note.php index b273826de08..cd27431258f 100644 --- a/models/Element/Note.php +++ b/models/Element/Note.php @@ -126,7 +126,7 @@ public function setElement(ElementInterface $element): static /** * @throws \Exception */ - public function save() + public function save(): void { // check if there's a valid user if (!$this->getUser()) { diff --git a/models/Element/Note/Dao.php b/models/Element/Note/Dao.php index 7307da1d160..60fea11c27b 100644 --- a/models/Element/Note/Dao.php +++ b/models/Element/Note/Dao.php @@ -33,7 +33,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM notes WHERE id = ?', [$id]); @@ -148,7 +148,7 @@ public function save(): bool /** Deletes note from database. * @throws \Exception */ - public function delete() + public function delete(): void { $this->db->delete('notes', ['id' => $this->model->getId()]); $this->deleteData(); @@ -157,7 +157,7 @@ public function delete() /** Deletes note data from database. * @throws \Exception */ - protected function deleteData() + protected function deleteData(): void { $this->db->delete('notes_data', ['id' => $this->model->getId()]); } diff --git a/models/Element/PermissionChecker.php b/models/Element/PermissionChecker.php index 8b234ceac6b..e60994ec280 100644 --- a/models/Element/PermissionChecker.php +++ b/models/Element/PermissionChecker.php @@ -29,7 +29,10 @@ */ class PermissionChecker { - public static function check(ElementInterface $element, $users): array + /** + * @param User[] $users + */ + public static function check(ElementInterface $element, array $users): array { $protectedColumns = ['cid', 'cpath', 'userId', 'lEdit', 'lView', 'layouts']; @@ -66,7 +69,6 @@ public static function check(ElementInterface $element, $users): array $permissions = []; $details = []; - /** @var User $user */ foreach ($users as $user) { if (!$user instanceof User) { continue; @@ -148,7 +150,7 @@ public static function check(ElementInterface $element, $users): array return $result; } - protected static function collectParentIds($element): array + protected static function collectParentIds(ElementInterface $element): array { // collect properties via parent - ids $parentIds = [1]; @@ -165,7 +167,7 @@ protected static function collectParentIds($element): array return $parentIds; } - protected static function createDetail($user, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null): array + protected static function createDetail(User $user, ?string $a = null, ?bool $b = null, ?string $c = null, ?string $d = null, ?string $e = null, ?string $f = null): array { $detailEntry = [ 'userId' => $user->getId(), @@ -175,13 +177,12 @@ protected static function createDetail($user, $a = null, $b = null, $c = null, $ 'd' => $d, 'e' => $e, 'f' => $f, - ]; return $detailEntry; } - protected static function getUserPermissions($user, &$details): void + protected static function getUserPermissions(User $user, array &$details): void { if ($user->isAdmin()) { $details[] = self::createDetail($user, 'ADMIN', true, null, null); diff --git a/models/Element/Recyclebin.php b/models/Element/Recyclebin.php index aceb778a2c4..5160e6ba607 100644 --- a/models/Element/Recyclebin.php +++ b/models/Element/Recyclebin.php @@ -26,7 +26,7 @@ */ final class Recyclebin extends Model\AbstractModel { - public function flush() + public function flush(): void { $this->getDao()->flush(); Storage::get('recycle_bin')->deleteDirectory('/'); diff --git a/models/Element/Recyclebin/Dao.php b/models/Element/Recyclebin/Dao.php index c1dfd80ca3f..3010a4a5aca 100644 --- a/models/Element/Recyclebin/Dao.php +++ b/models/Element/Recyclebin/Dao.php @@ -24,7 +24,7 @@ */ class Dao extends Model\Dao\AbstractDao { - public function flush() + public function flush(): void { $this->db->executeStatement('DELETE FROM recyclebin'); } diff --git a/models/Element/Recyclebin/Item.php b/models/Element/Recyclebin/Item.php index ec744fb0875..89621149f8d 100644 --- a/models/Element/Recyclebin/Item.php +++ b/models/Element/Recyclebin/Item.php @@ -62,7 +62,7 @@ class Item extends Model\AbstractModel * @param Element\ElementInterface $element * @param Model\User|null $user */ - public static function create(Element\ElementInterface $element, Model\User $user = null) + public static function create(Element\ElementInterface $element, Model\User $user = null): void { $item = new self(); $item->setElement($element); @@ -93,7 +93,7 @@ public static function getById(int $id): ?Item * * @throws \Exception */ - public function restore(Model\User $user = null) + public function restore(Model\User $user = null): void { $dummy = null; $raw = Storage::get('recycle_bin')->read($this->getStoreageFile()); @@ -161,7 +161,7 @@ public function restore(Model\User $user = null) /** * @param Model\User|null $user */ - public function save(Model\User $user = null) + public function save(Model\User $user = null): void { $this->setType(Element\Service::getElementType($this->getElement())); $this->setSubtype($this->getElement()->getType()); @@ -204,7 +204,7 @@ public function save(Model\User $user = null) $saveBinaryData($this->getElement(), $saveBinaryData, $this); } - public function delete() + public function delete(): void { $storage = Storage::get('recycle_bin'); $storage->delete($this->getStoreageFile()); @@ -221,7 +221,7 @@ public function delete() $this->getDao()->delete(); } - public function loadChildren(Element\ElementInterface $element) + public function loadChildren(Element\ElementInterface $element): void { $this->amount++; @@ -260,7 +260,7 @@ public function loadChildren(Element\ElementInterface $element) * * @throws \Exception */ - protected function doRecursiveRestore(Element\ElementInterface $element) + protected function doRecursiveRestore(Element\ElementInterface $element): void { $storage = Storage::get('recycle_bin'); $restoreBinaryData = function (Element\ElementInterface $element, self $scope) use ($storage) { diff --git a/models/Element/Recyclebin/Item/Dao.php b/models/Element/Recyclebin/Item/Dao.php index 552dfcefb11..2516af68a00 100644 --- a/models/Element/Recyclebin/Item/Dao.php +++ b/models/Element/Recyclebin/Item/Dao.php @@ -30,7 +30,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws \Exception */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM recyclebin WHERE id = ?', [$id]); @@ -72,7 +72,7 @@ public function save(): bool /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('recyclebin', ['id' => $this->model->getId()]); } diff --git a/models/Element/Service.php b/models/Element/Service.php index 7747ff22981..7143bd2429a 100644 --- a/models/Element/Service.php +++ b/models/Element/Service.php @@ -244,11 +244,7 @@ private static function getDependedElement(array $config): Asset|Document|Abstra }; } - /** - * @param ElementInterface|null $element - * - */ - public static function doHideUnpublished($element): bool + public static function doHideUnpublished(?ElementInterface $element): bool { return ($element instanceof AbstractObject && DataObject::doHideUnpublished()) || ($element instanceof Document && Document::doHideUnpublished()); @@ -597,7 +593,7 @@ public static function minimizePropertiesForEditmode(array $props): array * * @internal */ - protected function updateChildren(DataObject|Document|Asset\Folder $target, ElementInterface $new) + protected function updateChildren(DataObject|Document|Asset\Folder $target, ElementInterface $new): void { //check in case of recursion $found = false; @@ -945,7 +941,7 @@ public static function createFolderByPath(string $path, array $options = []): As * @internal * */ - public static function addTreeFilterJoins(array $cv, Asset\Listing|DataObject\Listing|Document\Listing $childrenList) + public static function addTreeFilterJoins(array $cv, Asset\Listing|DataObject\Listing|Document\Listing $childrenList): void { if ($cv) { $childrenList->onCreateQueryBuilder(static function (DoctrineQueryBuilder $select) use ($cv) { @@ -1379,7 +1375,7 @@ function (Concrete $object, Data $fieldDefinition, $property, $currentValue) { * * @internal */ - public static function saveElementToSession(ElementInterface $element, string $postfix = '', bool $clone = true) + public static function saveElementToSession(ElementInterface $element, string $postfix = '', bool $clone = true): void { if ($clone) { $context = [ @@ -1424,7 +1420,7 @@ function (Concrete $object, Data $fieldDefinition, $property, $currentValue) { * * @internal */ - public static function removeElementFromSession(string $type, int $elementId, string $postfix = '') + public static function removeElementFromSession(string $type, int $elementId, string $postfix = ''): void { $tmpStoreKey = self::getSessionKey($type, $elementId, $postfix); TmpStore::delete($tmpStoreKey); diff --git a/models/Element/Tag.php b/models/Element/Tag.php index 74cbdcd5b20..825153be756 100644 --- a/models/Element/Tag.php +++ b/models/Element/Tag.php @@ -107,7 +107,7 @@ public static function getTagsForElement(string $cType, int $cId): array * @param int $cId * @param Tag $tag */ - public static function addTagToElement(string $cType, int $cId, Tag $tag) + public static function addTagToElement(string $cType, int $cId, Tag $tag): void { $event = new TagEvent($tag, [ 'elementType' => $cType, @@ -127,7 +127,7 @@ public static function addTagToElement(string $cType, int $cId, Tag $tag) * @param int $cId * @param Tag $tag */ - public static function removeTagFromElement(string $cType, int $cId, Tag $tag) + public static function removeTagFromElement(string $cType, int $cId, Tag $tag): void { $event = new TagEvent($tag, [ 'elementType' => $cType, @@ -148,13 +148,13 @@ public static function removeTagFromElement(string $cType, int $cId, Tag $tag) * @param int $cId * @param Tag[] $tags */ - public static function setTagsForElement(string $cType, int $cId, array $tags) + public static function setTagsForElement(string $cType, int $cId, array $tags): void { $tag = new Tag(); $tag->getDao()->setTagsForElement($cType, $cId, $tags); } - public static function batchAssignTagsToElement(string $cType, array $cIds, array $tagIds, bool $replace = false) + public static function batchAssignTagsToElement(string $cType, array $cIds, array $tagIds, bool $replace = false): void { $tag = new Tag(); $tag->getDao()->batchAssignTagsToElement($cType, $cIds, $tagIds, $replace); @@ -195,7 +195,7 @@ public static function getByPath(string $path): ?Tag } } - public function save() + public function save(): void { $isUpdate = $this->exists(); @@ -319,7 +319,7 @@ public function hasChildren(): bool return count($this->getChildren()) > 0; } - public function correctPath() + public function correctPath(): void { //set id path to correct value $parentIds = []; @@ -342,7 +342,7 @@ public function correctPath() * * @throws \Exception */ - public function delete() + public function delete(): void { $this->dispatchEvent(new TagEvent($this), TagEvents::PRE_DELETE); diff --git a/models/Element/Tag/Dao.php b/models/Element/Tag/Dao.php index b936076c02c..48347cbc431 100644 --- a/models/Element/Tag/Dao.php +++ b/models/Element/Tag/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM tags WHERE id = ?', [$id]); if (!$data) { @@ -99,7 +99,7 @@ public function save(): bool * * @throws \Exception */ - public function delete() + public function delete(): void { $this->db->beginTransaction(); @@ -141,12 +141,12 @@ public function getTagsForElement(string $cType, int $cId): array return $tags; } - public function addTagToElement(string $cType, int $cId) + public function addTagToElement(string $cType, int $cId): void { $this->doAddTagToElement($this->model->getId(), $cType, $cId); } - protected function doAddTagToElement(int $tagId, string $cType, int $cId) + protected function doAddTagToElement(int $tagId, string $cType, int $cId): void { $data = [ 'tagid' => $tagId, @@ -156,7 +156,7 @@ protected function doAddTagToElement(int $tagId, string $cType, int $cId) Helper::insertOrUpdate($this->db, 'tags_assignment', $data); } - public function removeTagFromElement(string $cType, int $cId) + public function removeTagFromElement(string $cType, int $cId): void { $this->db->delete('tags_assignment', [ 'tagid' => $this->model->getId(), @@ -172,7 +172,7 @@ public function removeTagFromElement(string $cType, int $cId) * * @throws \Exception */ - public function setTagsForElement(string $cType, int $cId, array $tags) + public function setTagsForElement(string $cType, int $cId, array $tags): void { $this->db->beginTransaction(); @@ -191,7 +191,7 @@ public function setTagsForElement(string $cType, int $cId, array $tags) } } - public function batchAssignTagsToElement(string $cType, array $cIds, array $tagIds, bool $replace) + public function batchAssignTagsToElement(string $cType, array $cIds, array $tagIds, bool $replace): void { if ($replace) { $quotedCIds = []; diff --git a/models/Element/ValidationException.php b/models/Element/ValidationException.php index b27040f54f4..f201dacb056 100644 --- a/models/Element/ValidationException.php +++ b/models/Element/ValidationException.php @@ -34,12 +34,12 @@ public function getSubItems(): array /** * @param \Exception[] $subItems */ - public function setSubItems(array $subItems = []) + public function setSubItems(array $subItems = []): void { $this->subItems = $subItems; } - public function addContext(string $context) + public function addContext(string $context): void { $this->contextStack[] = $context; } diff --git a/models/Element/WorkflowState/Dao.php b/models/Element/WorkflowState/Dao.php index 8596075020b..5122e4d23ec 100644 --- a/models/Element/WorkflowState/Dao.php +++ b/models/Element/WorkflowState/Dao.php @@ -32,7 +32,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getByPrimary(int $cid, string $ctype, string $workflow) + public function getByPrimary(int $cid, string $ctype, string $workflow): void { $data = $this->db->fetchAssociative('SELECT * FROM element_workflow_state WHERE cid = ? AND ctype = ? AND workflow = ?', [$cid, $ctype, $workflow]); @@ -68,7 +68,7 @@ public function save(): bool /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('element_workflow_state', [ 'cid' => $this->model->getCid(), diff --git a/models/GridConfig.php b/models/GridConfig.php index a5f40aa04b0..cc41c201129 100644 --- a/models/GridConfig.php +++ b/models/GridConfig.php @@ -70,7 +70,7 @@ public static function getById(int $id): ?GridConfig /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->getId()) { $this->setCreationDate(time()); @@ -84,7 +84,7 @@ public function save() /** * Delete this GridConfig */ - public function delete() + public function delete(): void { $this->getDao()->delete(); } @@ -94,7 +94,7 @@ public function getId(): ?int return $this->id; } - public function setId(int $id) + public function setId(int $id): void { $this->id = (int) $id; } @@ -104,7 +104,7 @@ public function getOwnerId(): ?int return $this->ownerId; } - public function setOwnerId(int $ownerId) + public function setOwnerId(int $ownerId): void { $this->ownerId = $ownerId; } @@ -114,7 +114,7 @@ public function getClassId(): string return $this->classId; } - public function setClassId(string $classId) + public function setClassId(string $classId): void { $this->classId = $classId; } @@ -124,7 +124,7 @@ public function getName(): string return $this->name; } - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -134,7 +134,7 @@ public function getSearchType(): string return $this->searchType; } - public function setSearchType(string $searchType) + public function setSearchType(string $searchType): void { $this->searchType = $searchType; } @@ -144,7 +144,7 @@ public function getConfig(): string return $this->config; } - public function setConfig(string $config) + public function setConfig(string $config): void { $this->config = $config; } @@ -154,7 +154,7 @@ public function getDescription(): ?string return $this->description; } - public function setDescription(?string $description) + public function setDescription(?string $description): void { $this->description = $description; } @@ -164,7 +164,7 @@ public function getCreationDate(): ?int return $this->creationDate; } - public function setCreationDate(int $creationDate) + public function setCreationDate(int $creationDate): void { $this->creationDate = $creationDate; } @@ -174,7 +174,7 @@ public function getModificationDate(): ?int return $this->modificationDate; } - public function setModificationDate(int $modificationDate) + public function setModificationDate(int $modificationDate): void { $this->modificationDate = $modificationDate; } @@ -184,7 +184,7 @@ public function isShareGlobally(): bool return $this->shareGlobally; } - public function setShareGlobally(bool $shareGlobally) + public function setShareGlobally(bool $shareGlobally): void { $this->shareGlobally = (bool) $shareGlobally; } @@ -194,7 +194,7 @@ public function isSetAsFavourite(): bool return $this->setAsFavourite; } - public function setSetAsFavourite(bool $setAsFavourite) + public function setSetAsFavourite(bool $setAsFavourite): void { $this->setAsFavourite = (bool) $setAsFavourite; } @@ -224,7 +224,7 @@ public function getType(): string * * @param string $type */ - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } diff --git a/models/GridConfig/Dao.php b/models/GridConfig/Dao.php index e04050e5391..cbea13ee2da 100644 --- a/models/GridConfig/Dao.php +++ b/models/GridConfig/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM gridconfigs WHERE id = ?', [$id]); @@ -75,7 +75,7 @@ public function save(): int /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('gridconfigs', ['id' => $this->model->getId()]); } diff --git a/models/GridConfigFavourite.php b/models/GridConfigFavourite.php index dc7115c0fc1..6600fe70fe8 100644 --- a/models/GridConfigFavourite.php +++ b/models/GridConfigFavourite.php @@ -65,7 +65,7 @@ public static function getByOwnerAndClassAndObjectId(int $ownerId, string $class /** * @throws \Exception */ - public function save() + public function save(): void { $this->getDao()->save(); } @@ -73,7 +73,7 @@ public function save() /** * Delete this favourite */ - public function delete() + public function delete(): void { $this->getDao()->delete(); } @@ -83,7 +83,7 @@ public function getOwnerId(): int return $this->ownerId; } - public function setOwnerId(int $ownerId) + public function setOwnerId(int $ownerId): void { $this->ownerId = $ownerId; } @@ -93,7 +93,7 @@ public function getClassId(): string return $this->classId; } - public function setClassId(string $classId) + public function setClassId(string $classId): void { $this->classId = $classId; } @@ -103,7 +103,7 @@ public function getGridConfigId(): int return $this->gridConfigId; } - public function setGridConfigId(int $gridConfigId) + public function setGridConfigId(int $gridConfigId): void { $this->gridConfigId = $gridConfigId; } @@ -113,7 +113,7 @@ public function getSearchType(): string return $this->searchType; } - public function setSearchType(string $searchType) + public function setSearchType(string $searchType): void { $this->searchType = $searchType; } @@ -123,7 +123,7 @@ public function getObjectId(): int return $this->objectId; } - public function setObjectId(int $objectId) + public function setObjectId(int $objectId): void { $this->objectId = $objectId; } @@ -143,7 +143,7 @@ public function getType(): string * * @param string $type */ - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } diff --git a/models/GridConfigFavourite/Dao.php b/models/GridConfigFavourite/Dao.php index bc62ac6e151..f00cb1a26cb 100644 --- a/models/GridConfigFavourite/Dao.php +++ b/models/GridConfigFavourite/Dao.php @@ -33,7 +33,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getByOwnerAndClassAndObjectId(int $ownerId, string $classId, int $objectId = null, string $searchType = null) + public function getByOwnerAndClassAndObjectId(int $ownerId, string $classId, int $objectId = null, string $searchType = null): void { $query = 'SELECT * FROM gridconfig_favourites WHERE ownerId = ? AND classId = ? AND searchType = ?'; $params = [$ownerId, $classId, $searchType]; @@ -79,7 +79,7 @@ public function save(): Model\GridConfigFavourite /** * Deletes object from database */ - public function delete() + public function delete(): void { $params = ['ownerId' => $this->model->getOwnerId(), 'classId' => $this->model->getClassId()]; if ($this->model->getSearchType()) { diff --git a/models/GridConfigShare.php b/models/GridConfigShare.php index fc436352f5f..8ca6167bfeb 100644 --- a/models/GridConfigShare.php +++ b/models/GridConfigShare.php @@ -44,7 +44,7 @@ public static function getByGridConfigAndSharedWithId(int $gridConfigId, int $sh /** * @throws \Exception */ - public function save() + public function save(): void { $this->getDao()->save(); } @@ -52,7 +52,7 @@ public function save() /** * Delete this share */ - public function delete() + public function delete(): void { $this->getDao()->delete(); } @@ -62,7 +62,7 @@ public function getGridConfigId(): int return $this->gridConfigId; } - public function setGridConfigId(int $gridConfigId) + public function setGridConfigId(int $gridConfigId): void { $this->gridConfigId = $gridConfigId; } @@ -72,7 +72,7 @@ public function getSharedWithUserId(): int return $this->sharedWithUserId; } - public function setSharedWithUserId(int $sharedWithUserId) + public function setSharedWithUserId(int $sharedWithUserId): void { $this->sharedWithUserId = $sharedWithUserId; } diff --git a/models/GridConfigShare/Dao.php b/models/GridConfigShare/Dao.php index 72263cd889b..ac9b70af10f 100644 --- a/models/GridConfigShare/Dao.php +++ b/models/GridConfigShare/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getByGridConfigAndSharedWithId(int $gridConfigId, int $sharedWithUserId) + public function getByGridConfigAndSharedWithId(int $gridConfigId, int $sharedWithUserId): void { $data = $this->db->fetchAssociative('SELECT * FROM gridconfig_shares WHERE gridConfigId = ? AND sharedWithUserId = ?', [$gridConfigId, $sharedWithUserId]); @@ -42,7 +42,7 @@ public function getByGridConfigAndSharedWithId(int $gridConfigId, int $sharedWit $this->assignVariablesToModel($data); } - public function save() + public function save(): void { $gridConfigFavourite = $this->model->getObjectVars(); $data = []; @@ -63,7 +63,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('gridconfig_shares', ['gridConfigId' => $this->model->getGridConfigId(), 'sharedWithUserId' => $this->model->getSharedWithUserId()]); } diff --git a/models/Metadata/Predefined.php b/models/Metadata/Predefined.php index 46affd49eae..7a62ad68b85 100644 --- a/models/Metadata/Predefined.php +++ b/models/Metadata/Predefined.php @@ -191,7 +191,7 @@ public function getModificationDate(): ?int return $this->modificationDate; } - public function setLanguage(?string $language) + public function setLanguage(?string $language): void { $this->language = $language; } @@ -201,7 +201,7 @@ public function getLanguage(): ?string return $this->language; } - public function setGroup(?string $group) + public function setGroup(?string $group): void { $this->group = $group; } @@ -211,7 +211,7 @@ public function getGroup(): ?string return $this->group; } - public function setTargetSubtype(?string $targetSubtype) + public function setTargetSubtype(?string $targetSubtype): void { $this->targetSubtype = $targetSubtype; } @@ -226,12 +226,12 @@ public function getConfig(): ?string return $this->config; } - public function setConfig(?string $config) + public function setConfig(?string $config): void { $this->config = $config; } - public function minimize() + public function minimize(): void { try { $loader = \Pimcore::getContainer()->get('pimcore.implementation_loader.asset.metadata.data'); @@ -243,7 +243,7 @@ public function minimize() } } - public function expand() + public function expand(): void { try { $loader = \Pimcore::getContainer()->get('pimcore.implementation_loader.asset.metadata.data'); diff --git a/models/Metadata/Predefined/Dao.php b/models/Metadata/Predefined/Dao.php index b4f8420da3c..70cf1785ca6 100644 --- a/models/Metadata/Predefined/Dao.php +++ b/models/Metadata/Predefined/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -42,7 +42,7 @@ public function configure() * * @throws Model\Exception\NotFoundException */ - public function getById(string $id = null) + public function getById(string $id = null): void { if ($id != null) { $this->model->setId($id); @@ -67,7 +67,7 @@ public function getById(string $id = null) * * @throws \Exception */ - public function getByNameAndLanguage(string $name = null, string $language = null) + public function getByNameAndLanguage(string $name = null, string $language = null): void { $list = new Listing(); /** @var Model\Metadata\Predefined[] $definitions */ @@ -93,7 +93,7 @@ public function getByNameAndLanguage(string $name = null, string $language = nul /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->model->setId((string)Uid::v4()); @@ -120,7 +120,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getId()); } diff --git a/models/Notification/Dao.php b/models/Notification/Dao.php index d779d1f42b6..f7f97bbbc85 100644 --- a/models/Notification/Dao.php +++ b/models/Notification/Dao.php @@ -54,7 +54,7 @@ public function getById(int $id): void /** * Save notification */ - public function save() + public function save(): void { $model = $this->getModel(); $model->setModificationDate(date('Y-m-d H:i:s')); diff --git a/models/Property.php b/models/Property.php index 03e9cc41bff..79f99595d1f 100644 --- a/models/Property.php +++ b/models/Property.php @@ -273,7 +273,7 @@ public function resolveDependencies(): array * * @internal */ - public function rewriteIds(array $idMapping) + public function rewriteIds(array $idMapping): void { if (!$this->isInherited()) { if (array_key_exists($this->getType(), $idMapping)) { diff --git a/models/Property/Dao.php b/models/Property/Dao.php index 0cbcc16c998..eb11f1115b7 100644 --- a/models/Property/Dao.php +++ b/models/Property/Dao.php @@ -28,7 +28,7 @@ class Dao extends Model\Dao\AbstractDao /** * Save object to database */ - public function save() + public function save(): void { $data = $this->model->getData(); diff --git a/models/Property/Predefined/Dao.php b/models/Property/Predefined/Dao.php index 2bc5aba018f..adea0de6012 100644 --- a/models/Property/Predefined/Dao.php +++ b/models/Property/Predefined/Dao.php @@ -25,7 +25,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -42,7 +42,7 @@ public function configure() * * @throws Model\Exception\NotFoundException */ - public function getById(string $id = null) + public function getById(string $id = null): void { if ($id != null) { $this->model->setId($id); @@ -69,7 +69,7 @@ public function getById(string $id = null) * * @throws Model\Exception\NotFoundException */ - public function getByKey(string $key = null) + public function getByKey(string $key = null): void { if ($key != null) { $this->model->setKey($key); @@ -96,7 +96,7 @@ public function getByKey(string $key = null) /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->model->setId((string)Uid::v4()); @@ -123,7 +123,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getId()); } diff --git a/models/Redirect.php b/models/Redirect.php index e6a8b7226c0..c8cf521dba2 100644 --- a/models/Redirect.php +++ b/models/Redirect.php @@ -164,7 +164,7 @@ public function getType(): string * * @param string $type */ - public function setType(string $type) + public function setType(string $type): void { if (!empty($type) && !in_array($type, self::TYPES)) { throw new \InvalidArgumentException(sprintf('Invalid type "%s"', $type)); @@ -225,7 +225,7 @@ public function getHttpStatus(): string return 'HTTP/1.1 ' . $statusCode . ' ' . $this->getStatusCodes()[$statusCode]; } - public function clearDependentCache() + public function clearDependentCache(): void { // this is mostly called in Redirect\Dao not here try { @@ -352,7 +352,7 @@ public function getUserOwner(): ?int return $this->userOwner; } - public function setUserOwner(?int $userOwner) + public function setUserOwner(?int $userOwner): void { $this->userOwner = $userOwner; } @@ -362,12 +362,12 @@ public function getUserModification(): ?int return $this->userModification; } - public function setUserModification(int $userModification) + public function setUserModification(int $userModification): void { $this->userModification = $userModification; } - public function save() + public function save(): void { $this->dispatchEvent(new RedirectEvent($this), RedirectEvents::PRE_SAVE); $this->getDao()->save(); @@ -375,7 +375,7 @@ public function save() $this->clearDependentCache(); } - public function delete() + public function delete(): void { $this->dispatchEvent(new RedirectEvent($this), RedirectEvents::PRE_DELETE); $this->getDao()->delete(); diff --git a/models/Redirect/Dao.php b/models/Redirect/Dao.php index 982e870418b..d465c534bc3 100644 --- a/models/Redirect/Dao.php +++ b/models/Redirect/Dao.php @@ -34,7 +34,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -55,7 +55,7 @@ public function getById(int $id = null) * * @throws NotFoundException */ - public function getByExactMatch(Request $request, ?Site $site = null, bool $override = false) + public function getByExactMatch(Request $request, ?Site $site = null, bool $override = false): void { $partResolver = new RedirectUrlPartResolver($request); $siteId = $site ? $site->getId() : null; @@ -99,7 +99,7 @@ public function getByExactMatch(Request $request, ?Site $site = null, bool $over /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { // create in database @@ -128,12 +128,12 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('redirects', ['id' => $this->model->getId()]); } - protected function updateModificationInfos() + protected function updateModificationInfos(): void { $updateTime = time(); $this->model->setModificationDate($updateTime); diff --git a/models/Schedule/Task/Dao.php b/models/Schedule/Task/Dao.php index 6a4debce47e..581ceb7e768 100644 --- a/models/Schedule/Task/Dao.php +++ b/models/Schedule/Task/Dao.php @@ -29,7 +29,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM schedule_tasks WHERE id = ?', [$id]); if (!$data) { @@ -38,7 +38,7 @@ public function getById(int $id) $this->assignVariablesToModel($data); } - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -50,7 +50,7 @@ public function save() /** * Create a new record for the object in database */ - public function create() + public function create(): void { $this->db->insert('schedule_tasks', []); $this->model->setId((int) $this->db->lastInsertId()); @@ -59,7 +59,7 @@ public function create() /** * Save changes to database, it's an good idea to use save() instead */ - public function update() + public function update(): void { $site = $this->model->getObjectVars(); $data = []; @@ -81,7 +81,7 @@ public function update() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('schedule_tasks', ['id' => $this->model->getId()]); } diff --git a/models/Search/Backend/Data.php b/models/Search/Backend/Data.php index 5a37dbdd8ca..7d9c620211c 100644 --- a/models/Search/Backend/Data.php +++ b/models/Search/Backend/Data.php @@ -477,7 +477,7 @@ public static function getForElement(Element\ElementInterface $element): self return $data; } - public function delete() + public function delete(): void { $this->getDao()->delete(); } @@ -485,7 +485,7 @@ public function delete() /** * @throws \Exception */ - public function save() + public function save(): void { if ($this->id instanceof Data\Id) { $this->dispatchEvent(new SearchBackendEvent($this), SearchBackendEvents::PRE_SAVE); diff --git a/models/Search/Backend/Data/Dao.php b/models/Search/Backend/Data/Dao.php index 6baeb63784b..c89dbe4ec6e 100644 --- a/models/Search/Backend/Data/Dao.php +++ b/models/Search/Backend/Data/Dao.php @@ -49,7 +49,7 @@ public function getForElement(Model\Element\ElementInterface $element): void } } - public function save() + public function save(): void { $oldFullPath = $this->db->fetchOne('SELECT fullpath FROM search_backend_data WHERE id = :id and maintype = :type FOR UPDATE', [ 'id' => $this->model->getId()->getId(), @@ -88,7 +88,7 @@ public function save() /** * Deletes from database */ - public function delete() + public function delete(): void { if ($this->model->getId() instanceof Model\Search\Backend\Data\Id) { $this->db->delete('search_backend_data', [ @@ -100,19 +100,19 @@ public function delete() } } - public function getMinWordLengthForFulltextIndex() + public function getMinWordLengthForFulltextIndex(): int { try { - return $this->db->fetchOne('SELECT @@innodb_ft_min_token_size'); + return (int) $this->db->fetchOne('SELECT @@innodb_ft_min_token_size'); } catch (\Exception $e) { return 3; } } - public function getMaxWordLengthForFulltextIndex() + public function getMaxWordLengthForFulltextIndex(): int { try { - return $this->db->fetchOne('SELECT @@innodb_ft_max_token_size'); + return (int) $this->db->fetchOne('SELECT @@innodb_ft_max_token_size'); } catch (\Exception $e) { return 84; } diff --git a/models/Site/Dao.php b/models/Site/Dao.php index 2b50a27ab06..e15a3004867 100644 --- a/models/Site/Dao.php +++ b/models/Site/Dao.php @@ -30,7 +30,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM sites WHERE id = ?', [$id]); if (empty($data['id'])) { @@ -44,7 +44,7 @@ public function getById(int $id) * * @throws NotFoundException */ - public function getByRootId(int $id) + public function getByRootId(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM sites WHERE rootId = ?', [$id]); if (empty($data['id'])) { @@ -58,7 +58,7 @@ public function getByRootId(int $id) * * @throws NotFoundException */ - public function getByDomain(string $domain) + public function getByDomain(string $domain): void { $data = $this->db->fetchAssociative('SELECT * FROM sites WHERE mainDomain = ? OR domains LIKE ?', [$domain, '%"' . $domain . '"%']); if (empty($data['id'])) { @@ -98,7 +98,7 @@ public function getByDomain(string $domain) /** * Save object to database */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -110,7 +110,7 @@ public function save() /** * Create a new record for the object in database */ - public function create() + public function create(): void { $ts = time(); $this->model->setCreationDate($ts); @@ -122,7 +122,7 @@ public function create() /** * Save changes to database, it's a good idea to use save() instead */ - public function update() + public function update(): void { $ts = time(); $this->model->setModificationDate($ts); @@ -150,7 +150,7 @@ public function update() /** * Deletes site from database */ - public function delete() + public function delete(): void { $this->db->delete('sites', ['id' => $this->model->getId()]); //clean slug table diff --git a/models/Staticroute.php b/models/Staticroute.php index 0190d62245d..3193b3293f3 100644 --- a/models/Staticroute.php +++ b/models/Staticroute.php @@ -80,7 +80,7 @@ final class Staticroute extends AbstractModel * * @param Staticroute|null $route */ - public static function setCurrentRoute(?Staticroute $route) + public static function setCurrentRoute(?Staticroute $route): void { self::$_currentRoute = $route; } diff --git a/models/Staticroute/Dao.php b/models/Staticroute/Dao.php index 013271c86f0..7e4fa970c68 100644 --- a/models/Staticroute/Dao.php +++ b/models/Staticroute/Dao.php @@ -26,7 +26,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -41,7 +41,7 @@ public function configure() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getId()); } @@ -66,7 +66,7 @@ public function getAll(): array * * @throws NotFoundException */ - public function getById(string $id = null) + public function getById(string $id = null): void { if ($id != null) { $this->model->setId($id); @@ -94,7 +94,7 @@ public function getById(string $id = null) * * @throws NotFoundException */ - public function getByName(string $name = null, int $siteId = null) + public function getByName(string $name = null, int $siteId = null): void { if ($name != null) { $this->model->setName($name); @@ -152,7 +152,7 @@ protected function prepareDataStructureForYaml(string $id, mixed $data): mixed /** * @throws \Exception */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->model->setId((string)Uid::v4()); diff --git a/models/Tool/CustomReport/Config.php b/models/Tool/CustomReport/Config.php index 71e4f404e8f..867a1e00a8a 100644 --- a/models/Tool/CustomReport/Config.php +++ b/models/Tool/CustomReport/Config.php @@ -151,7 +151,7 @@ public static function getAdapter(?\stdClass $configuration, Config $fullConfig return $factory->create($configuration, $fullConfig); } - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -161,7 +161,7 @@ public function getName(): string return $this->name; } - public function setSql(string $sql) + public function setSql(string $sql): void { $this->sql = $sql; } @@ -171,7 +171,7 @@ public function getSql(): string return $this->sql; } - public function setColumnConfiguration(array $columnConfiguration) + public function setColumnConfiguration(array $columnConfiguration): void { $this->columnConfiguration = $columnConfiguration; } @@ -181,7 +181,7 @@ public function getColumnConfiguration(): array return $this->columnConfiguration; } - public function setGroup(string $group) + public function setGroup(string $group): void { $this->group = $group; } @@ -191,7 +191,7 @@ public function getGroup(): string return $this->group; } - public function setGroupIconClass(string $groupIconClass) + public function setGroupIconClass(string $groupIconClass): void { $this->groupIconClass = $groupIconClass; } @@ -201,7 +201,7 @@ public function getGroupIconClass(): string return $this->groupIconClass; } - public function setIconClass(string $iconClass) + public function setIconClass(string $iconClass): void { $this->iconClass = $iconClass; } @@ -211,7 +211,7 @@ public function getIconClass(): string return $this->iconClass; } - public function setNiceName(string $niceName) + public function setNiceName(string $niceName): void { $this->niceName = $niceName; } @@ -221,7 +221,7 @@ public function getNiceName(): string return $this->niceName; } - public function setMenuShortcut(bool $menuShortcut) + public function setMenuShortcut(bool $menuShortcut): void { $this->menuShortcut = (bool) $menuShortcut; } @@ -231,7 +231,7 @@ public function getMenuShortcut(): bool return $this->menuShortcut; } - public function setDataSourceConfig(array $dataSourceConfig) + public function setDataSourceConfig(array $dataSourceConfig): void { $this->dataSourceConfig = $dataSourceConfig; } @@ -252,7 +252,7 @@ public function getDataSourceConfig(): ?\stdClass return null; } - public function setChartType(string $chartType) + public function setChartType(string $chartType): void { $this->chartType = $chartType; } @@ -262,7 +262,7 @@ public function getChartType(): string return $this->chartType; } - public function setPieColumn(?string $pieColumn) + public function setPieColumn(?string $pieColumn): void { $this->pieColumn = $pieColumn; } @@ -272,7 +272,7 @@ public function getPieColumn(): ?string return $this->pieColumn; } - public function setXAxis(?string $xAxis) + public function setXAxis(?string $xAxis): void { $this->xAxis = $xAxis; } @@ -282,7 +282,7 @@ public function getXAxis(): ?string return $this->xAxis; } - public function setYAxis(array|string|null $yAxis) + public function setYAxis(array|string|null $yAxis): void { $this->yAxis = $yAxis; } @@ -292,7 +292,7 @@ public function getYAxis(): array|string|null return $this->yAxis; } - public function setPieLabelColumn(?string $pieLabelColumn) + public function setPieLabelColumn(?string $pieLabelColumn): void { $this->pieLabelColumn = $pieLabelColumn; } @@ -307,7 +307,7 @@ public function getModificationDate(): ?int return $this->modificationDate; } - public function setModificationDate(int $modificationDate) + public function setModificationDate(int $modificationDate): void { $this->modificationDate = $modificationDate; } @@ -317,7 +317,7 @@ public function getCreationDate(): ?int return $this->creationDate; } - public function setCreationDate(int $creationDate) + public function setCreationDate(int $creationDate): void { $this->creationDate = $creationDate; } @@ -327,7 +327,7 @@ public function getReportClass(): string return $this->reportClass; } - public function setReportClass(string $reportClass) + public function setReportClass(string $reportClass): void { $this->reportClass = $reportClass; } diff --git a/models/Tool/CustomReport/Config/Dao.php b/models/Tool/CustomReport/Config/Dao.php index 328be5279e7..f5c22db5072 100644 --- a/models/Tool/CustomReport/Config/Dao.php +++ b/models/Tool/CustomReport/Config/Dao.php @@ -24,7 +24,7 @@ */ class Dao extends Model\Dao\PimcoreLocationAwareConfigDao { - public function configure() + public function configure(): void { $config = \Pimcore::getContainer()->getParameter('pimcore.config'); @@ -41,7 +41,7 @@ public function configure() * * @throws Model\Exception\NotFoundException */ - public function getByName(string $id = null) + public function getByName(string $id = null): void { if ($id != null) { $this->model->setName($id); @@ -67,7 +67,7 @@ public function getByName(string $id = null) /** * @throws \Exception */ - public function save() + public function save(): void { $ts = time(); if (!$this->model->getCreationDate()) { @@ -92,7 +92,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->deleteData($this->model->getName()); } diff --git a/models/Tool/Email/Blacklist.php b/models/Tool/Email/Blacklist.php index 91b467645bd..b1eac620ef1 100644 --- a/models/Tool/Email/Blacklist.php +++ b/models/Tool/Email/Blacklist.php @@ -45,7 +45,7 @@ public static function getByAddress(string $addr): ?Blacklist } } - public function setAddress(string $address) + public function setAddress(string $address): void { $this->address = $address; } @@ -55,7 +55,7 @@ public function getAddress(): ?string return $this->address; } - public function setCreationDate(int $creationDate) + public function setCreationDate(int $creationDate): void { $this->creationDate = (int) $creationDate; } @@ -69,7 +69,7 @@ public function getCreationDate(): int return $this->creationDate; } - public function setModificationDate(int $modificationDate) + public function setModificationDate(int $modificationDate): void { $this->modificationDate = (int) $modificationDate; } diff --git a/models/Tool/Email/Blacklist/Dao.php b/models/Tool/Email/Blacklist/Dao.php index f34e484b676..35c1af439f8 100644 --- a/models/Tool/Email/Blacklist/Dao.php +++ b/models/Tool/Email/Blacklist/Dao.php @@ -30,7 +30,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException( */ - public function getByAddress(string $address) + public function getByAddress(string $address): void { $data = $this->db->fetchAssociative('SELECT * FROM email_blacklist WHERE address = ?', [$address]); @@ -43,7 +43,7 @@ public function getByAddress(string $address) /** * Save object to database */ - public function save() + public function save(): void { $this->model->setModificationDate(time()); if (!$this->model->getCreationDate()) { @@ -70,7 +70,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('email_blacklist', ['address' => $this->model->getAddress()]); } diff --git a/models/Tool/Email/Log.php b/models/Tool/Email/Log.php index 7498b90339a..6c257627981 100644 --- a/models/Tool/Email/Log.php +++ b/models/Tool/Email/Log.php @@ -402,7 +402,7 @@ public function getTextLog(): bool|string /** * Removes the log file entry from the db and removes the log files on the system */ - public function delete() + public function delete(): void { $storage = Storage::get('email_log'); $storage->delete($this->getHtmlLogFilename()); @@ -410,7 +410,7 @@ public function delete() $this->getDao()->delete(); } - public function save() + public function save(): void { $this->getDao()->save(); diff --git a/models/Tool/Email/Log/Dao.php b/models/Tool/Email/Log/Dao.php index 2eacf4e7e9b..2785bcf4d01 100644 --- a/models/Tool/Email/Log/Dao.php +++ b/models/Tool/Email/Log/Dao.php @@ -37,7 +37,7 @@ class Dao extends Model\Dao\AbstractDao * * @param int|null $id */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -50,7 +50,7 @@ public function getById(int $id = null) /** * Save document to database */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -94,12 +94,12 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete(self::$dbTable, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $this->db->insert(self::$dbTable, []); diff --git a/models/Tool/Targeting/Rule.php b/models/Tool/Targeting/Rule.php index db387b56953..86dc8737989 100644 --- a/models/Tool/Targeting/Rule.php +++ b/models/Tool/Targeting/Rule.php @@ -180,7 +180,7 @@ public function getConditions(): array return $this->conditions; } - public function setScope(string $scope) + public function setScope(string $scope): void { if (!empty($scope)) { $this->scope = $scope; @@ -192,7 +192,7 @@ public function getScope(): string return $this->scope; } - public function setActive(bool $active) + public function setActive(bool $active): void { $this->active = (bool) $active; } @@ -207,7 +207,7 @@ public function getPrio(): int return $this->prio; } - public function setPrio(int $prio) + public function setPrio(int $prio): void { $this->prio = $prio; } diff --git a/models/Tool/Targeting/Rule/Dao.php b/models/Tool/Targeting/Rule/Dao.php index f5ff3c282aa..43a74b72e91 100644 --- a/models/Tool/Targeting/Rule/Dao.php +++ b/models/Tool/Targeting/Rule/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -54,7 +54,7 @@ public function getById(int $id = null) * * @throws \Exception */ - public function getByName(string $name = null) + public function getByName(string $name = null): void { if ($name != null) { $this->model->setName($name); @@ -75,7 +75,7 @@ public function getByName(string $name = null) /** * Save object to database */ - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -87,7 +87,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('targeting_rules', ['id' => $this->model->getId()]); } @@ -95,7 +95,7 @@ public function delete() /** * @throws \Exception */ - public function update() + public function update(): void { $type = $this->model->getObjectVars(); $data = []; @@ -115,7 +115,7 @@ public function update() $this->db->update('targeting_rules', $data, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $this->db->insert('targeting_rules', []); $this->model->setId((int) $this->db->lastInsertId()); diff --git a/models/Tool/Targeting/TargetGroup.php b/models/Tool/Targeting/TargetGroup.php index b1385eae5e0..f80f82e396d 100644 --- a/models/Tool/Targeting/TargetGroup.php +++ b/models/Tool/Targeting/TargetGroup.php @@ -111,7 +111,7 @@ public function getName(): string return $this->name; } - public function setThreshold(int $threshold) + public function setThreshold(int $threshold): void { $this->threshold = $threshold; } @@ -121,7 +121,7 @@ public function getThreshold(): int return $this->threshold; } - public function setActive(bool $active) + public function setActive(bool $active): void { $this->active = (bool)$active; } diff --git a/models/Tool/Targeting/TargetGroup/Dao.php b/models/Tool/Targeting/TargetGroup/Dao.php index 2c1961f6c2c..12f5a788394 100644 --- a/models/Tool/Targeting/TargetGroup/Dao.php +++ b/models/Tool/Targeting/TargetGroup/Dao.php @@ -31,7 +31,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if (null !== $id) { $this->model->setId($id); @@ -53,7 +53,7 @@ public function getById(int $id = null) * * @throws Model\Exception\NotFoundException */ - public function getByName(string $name = null) + public function getByName(string $name = null): void { if (null !== $name) { $this->model->setName($name); @@ -71,7 +71,7 @@ public function getByName(string $name = null) } } - public function save() + public function save(): void { if (!$this->model->getId()) { $this->create(); @@ -80,12 +80,12 @@ public function save() $this->update(); } - public function delete() + public function delete(): void { $this->db->delete('targeting_target_groups', ['id' => $this->model->getId()]); } - public function update() + public function update(): void { $type = $this->model->getObjectVars(); $data = []; @@ -107,7 +107,7 @@ public function update() $this->db->update('targeting_target_groups', $data, ['id' => $this->model->getId()]); } - public function create() + public function create(): void { $this->db->insert('targeting_target_groups', []); $this->model->setId((int) $this->db->lastInsertId()); diff --git a/models/Tool/TmpStore.php b/models/Tool/TmpStore.php index dcb1f1958f1..f2354c85b99 100644 --- a/models/Tool/TmpStore.php +++ b/models/Tool/TmpStore.php @@ -162,7 +162,7 @@ public function getId(): string return $this->id; } - public function setId(string $id) + public function setId(string $id): void { $this->id = $id; } @@ -172,7 +172,7 @@ public function getTag(): string return $this->tag; } - public function setTag(string $tag) + public function setTag(string $tag): void { $this->tag = $tag; } @@ -182,7 +182,7 @@ public function getData(): mixed return $this->data; } - public function setData(mixed $data) + public function setData(mixed $data): void { $this->data = $data; } @@ -192,7 +192,7 @@ public function getDate(): int return $this->date; } - public function setDate(int $date) + public function setDate(int $date): void { $this->date = $date; } @@ -202,7 +202,7 @@ public function isSerialized(): bool return $this->serialized; } - public function setSerialized(bool $serialized) + public function setSerialized(bool $serialized): void { $this->serialized = $serialized; } @@ -212,7 +212,7 @@ public function getExpiryDate(): int return $this->expiryDate; } - public function setExpiryDate(int $expiryDate) + public function setExpiryDate(int $expiryDate): void { $this->expiryDate = $expiryDate; } diff --git a/models/Tool/TmpStore/Dao.php b/models/Tool/TmpStore/Dao.php index adb01f0bf96..373786cbb11 100644 --- a/models/Tool/TmpStore/Dao.php +++ b/models/Tool/TmpStore/Dao.php @@ -49,7 +49,7 @@ public function add(string $id, mixed $data, ?string $tag = null, ?int $lifetime } } - public function delete(string $id) + public function delete(string $id): void { $this->db->delete('tmp_store', ['id' => $id]); } diff --git a/models/Tool/UUID.php b/models/Tool/UUID.php index 8eff6ffc5cd..a0653103654 100644 --- a/models/Tool/UUID.php +++ b/models/Tool/UUID.php @@ -145,7 +145,7 @@ public function getUuid(): string return $this->uuid; } - public function setUuid(string $uuid) + public function setUuid(string $uuid): void { $this->uuid = $uuid; } diff --git a/models/Tool/UUID/Dao.php b/models/Tool/UUID/Dao.php index be68ffa5609..b3920db897f 100644 --- a/models/Tool/UUID/Dao.php +++ b/models/Tool/UUID/Dao.php @@ -27,14 +27,14 @@ class Dao extends Model\Dao\AbstractDao { const TABLE_NAME = 'uuids'; - public function save() + public function save(): void { $data = $this->getValidObjectVars(); Helper::insertOrUpdate($this->db, self::TABLE_NAME, $data); } - public function create() + public function create(): void { $data = $this->getValidObjectVars(); @@ -57,7 +57,7 @@ private function getValidObjectVars(): array /** * @throws \Exception */ - public function delete() + public function delete(): void { $uuid = $this->model->getUuid(); if (!$uuid) { diff --git a/models/Translation.php b/models/Translation.php index 719ff79f7f8..2b492012f36 100644 --- a/models/Translation.php +++ b/models/Translation.php @@ -188,7 +188,7 @@ public static function getValidLanguages(string $domain = self::DOMAIN_DEFAULT): return Tool::getValidLanguages(); } - public function addTranslation(string $language, string $text) + public function addTranslation(string $language, string $text): void { $this->translations[$language] = $text; } @@ -206,7 +206,7 @@ public function hasTranslation(string $language): bool /** * @internal */ - public static function clearDependentCache() + public static function clearDependentCache(): void { Cache::clearTags(['translator', 'translate']); } @@ -327,7 +327,7 @@ public static function isAValidDomain(string $domain): bool return $translation->getDao()->isAValidDomain($domain); } - public function save() + public function save(): void { $this->dispatchEvent(new TranslationEvent($this), TranslationEvents::PRE_SAVE); @@ -338,7 +338,7 @@ public function save() self::clearDependentCache(); } - public function delete() + public function delete(): void { $this->dispatchEvent(new TranslationEvent($this), TranslationEvents::PRE_DELETE); diff --git a/models/Translation/Dao.php b/models/Translation/Dao.php index 6ff76534619..9241355d426 100644 --- a/models/Translation/Dao.php +++ b/models/Translation/Dao.php @@ -45,7 +45,7 @@ public function getDatabaseTableName(): string * @throws NotFoundResourceException * @throws \Doctrine\DBAL\Exception */ - public function getByKey(string $key, array $languages = null) + public function getByKey(string $key, array $languages = null): void { if (is_array($languages)) { $sql = 'SELECT * FROM ' . $this->getDatabaseTableName() . ' WHERE `key` = :key @@ -77,7 +77,7 @@ public function getByKey(string $key, array $languages = null) /** * Save object to database */ - public function save() + public function save(): void { //Create Domain table if doesn't exist $this->createOrUpdateTable(); @@ -119,7 +119,7 @@ public function save() /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete($this->getDatabaseTableName(), [$this->db->quoteIdentifier('key') => $this->model->getKey()]); } @@ -176,7 +176,7 @@ public function isAValidDomain(string $domain): bool } } - public function createOrUpdateTable() + public function createOrUpdateTable(): void { $table = $this->getDatabaseTableName(); diff --git a/models/Translation/Listing.php b/models/Translation/Listing.php index 6c614c159bd..8e8e88ac2ec 100644 --- a/models/Translation/Listing.php +++ b/models/Translation/Listing.php @@ -100,7 +100,7 @@ public static function getCacheLimit(): int return self::$cacheLimit; } - public static function setCacheLimit(int $cacheLimit) + public static function setCacheLimit(int $cacheLimit): void { self::$cacheLimit = $cacheLimit; } diff --git a/models/Translation/Listing/Dao.php b/models/Translation/Listing/Dao.php index fac04e0c09b..a41dde9064a 100644 --- a/models/Translation/Listing/Dao.php +++ b/models/Translation/Listing/Dao.php @@ -138,7 +138,7 @@ public function isCacheable(): bool return true; } - public function cleanup() + public function cleanup(): void { $keysToDelete = $this->db->fetchFirstColumn('SELECT `key` FROM ' . $this->getDatabaseTableName() . ' as tbl1 WHERE (SELECT count(*) FROM ' . $this->getDatabaseTableName() . " WHERE `key` = tbl1.`key` AND (`text` IS NULL OR `text` = '')) diff --git a/models/User.php b/models/User.php index 099c2ed2a0e..ef256221c15 100644 --- a/models/User.php +++ b/models/User.php @@ -392,7 +392,9 @@ protected function getOriginalImageStoragePath(): string return sprintf('/user-image/user-%s.png', $this->getId()); } - // @internal + /** + * @internal + */ protected function getThumbnailImageStoragePath(): string { return sprintf('/user-image/user-thumbnail-%s.png', $this->getId()); diff --git a/models/User/AbstractUser.php b/models/User/AbstractUser.php index 689b8fa1e30..9f17625bf07 100644 --- a/models/User/AbstractUser.php +++ b/models/User/AbstractUser.php @@ -177,7 +177,7 @@ public function save(): static /** * @throws \Exception */ - public function delete() + public function delete(): void { if ($this->getId() < 1) { throw new \Exception('Deleting the system user is not allowed!'); @@ -241,7 +241,7 @@ public function setType(string $type): static /** * @throws \Exception */ - protected function update() + protected function update(): void { $this->getDao()->update(); } diff --git a/models/User/AbstractUser/Dao.php b/models/User/AbstractUser/Dao.php index cf0100356fe..9a9dffd0341 100644 --- a/models/User/AbstractUser/Dao.php +++ b/models/User/AbstractUser/Dao.php @@ -30,7 +30,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws Model\Exception\NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { if ($this->model->getType()) { $data = $this->db->fetchAssociative('SELECT * FROM users WHERE `type` = ? AND id = ?', [$this->model->getType(), $id]); @@ -50,7 +50,7 @@ public function getById(int $id) * * @throws Model\Exception\NotFoundException */ - public function getByName(string $name) + public function getByName(string $name): void { $data = $this->db->fetchAssociative('SELECT * FROM users WHERE `type` = ? AND `name` = ?', [$this->model->getType(), $name]); @@ -61,7 +61,7 @@ public function getByName(string $name) } } - public function create() + public function create(): void { $this->db->insert('users', [ 'name' => $this->model->getName(), @@ -90,7 +90,7 @@ public function hasChildren(): bool /** * @throws \Exception */ - public function update() + public function update(): void { if (strlen($this->model->getName()) < 2) { throw new \Exception('Name of user/role must be at least 2 characters long'); @@ -120,7 +120,7 @@ public function update() /** * @throws \Exception */ - public function delete() + public function delete(): void { $userId = $this->model->getId(); Logger::debug('delete user with ID: ' . $userId); @@ -131,7 +131,7 @@ public function delete() /** * @throws \Exception */ - public function setLastLoginDate() + public function setLastLoginDate(): void { $data['lastLogin'] = (new \DateTime())->getTimestamp(); $this->db->update('users', $data, ['id' => $this->model->getId()]); diff --git a/models/User/Dao.php b/models/User/Dao.php index 8619ea7a5aa..0e4dd32fc70 100644 --- a/models/User/Dao.php +++ b/models/User/Dao.php @@ -25,7 +25,7 @@ class Dao extends UserRole\Dao /** * Deletes object from database */ - public function delete() + public function delete(): void { parent::delete(); diff --git a/models/User/Permission/Definition/Dao.php b/models/User/Permission/Definition/Dao.php index 1cc20af8048..feeb9a35f0e 100644 --- a/models/User/Permission/Definition/Dao.php +++ b/models/User/Permission/Definition/Dao.php @@ -26,7 +26,7 @@ */ class Dao extends Model\Dao\AbstractDao { - public function save() + public function save(): void { try { Helper::insertOrUpdate($this->db, 'users_permission_definitions', [ diff --git a/models/User/UserRole.php b/models/User/UserRole.php index a9d04c62050..1d5cce14d18 100644 --- a/models/User/UserRole.php +++ b/models/User/UserRole.php @@ -91,7 +91,7 @@ class UserRole extends AbstractUser /** * {@inheritdoc} */ - protected function update() + protected function update(): void { $this->getDao()->update(); diff --git a/models/User/UserRole/Dao.php b/models/User/UserRole/Dao.php index 3f1b71af7e8..cc757f1a4fb 100644 --- a/models/User/UserRole/Dao.php +++ b/models/User/UserRole/Dao.php @@ -30,7 +30,7 @@ class Dao extends Model\User\AbstractUser\Dao * * @throws \Exception */ - public function getById(int $id) + public function getById(int $id): void { parent::getById($id); @@ -44,7 +44,7 @@ public function getById(int $id) * * @throws \Exception */ - public function getByName(string $name) + public function getByName(string $name): void { parent::getByName($name); @@ -53,7 +53,7 @@ public function getByName(string $name) } } - public function loadWorkspaces() + public function loadWorkspaces(): void { $types = ['asset', 'document', 'object']; @@ -72,7 +72,7 @@ public function loadWorkspaces() } } - public function emptyWorkspaces() + public function emptyWorkspaces(): void { $this->db->delete('users_workspaces_asset', ['userId' => $this->model->getId()]); $this->db->delete('users_workspaces_document', ['userId' => $this->model->getId()]); diff --git a/models/User/Workspace/Dao.php b/models/User/Workspace/Dao.php index cd03ae97ea8..2184d86fc43 100644 --- a/models/User/Workspace/Dao.php +++ b/models/User/Workspace/Dao.php @@ -26,7 +26,7 @@ */ class Dao extends Model\Dao\AbstractDao { - public function save() + public function save(): void { $tableName = ''; if ($this->model instanceof Workspace\Asset) { diff --git a/models/User/Workspace/DataObject.php b/models/User/Workspace/DataObject.php index f73b835f510..aee7a9ce318 100644 --- a/models/User/Workspace/DataObject.php +++ b/models/User/Workspace/DataObject.php @@ -77,7 +77,7 @@ public function getUnpublish(): bool return $this->unpublish; } - public function setLEdit(string $lEdit) + public function setLEdit(string $lEdit): void { //@TODO - at the moment disallowing all languages is not possible - the empty lEdit value means that every language is allowed to edit... $this->lEdit = $lEdit; @@ -88,7 +88,7 @@ public function getLEdit(): ?string return $this->lEdit; } - public function setLView(string $lView) + public function setLView(string $lView): void { $this->lView = $lView; } @@ -98,7 +98,7 @@ public function getLView(): ?string return $this->lView; } - public function setLayouts(string $layouts) + public function setLayouts(string $layouts): void { $this->layouts = $layouts; } diff --git a/models/Version.php b/models/Version.php index 8d5e915a774..abc61895412 100644 --- a/models/Version.php +++ b/models/Version.php @@ -104,7 +104,7 @@ public static function getById(int $id): ?Version * * @static */ - public static function disable() + public static function disable(): void { self::$disabled = true; } @@ -115,7 +115,7 @@ public static function disable() * * @static */ - public static function enable() + public static function enable(): void { self::$disabled = false; } @@ -128,7 +128,7 @@ public static function isEnabled(): bool /** * @throws \Exception */ - public function save() + public function save(): void { $this->dispatchEvent(new VersionEvent($this), VersionEvents::PRE_SAVE); @@ -260,7 +260,7 @@ function (Concrete $object, Data $fieldDefinition, $property, $currentValue) { /** * Delete this Version */ - public function delete() + public function delete(): void { $this->dispatchEvent(new VersionEvent($this), VersionEvents::PRE_DELETE); diff --git a/models/Version/Adapter/ProxyVersionStorageAdapter.php b/models/Version/Adapter/ProxyVersionStorageAdapter.php index dc19a91aaa1..8218942547f 100644 --- a/models/Version/Adapter/ProxyVersionStorageAdapter.php +++ b/models/Version/Adapter/ProxyVersionStorageAdapter.php @@ -68,7 +68,7 @@ public function delete(Version $version, bool $isBinaryHashInUse): void $this->storageAdapter->delete($version, $isBinaryHashInUse); } - public function setStorageAdapter(VersionStorageAdapterInterface $adapter) + public function setStorageAdapter(VersionStorageAdapterInterface $adapter): void { $this->storageAdapter = $adapter; } diff --git a/models/Version/Dao.php b/models/Version/Dao.php index 3b1c29ae35b..82a9ef4e17b 100644 --- a/models/Version/Dao.php +++ b/models/Version/Dao.php @@ -32,7 +32,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws NotFoundException */ - public function getById(int $id) + public function getById(int $id): void { $data = $this->db->fetchAssociative('SELECT * FROM versions WHERE id = ?', [$id]); @@ -78,7 +78,7 @@ public function save(): int /** * Deletes object from database */ - public function delete() + public function delete(): void { $this->db->delete('versions', ['id' => $this->model->getId()]); } diff --git a/models/Version/SetDumpStateFilter.php b/models/Version/SetDumpStateFilter.php index b50ebb39310..3a84bf7d0a3 100644 --- a/models/Version/SetDumpStateFilter.php +++ b/models/Version/SetDumpStateFilter.php @@ -34,7 +34,7 @@ public function __construct(bool $state) /** * {@inheritdoc} */ - public function apply($object, $property, $objectCopier) + public function apply($object, $property, $objectCopier): void { if ($object instanceof ElementDumpStateInterface) { $object->setInDumpState($this->state); diff --git a/models/WebsiteSetting.php b/models/WebsiteSetting.php index d1a2372f0b6..460debebb9e 100644 --- a/models/WebsiteSetting.php +++ b/models/WebsiteSetting.php @@ -239,7 +239,7 @@ public function getLanguage(): string return $this->language; } - public function setLanguage(string $language) + public function setLanguage(string $language): void { $this->language = $language; } @@ -247,7 +247,7 @@ public function setLanguage(string $language) /** * @internal */ - public function clearDependentCache() + public function clearDependentCache(): void { \Pimcore\Cache::clearTag('website_config'); } diff --git a/models/WebsiteSetting/Dao.php b/models/WebsiteSetting/Dao.php index 7693fe7416c..505e3b6ff14 100644 --- a/models/WebsiteSetting/Dao.php +++ b/models/WebsiteSetting/Dao.php @@ -30,7 +30,7 @@ class Dao extends Model\Dao\AbstractDao * * @throws NotFoundException */ - public function getById(int $id = null) + public function getById(int $id = null): void { if ($id != null) { $this->model->setId($id); @@ -53,7 +53,7 @@ public function getById(int $id = null) * * @throws NotFoundException */ - public function getByName(string $name = null, int $siteId = null, string $language = null) + public function getByName(string $name = null, int $siteId = null, string $language = null): void { if ($name != null) { $this->model->setName($name); @@ -83,7 +83,7 @@ public function getByName(string $name = null, int $siteId = null, string $langu } } - public function save() + public function save(): void { if ($this->model->getId()) { $this->update(); @@ -92,13 +92,13 @@ public function save() } } - public function delete() + public function delete(): void { $this->db->delete('website_settings', ['id' => $this->model->getId()]); $this->model->clearDependentCache(); } - public function update() + public function update(): void { $ts = time(); $this->model->setModificationDate($ts); @@ -117,7 +117,7 @@ public function update() $this->model->clearDependentCache(); } - public function create() + public function create(): void { $ts = time(); $this->model->setModificationDate($ts); diff --git a/models/WebsiteSetting/Listing.php b/models/WebsiteSetting/Listing.php index 0b62ec9dddc..6af519396b9 100644 --- a/models/WebsiteSetting/Listing.php +++ b/models/WebsiteSetting/Listing.php @@ -36,7 +36,7 @@ class Listing extends Model\Listing\AbstractListing /** * @param WebsiteSetting[]|null $settings */ - public function setSettings(?array $settings) + public function setSettings(?array $settings): void { $this->settings = $settings; } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d603ad5dcfa..e3fa42ea528 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,25 +1,10 @@ parameters: ignoreErrors: - - - message: "#^Offset 'image' on array\\{\\} in empty\\(\\) does not exist\\.$#" - count: 1 - path: bundles/AdminBundle/src/GDPR/DataProvider/DataObjects.php - - - - message: "#^Offset 'object' on array\\{\\} in empty\\(\\) does not exist\\.$#" - count: 1 - path: bundles/AdminBundle/src/GDPR/DataProvider/DataObjects.php - - message: "#^Negated boolean expression is always false\\.$#" count: 3 path: bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php - - - message: "#^If condition is always false\\.$#" - count: 1 - path: bundles/CoreBundle/src/EventListener/Frontend/RoutingListener.php - - message: "#^Strict comparison using \\=\\=\\= between null and string will always evaluate to false\\.$#" count: 1 @@ -50,11 +35,6 @@ parameters: count: 1 path: bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/Findologic/NumberRangeSelection.php - - - message: "#^Result of \\|\\| is always true\\.$#" - count: 1 - path: bundles/EcommerceFrameworkBundle/src/FilterService/FilterType/SelectCategory.php - - message: "#^If condition is always true\\.$#" count: 1 diff --git a/phpstan-parameters.neon b/phpstan-parameters.neon index 27ef8eb1d88..9ff31ceee10 100644 --- a/phpstan-parameters.neon +++ b/phpstan-parameters.neon @@ -1,5 +1,5 @@ parameters: - level: 5 + level: 6 paths: - bundles @@ -23,3 +23,6 @@ parameters: universalObjectCratesClasses: - Pimcore\Config\Config - Pimcore\Templating\Model\ViewModel + + checkGenericClassInNonGenericObjectType: false + checkMissingIterableValueType: false diff --git a/tests/Unit/HttpKernel/BundleCollection/BundleCollectionTest.php b/tests/Unit/HttpKernel/BundleCollection/BundleCollectionTest.php index dc8dd796aca..3a05e37ac3a 100644 --- a/tests/Unit/HttpKernel/BundleCollection/BundleCollectionTest.php +++ b/tests/Unit/HttpKernel/BundleCollection/BundleCollectionTest.php @@ -321,7 +321,7 @@ class BundleD extends Bundle class BundleE extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->addBundle(new BundleF()); } @@ -333,7 +333,7 @@ class BundleF extends Bundle class BundleG extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->addBundle(new BundleH, 8); } @@ -341,7 +341,7 @@ public static function registerDependentBundles(BundleCollection $collection) class BundleH extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->addBundle(new BundleG, 5); } @@ -349,7 +349,7 @@ public static function registerDependentBundles(BundleCollection $collection) class BundleI extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->addBundle(new BundleA); $collection->addBundle(new BundleB); @@ -359,7 +359,7 @@ public static function registerDependentBundles(BundleCollection $collection) class BundleJ extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->addBundle(new BundleH(), 9); } diff --git a/tests/Unit/HttpKernel/BundleCollection/ItemTest.php b/tests/Unit/HttpKernel/BundleCollection/ItemTest.php index bd73bd7fa0e..bcec8949553 100644 --- a/tests/Unit/HttpKernel/BundleCollection/ItemTest.php +++ b/tests/Unit/HttpKernel/BundleCollection/ItemTest.php @@ -99,7 +99,7 @@ class ItemTestBundleB extends AbstractPimcoreBundle class ItemTestBundleC extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->add(new Item(new ItemTestBundleA())); } diff --git a/tests/Unit/HttpKernel/BundleCollection/LazyLoadedItemTest.php b/tests/Unit/HttpKernel/BundleCollection/LazyLoadedItemTest.php index dd869dd5895..e6692fc45ef 100644 --- a/tests/Unit/HttpKernel/BundleCollection/LazyLoadedItemTest.php +++ b/tests/Unit/HttpKernel/BundleCollection/LazyLoadedItemTest.php @@ -171,7 +171,7 @@ public static function getCounter(): int class LazyLoadedItemTestBundleC extends Bundle implements DependentBundleInterface { - public static function registerDependentBundles(BundleCollection $collection) + public static function registerDependentBundles(BundleCollection $collection): void { $collection->add(new LazyLoadedItem(LazyLoadedItemTestBundleA::class)); }