Skip to content

Commit c8cec80

Browse files
author
roadiz-ci
committed
feat!: upgrade Symfony dependencies to version 7.4.*, remove obsolete roadiz/font-bundle (#327)
1 parent 22f4867 commit c8cec80

11 files changed

Lines changed: 45 additions & 45 deletions

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
"intervention/image": "^3.11",
3131
"league/flysystem": "^3.0",
3232
"monolog/monolog": "^3.9",
33-
"symfony/asset": "7.3.*",
34-
"symfony/console": "7.3.*",
35-
"symfony/event-dispatcher": "7.3.*",
33+
"symfony/asset": "7.4.*",
34+
"symfony/console": "7.4.*",
35+
"symfony/event-dispatcher": "7.4.*",
3636
"symfony/filesystem": ">=7.1",
37-
"symfony/finder": "7.3.*",
38-
"symfony/http-foundation": "7.3.*",
37+
"symfony/finder": "7.4.*",
38+
"symfony/http-foundation": "7.4.*",
3939
"symfony/http-client-contracts": "^3.5",
40-
"symfony/options-resolver": "7.3.*",
41-
"symfony/serializer": "7.3.*",
40+
"symfony/options-resolver": "7.4.*",
41+
"symfony/serializer": "7.4.*",
4242
"twig/twig": "^3.21"
4343
},
4444
"require-dev": {
@@ -49,8 +49,8 @@
4949
"phpstan/phpdoc-parser": "<2",
5050
"phpstan/phpstan-doctrine": "^1.3",
5151
"phpunit/phpunit": "^9.6",
52-
"symfony/http-client": "7.3.*",
53-
"symfony/process": "7.3.*"
52+
"symfony/http-client": "7.4.*",
53+
"symfony/process": "7.4.*"
5454
},
5555
"autoload": {
5656
"psr-4": {

src/ArrayDocumentFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function findOneByHashAndAlgorithm(string $hash, string $algorithm): ?Doc
5252
/**
5353
* @return $this
5454
*/
55-
public function addDocument(DocumentInterface $document): self
55+
public function addDocument(DocumentInterface $document): static
5656
{
5757
if (!$this->documents->contains($document)) {
5858
$this->documents->add($document);

src/Console/AbstractDocumentCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function getManager(): ObjectManager
3333
/**
3434
* @return DocumentRepositoryInterface<DocumentInterface>&EntityRepository<DocumentInterface>
3535
*/
36-
protected function getDocumentRepository(): DocumentRepositoryInterface
36+
protected function getDocumentRepository(): DocumentRepositoryInterface&EntityRepository
3737
{
3838
$repository = $this->managerRegistry->getRepository(DocumentInterface::class);
3939
if (!$repository instanceof DocumentRepositoryInterface) {

src/DownscaleImageManager.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function processAndOverrideDocument(?DocumentInterface $document = null):
4141
$documentPath = $document->getMountPath();
4242
$processedImage = $this->getProcessedImage($documentPath);
4343

44-
if (null === $processedImage) {
44+
if (null === $documentPath || null === $processedImage) {
4545
return;
4646
}
4747

@@ -69,7 +69,7 @@ public function processDocumentFromExistingRaw(?DocumentInterface $document = nu
6969

7070
$processedImage = $this->getProcessedImage($documentPath);
7171

72-
if (null === $processedImage) {
72+
if (null === $documentPath || null === $processedImage) {
7373
return;
7474
}
7575

@@ -195,8 +195,13 @@ private function storeNewProcessedImage(DocumentInterface $document, ImageInterf
195195
*/
196196
private function writeNewProcessedImage(DocumentInterface $document, ImageInterface $image): void
197197
{
198+
$mountPath = $document->getMountPath();
199+
if (null === $mountPath) {
200+
return;
201+
}
202+
198203
$this->documentsStorage->write(
199-
$document->getMountPath(),
204+
$mountPath,
200205
$image->encode(new AutoEncoder(quality: 100))->toString()
201206
);
202207
}
@@ -247,7 +252,10 @@ private function updateDocumentFileHash(DocumentInterface $document): void
247252
*/
248253
private function overwriteExistingProcessedImage(DocumentInterface $document, ImageInterface $image): DocumentInterface
249254
{
250-
$this->documentsStorage->delete($document->getMountPath());
255+
if (null === $mountPath = $document->getMountPath()) {
256+
return $document;
257+
}
258+
$this->documentsStorage->delete($mountPath);
251259
$this->writeNewProcessedImage($document, $image);
252260
$this->updateDocumentImageSize($document, $image);
253261
$this->updateDocumentFileHash($document);
@@ -269,6 +277,8 @@ private function generateRawFilename(string $filename): string
269277

270278
/**
271279
* Check if a document is valid for processing.
280+
*
281+
* @phpstan-assert-if-true DocumentInterface $document
272282
*/
273283
private function isValidDocument(?DocumentInterface $document): bool
274284
{

src/MediaFinders/AbstractEmbedFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function getKey(): ?string
368368
*
369369
* @return $this
370370
*/
371-
public function setKey(?string $key): self
371+
public function setKey(?string $key): static
372372
{
373373
$this->key = $key;
374374

src/Models/BaseDocumentTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ public function getAlternativeText(): ?string
284284

285285
/**
286286
* Return false if no local file is linked to document. i.e no filename, no folder.
287+
*
288+
* @phpstan-assert-if-true non-empty-string $this->getMountPath()
289+
* @phpstan-assert-if-true non-empty-string $this->getRelativePath()
287290
*/
288291
#[Serializer\Ignore()]
289292
public function isLocal(): bool

src/Models/ContextualizedDocumentInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ public function getDocument(): DocumentInterface;
1111
/**
1212
* @return $this
1313
*/
14-
public function setDocument(DocumentInterface $document): self;
14+
public function setDocument(DocumentInterface $document): static;
1515

1616
public function getImageCropAlignment(): ?string;
1717

1818
/**
1919
* @return $this
2020
*/
21-
public function setImageCropAlignment(?string $imageCropAlignment): self;
21+
public function setImageCropAlignment(?string $imageCropAlignment): static;
2222

2323
public function getHotspot(): ?array;
2424

2525
/**
2626
* @return $this
2727
*/
28-
public function setHotspot(?array $hotspot): self;
28+
public function setHotspot(?array $hotspot): static;
2929
}

src/Models/ContextualizedDocumentTrait.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public function getDocument(): DocumentInterface
4747
return $this->document;
4848
}
4949

50-
public function setDocument(DocumentInterface $document): self
50+
/**
51+
* @return $this
52+
*/
53+
public function setDocument(DocumentInterface $document): static
5154
{
5255
$this->document = $document;
5356

@@ -59,7 +62,10 @@ public function getImageCropAlignment(): ?string
5962
return $this->imageCropAlignment;
6063
}
6164

62-
public function setImageCropAlignment(?string $imageCropAlignment): self
65+
/**
66+
* @return $this
67+
*/
68+
public function setImageCropAlignment(?string $imageCropAlignment): static
6369
{
6470
$this->imageCropAlignment = $imageCropAlignment;
6571

@@ -71,7 +77,10 @@ public function getHotspot(): ?array
7177
return $this->hotspot;
7278
}
7379

74-
public function setHotspot(?array $hotspot): self
80+
/**
81+
* @return $this
82+
*/
83+
public function setHotspot(?array $hotspot): static
7584
{
7685
$this->hotspot = $hotspot;
7786

src/Models/FileAwareInterface.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ public function getPrivateFilesPath(): string;
2929
*/
3030
public function getPrivateFilesBasePath(): string;
3131

32-
/**
33-
* @return string Return absolute path to private font files folder. Path must be protected.
34-
*/
35-
public function getFontsFilesPath(): string;
36-
37-
/**
38-
* @return string return relative path to private font files folder
39-
*/
40-
public function getFontsFilesBasePath(): string;
41-
4232
/**
4333
* @return string return absolute path to public images cache
4434
*/

src/Models/SimpleFileAware.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ public function getPrivateFilesBasePath(): string
3737
return '/private';
3838
}
3939

40-
#[\Override]
41-
public function getFontsFilesPath(): string
42-
{
43-
return $this->basePath.$this->getPrivateFilesBasePath();
44-
}
45-
46-
#[\Override]
47-
public function getFontsFilesBasePath(): string
48-
{
49-
return '/fonts';
50-
}
51-
5240
#[\Override]
5341
public function getPublicCachePath(): string
5442
{

0 commit comments

Comments
 (0)