Skip to content

Commit c4ca199

Browse files
authored
[Task]: Upgrade dependencies for 2026 (#1745)
* upgrade dependencies for 2026 * Apply php-cs-fixer changes * fix: sonar * Apply php-cs-fixer changes * [Widgets] PQL filter not working correct (#1744) * use new pql filter for tree * update dependencies * Apply php-cs-fixer changes * fix: rebase * fix: PHP Stan
1 parent 05a1552 commit c4ca199

16 files changed

Lines changed: 55 additions & 146 deletions

File tree

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"prefer-stable": true,
1818
"minimum-stability": "dev",
1919
"require": {
20-
"php": "~8.3.0 || ~8.4.0",
20+
"php": "~8.4.0 || ~8.5.0",
2121
"league/csv": "^9.27",
22-
"nesbot/carbon": "^3.8.4",
23-
"pimcore/static-resolver-bundle": "^3.5.0 ",
24-
"pimcore/generic-data-index-bundle": "^2.5.0",
25-
"pimcore/pimcore": "^12.3",
26-
"zircote/swagger-php": "^4.8 || ^5.0",
22+
"nesbot/carbon": "^3.10.0",
23+
"pimcore/static-resolver-bundle": "^2026.1",
24+
"pimcore/generic-data-index-bundle": "^2026.1",
25+
"pimcore/pimcore": "^2026.1",
26+
"zircote/swagger-php": "^5.0",
2727
"ext-zip": "*",
2828
"symfony/mercure": "^0.6.5",
2929
"symfony/mercure-bundle": "^0.3.9",
@@ -34,9 +34,9 @@
3434
"ext-filter": "*",
3535
"php-http/discovery": "^1.20",
3636
"psr/http-factory": "^1.0",
37-
"symfony/psr-http-message-bridge": "^6.3 || ^7.0"
37+
"symfony/psr-http-message-bridge": "^7.4"
3838
},
39-
"require-dev": {
39+
"require-dev": {
4040
"roave/security-advisories": "dev-latest",
4141
"codeception/codeception": "^5.3",
4242
"codeception/stub": "^4.1.4",
@@ -66,12 +66,12 @@
6666
},
6767
"extra": {
6868
"branch-alias": {
69-
"dev-2025.4": "1.x-dev"
69+
"dev-2026.x": "2026.1.x-dev"
7070
},
7171
"pimcore": {
7272
"bundles": [
7373
"Pimcore\\Bundle\\StudioBackendBundle\\PimcoreStudioBackendBundle"
7474
]
7575
}
7676
}
77-
}
77+
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.0'
22
services:
33
php-studio-backend-bundle:
4-
image: pimcore/pimcore:php8.3-debug-latest
4+
image: pimcore/pimcore:php8.4-debug-latest
55
environment:
66
PHP_IDE_CONFIG: serverName=localhost
77
working_dir: /var/cli

src/Asset/Controller/Upload/AddController.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Pimcore\Bundle\StudioBackendBundle\Asset\Service\UploadServiceInterface;
2222
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
2323
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\DatabaseException;
24-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\EnvironmentException;
2524
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ForbiddenException;
2625
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
2726
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\UserNotFoundException;
@@ -37,8 +36,8 @@
3736
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
3837
use Symfony\Component\HttpFoundation\File\UploadedFile;
3938
use Symfony\Component\HttpFoundation\JsonResponse;
40-
use Symfony\Component\HttpFoundation\Request;
4139
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
40+
use Symfony\Component\HttpKernel\Attribute\MapUploadedFile;
4241
use Symfony\Component\Routing\Attribute\Route;
4342
use Symfony\Component\Security\Http\Attribute\IsGranted;
4443
use Symfony\Component\Serializer\SerializerInterface;
@@ -58,7 +57,6 @@ public function __construct(
5857

5958
/**
6059
* @throws DatabaseException
61-
* @throws EnvironmentException
6260
* @throws ForbiddenException
6361
* @throws NotFoundException
6462
* @throws UserNotFoundException
@@ -90,14 +88,9 @@ public function __construct(
9088
])]
9189
public function addAsset(
9290
int $parentId,
93-
// TODO: Symfony 7.1 change to https://symfony.com/blog/new-in-symfony-7-1-mapuploadedfile-attribute
94-
Request $request,
91+
#[MapUploadedFile] UploadedFile $file,
9592
#[MapRequestPayload] ?UploadAssetParameter $parameter = null,
9693
): JsonResponse {
97-
$file = $request->files->get('file');
98-
if (!$file instanceof UploadedFile) {
99-
throw new EnvironmentException('Invalid file found in the request');
100-
}
10194

10295
return $this->jsonResponse(
10396
[

src/Asset/Controller/Upload/ReplaceController.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
use Pimcore\Bundle\StudioBackendBundle\Asset\Service\UploadServiceInterface;
1919
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
2020
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\DatabaseException;
21-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementStreamResourceNotFoundException;
22-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\EnvironmentException;
2321
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ForbiddenException;
2422
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
2523
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\UserNotFoundException;
@@ -35,7 +33,7 @@
3533
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
3634
use Symfony\Component\HttpFoundation\File\UploadedFile;
3735
use Symfony\Component\HttpFoundation\JsonResponse;
38-
use Symfony\Component\HttpFoundation\Request;
36+
use Symfony\Component\HttpKernel\Attribute\MapUploadedFile;
3937
use Symfony\Component\Routing\Attribute\Route;
4038
use Symfony\Component\Security\Http\Attribute\IsGranted;
4139
use Symfony\Component\Serializer\SerializerInterface;
@@ -55,7 +53,6 @@ public function __construct(
5553

5654
/**
5755
* @throws DatabaseException
58-
* @throws EnvironmentException
5956
* @throws ForbiddenException
6057
* @throws NotFoundException
6158
* @throws UserNotFoundException
@@ -93,15 +90,9 @@ public function __construct(
9390
])]
9491
public function replaceAsset(
9592
int $id,
96-
// TODO: Symfony 7.1 change to https://symfony.com/blog/new-in-symfony-7-1-mapuploadedfile-attribute
97-
Request $request
93+
#[MapUploadedFile] UploadedFile $file,
9894
): JsonResponse {
9995

100-
$file = $request->files->get('file');
101-
if (!$file instanceof UploadedFile) {
102-
throw new ElementStreamResourceNotFoundException(0, 'File');
103-
}
104-
10596
return new JsonResponse(
10697
[
10798
'data' => $this->uploadService->replaceAssetBinary(

src/Asset/Controller/Upload/ZipController.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use OpenApi\Attributes\Property;
1818
use Pimcore\Bundle\StudioBackendBundle\Asset\Service\ExecutionEngine\ZipServiceInterface;
1919
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
20-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\EnvironmentException;
2120
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ForbiddenException;
2221
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
2322
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\UserNotFoundException;
@@ -33,7 +32,7 @@
3332
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
3433
use Symfony\Component\HttpFoundation\File\UploadedFile;
3534
use Symfony\Component\HttpFoundation\JsonResponse;
36-
use Symfony\Component\HttpFoundation\Request;
35+
use Symfony\Component\HttpKernel\Attribute\MapUploadedFile;
3736
use Symfony\Component\Routing\Attribute\Route;
3837
use Symfony\Component\Security\Http\Attribute\IsGranted;
3938
use Symfony\Component\Serializer\SerializerInterface;
@@ -43,8 +42,6 @@
4342
*/
4443
final class ZipController extends AbstractApiController
4544
{
46-
private const FILE_KEY = 'zipFile';
47-
4845
public function __construct(
4946
private readonly SecurityServiceInterface $securityService,
5047
private readonly ZipServiceInterface $zipService,
@@ -54,7 +51,6 @@ public function __construct(
5451
}
5552

5653
/**
57-
* @throws EnvironmentException
5854
* @throws ForbiddenException
5955
* @throws NotFoundException
6056
* @throws UserNotFoundException
@@ -76,13 +72,13 @@ public function __construct(
7672
#[MultipartFormDataRequestBody(
7773
[
7874
new Property(
79-
property: self::FILE_KEY,
75+
property: 'zipFile',
8076
description: 'Zip file to upload',
8177
type: 'string',
8278
format: 'binary'
8379
),
8480
],
85-
[self::FILE_KEY]
81+
['zipFile']
8682
)]
8783
#[DefaultResponses([
8884
HttpResponseCodes::FORBIDDEN,
@@ -91,19 +87,14 @@ public function __construct(
9187
])]
9288
public function addAssetsZip(
9389
int $parentId,
94-
// TODO: Symfony 7.1 change to https://symfony.com/blog/new-in-symfony-7-1-mapuploadedfile-attribute
95-
Request $request
90+
#[MapUploadedFile(name: 'zipFile')] UploadedFile $zipFile,
9691
): JsonResponse {
97-
$file = $request->files->get(self::FILE_KEY);
98-
if (!$file instanceof UploadedFile) {
99-
throw new EnvironmentException('Invalid zip file found in the request');
100-
}
10192

10293
return $this->jsonResponse(
10394
[
10495
'jobRunId' => $this->zipService->uploadZipAssets(
10596
$this->securityService->getCurrentUser(),
106-
$file,
97+
$zipFile,
10798
$parentId
10899
),
109100
]

src/Asset/Service/DocumentService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
2525
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseHeaders;
2626
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\StreamedResponseTrait;
27-
use Pimcore\Document\Adapter;
27+
use Pimcore\Document\AdapterInterface;
2828
use Pimcore\Messenger\AssetUpdateTasksMessage;
2929
use Pimcore\Model\Asset\Document;
3030
use Pimcore\Model\Asset\Enum\PdfScanStatus;
@@ -105,7 +105,7 @@ public function validatePdfScanStatus(
105105
private function getStreamFromDocument(Document $asset): StreamedResponse
106106
{
107107
$adapter = $this->documentResolver->getDefaultAdapter();
108-
if (!$adapter) {
108+
if (!$adapter instanceof AdapterInterface) {
109109
throw new EnvironmentException('Document adapter is not available.');
110110
}
111111

@@ -146,7 +146,7 @@ private function validateAssetDocument(Document $asset): void
146146
* @throws ElementStreamResourceNotFoundException
147147
*/
148148
private function getPdfStreamFromAdapter(
149-
Adapter $adapter,
149+
AdapterInterface $adapter,
150150
Document $asset
151151
): StreamedResponse {
152152
try {

src/Bundle/Seo/Controller/Redirect/ImportController.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Pimcore\Bundle\StudioBackendBundle\Bundle\Seo\Schema\RedirectImportStats;
2020
use Pimcore\Bundle\StudioBackendBundle\Bundle\Seo\Service\CsvServiceInterface;
2121
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
22-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementStreamResourceNotFoundException;
2322
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\EnvironmentException;
2423
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Request\MultipartFormDataRequestBody;
2524
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
@@ -29,7 +28,7 @@
2928
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
3029
use Symfony\Component\HttpFoundation\File\UploadedFile;
3130
use Symfony\Component\HttpFoundation\JsonResponse;
32-
use Symfony\Component\HttpFoundation\Request;
31+
use Symfony\Component\HttpKernel\Attribute\MapUploadedFile;
3332
use Symfony\Component\Routing\Attribute\Route;
3433
use Symfony\Component\Security\Http\Attribute\IsGranted;
3534
use Symfony\Component\Serializer\SerializerInterface;
@@ -49,7 +48,7 @@ public function __construct(
4948
}
5049

5150
/**
52-
* @throws ElementStreamResourceNotFoundException|EnvironmentException
51+
* @throws EnvironmentException
5352
*/
5453
#[Route(self::ROUTE, name: 'pimcore_studio_api_bundle_seo_redirects_import', methods: ['POST'])]
5554
#[IsGranted(UserPermissions::REDIRECTS->value)]
@@ -80,13 +79,8 @@ public function __construct(
8079
HttpResponseCodes::UNAUTHORIZED,
8180
HttpResponseCodes::NOT_FOUND,
8281
])]
83-
public function importRedirects(Request $request): JsonResponse
82+
public function importRedirects(#[MapUploadedFile] UploadedFile $file): JsonResponse
8483
{
85-
$file = $request->files->get('file');
86-
if (!$file instanceof UploadedFile) {
87-
throw new ElementStreamResourceNotFoundException(0, 'File');
88-
}
89-
9084
return $this->jsonResponse($this->csvService->importRedirects($file->getRealPath()));
9185
}
9286
}

src/Class/Controller/BulkImport/PrepareImportController.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\BulkImport\BulkImportPrepareResponse;
2020
use Pimcore\Bundle\StudioBackendBundle\Class\Service\BulkImport\BulkImportServiceInterface;
2121
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
22-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\EnvironmentException;
23-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\InvalidArgumentException as ApiInvalidArgumentException;
2422
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Request\MultipartFormDataRequestBody;
2523
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
2624
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse;
@@ -29,7 +27,7 @@
2927
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
3028
use Symfony\Component\HttpFoundation\File\UploadedFile;
3129
use Symfony\Component\HttpFoundation\JsonResponse;
32-
use Symfony\Component\HttpFoundation\Request;
30+
use Symfony\Component\HttpKernel\Attribute\MapUploadedFile;
3331
use Symfony\Component\Routing\Attribute\Route;
3432
use Symfony\Component\Security\Http\Attribute\IsGranted;
3533
use Symfony\Component\Serializer\SerializerInterface;
@@ -48,10 +46,6 @@ public function __construct(
4846
parent::__construct($serializer);
4947
}
5048

51-
/**
52-
* @throws EnvironmentException
53-
* @throws ApiInvalidArgumentException
54-
*/
5549
#[Route(
5650
path: self::ROUTE,
5751
name: 'pimcore_studio_api_class_bulk_import_prepare',
@@ -85,15 +79,8 @@ public function __construct(
8579
HttpResponseCodes::UNAUTHORIZED,
8680
HttpResponseCodes::UNPROCESSABLE_CONTENT,
8781
])]
88-
public function prepareImport(Request $request): JsonResponse
82+
public function prepareImport(#[MapUploadedFile] UploadedFile $file): JsonResponse
8983
{
90-
$file = $request->files->get('file');
91-
if (!$file instanceof UploadedFile) {
92-
throw new ApiInvalidArgumentException(
93-
'Invalid file found in the request'
94-
);
95-
}
96-
9784
return $this->jsonResponse(
9885
$this->bulkImportService->prepareImport($file)
9986
);

src/Class/Controller/CustomLayout/ImportController.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\CustomLayout\CustomLayout;
2020
use Pimcore\Bundle\StudioBackendBundle\Class\Service\CustomLayoutServiceInterface;
2121
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
22-
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\EnvironmentException;
2322
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\InvalidArgumentException;
2423
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
2524
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotWriteableException;
@@ -33,7 +32,7 @@
3332
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
3433
use Symfony\Component\HttpFoundation\File\UploadedFile;
3534
use Symfony\Component\HttpFoundation\JsonResponse;
36-
use Symfony\Component\HttpFoundation\Request;
35+
use Symfony\Component\HttpKernel\Attribute\MapUploadedFile;
3736
use Symfony\Component\Routing\Attribute\Route;
3837
use Symfony\Component\Security\Http\Attribute\IsGranted;
3938
use Symfony\Component\Serializer\SerializerInterface;
@@ -52,7 +51,6 @@ public function __construct(
5251

5352
/**
5453
* @throws NotFoundException
55-
* @throws EnvironmentException
5654
* @throws NotWriteableException
5755
* @throws JsonEncodingException
5856
* @throws InvalidArgumentException
@@ -97,13 +95,8 @@ public function __construct(
9795
HttpResponseCodes::NOT_FOUND,
9896
HttpResponseCodes::BAD_REQUEST,
9997
])]
100-
public function importCustomLayout(string $customLayoutId, Request $request): JsonResponse
98+
public function importCustomLayout(string $customLayoutId, #[MapUploadedFile] UploadedFile $file): JsonResponse
10199
{
102-
$file = $request->files->get('file');
103-
if (!$file instanceof UploadedFile) {
104-
throw new EnvironmentException('Invalid file found in the request');
105-
}
106-
107100
return $this->jsonResponse(
108101
$this->customLayoutService->importCustomLayoutActionFromJson(
109102
$customLayoutId,

0 commit comments

Comments
 (0)