Skip to content

Commit 8594fcc

Browse files
author
roadiz-ci
committed
chore: bumped
1 parent 0440342 commit 8594fcc

18 files changed

Lines changed: 83 additions & 86 deletions

composer.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@
3030
"intervention/image": "^3.11",
3131
"league/flysystem": "^3.0",
3232
"monolog/monolog": "^3.9",
33-
"symfony/asset": "7.4.*",
34-
"symfony/console": "7.4.*",
35-
"symfony/event-dispatcher": "7.4.*",
33+
"symfony/asset": "7.3.*",
34+
"symfony/console": "7.3.*",
35+
"symfony/event-dispatcher": "7.3.*",
3636
"symfony/filesystem": ">=7.1",
37-
"symfony/finder": "7.4.*",
38-
"symfony/http-foundation": "7.4.*",
37+
"symfony/finder": "7.3.*",
38+
"symfony/http-foundation": "7.3.*",
3939
"symfony/http-client-contracts": "^3.5",
40-
"symfony/options-resolver": "7.4.*",
41-
"symfony/serializer": "7.4.*",
40+
"symfony/options-resolver": "7.3.*",
41+
"symfony/serializer": "7.3.*",
4242
"twig/twig": "^3.21"
4343
},
4444
"require-dev": {
4545
"api-platform/metadata": "^4.1.18",
4646
"doctrine/doctrine-bundle": "^2.8.1",
4747
"php-coveralls/php-coveralls": "^2.4",
48-
"phpstan/phpstan": "^2.1.36",
48+
"phpstan/phpstan": "^1.5.3",
4949
"phpstan/phpdoc-parser": "<2",
50-
"phpstan/phpstan-doctrine": "^2.0.13",
50+
"phpstan/phpstan-doctrine": "^1.3",
5151
"phpunit/phpunit": "^9.6",
52-
"symfony/http-client": "7.4.*",
53-
"symfony/process": "7.4.*"
52+
"symfony/http-client": "7.3.*",
53+
"symfony/process": "7.3.*"
5454
},
5555
"autoload": {
5656
"psr-4": {
@@ -70,8 +70,8 @@
7070
},
7171
"extra": {
7272
"branch-alias": {
73-
"dev-master": "2.7.x-dev",
74-
"dev-develop": "2.8.x-dev"
73+
"dev-master": "2.6.x-dev",
74+
"dev-develop": "2.7.x-dev"
7575
}
7676
}
7777
}

src/AbstractDocumentFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ public function getDocument(bool $allowEmpty = false, bool $allowDuplicates = fa
111111
}
112112

113113
if (null === $file) {
114-
$document = $this->createDocument();
115-
$this->persistDocument($document);
116-
117-
return $document;
114+
return null;
118115
}
119116

120117
if ($file instanceof UploadedFile && !$file->isValid()) {

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): static
55+
public function addDocument(DocumentInterface $document): self
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&EntityRepository
36+
protected function getDocumentRepository(): DocumentRepositoryInterface
3737
{
3838
$repository = $this->managerRegistry->getRepository(DocumentInterface::class);
3939
if (!$repository instanceof DocumentRepositoryInterface) {

src/DownscaleImageManager.php

Lines changed: 4 additions & 14 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 === $documentPath || null === $processedImage) {
44+
if (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 === $documentPath || null === $processedImage) {
72+
if (null === $processedImage) {
7373
return;
7474
}
7575

@@ -195,13 +195,8 @@ 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-
203198
$this->documentsStorage->write(
204-
$mountPath,
199+
$document->getMountPath(),
205200
$image->encode(new AutoEncoder(quality: 100))->toString()
206201
);
207202
}
@@ -252,10 +247,7 @@ private function updateDocumentFileHash(DocumentInterface $document): void
252247
*/
253248
private function overwriteExistingProcessedImage(DocumentInterface $document, ImageInterface $image): DocumentInterface
254249
{
255-
if (null === $mountPath = $document->getMountPath()) {
256-
return $document;
257-
}
258-
$this->documentsStorage->delete($mountPath);
250+
$this->documentsStorage->delete($document->getMountPath());
259251
$this->writeNewProcessedImage($document, $image);
260252
$this->updateDocumentImageSize($document, $image);
261253
$this->updateDocumentFileHash($document);
@@ -277,8 +269,6 @@ private function generateRawFilename(string $filename): string
277269

278270
/**
279271
* Check if a document is valid for processing.
280-
*
281-
* @phpstan-assert-if-true DocumentInterface $document
282272
*/
283273
private function isValidDocument(?DocumentInterface $document): bool
284274
{

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): static
371+
public function setKey(?string $key): self
372372
{
373373
$this->key = $key;
374374

src/MediaFinders/EmbedFinderFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(
2727

2828
public function createForPlatform(?string $mediaPlatform, ?string $embedId): ?EmbedFinderInterface
2929
{
30-
if (null !== $embedId && null !== $mediaPlatform && $this->supports($mediaPlatform)) {
30+
if (null !== $embedId && $this->supports($mediaPlatform)) {
3131
/**
3232
* @var class-string<EmbedFinderInterface> $class
3333
*/
@@ -44,6 +44,10 @@ public function createForUrl(?string $embedUrl): ?EmbedFinderInterface
4444
if (null === $embedUrl) {
4545
throw new \InvalidArgumentException('"embedUrl" is required');
4646
}
47+
// Throws a BadRequestHttpException if the embedUrl is not a string
48+
if (!is_string($embedUrl)) {
49+
throw new \InvalidArgumentException('"embedUrl" must be a string');
50+
}
4751
// Throws a BadRequestHttpException if the embedUrl is not a valid URL
4852
if (!filter_var($embedUrl, FILTER_VALIDATE_URL)) {
4953
throw new \InvalidArgumentException('"embedUrl" is not a valid URL');

src/Models/BaseDocumentTrait.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,8 @@ public function getMountPath(): ?string
174174
Serializer\SerializedName('type'),]
175175
public function getShortType(): string
176176
{
177-
$mimeType = (string) $this->getMimeType();
178-
if ('' !== $mimeType && isset(static::$mimeToIcon[$mimeType])) {
179-
return static::$mimeToIcon[$mimeType];
177+
if (null !== $this->getMimeType() && isset(static::$mimeToIcon[$this->getMimeType()])) {
178+
return static::$mimeToIcon[$this->getMimeType()];
180179
}
181180

182181
return 'unknown';
@@ -275,9 +274,6 @@ public function getAlternativeText(): ?string
275274

276275
/**
277276
* Return false if no local file is linked to document. i.e no filename, no folder.
278-
*
279-
* @phpstan-assert-if-true non-empty-string $this->getMountPath()
280-
* @phpstan-assert-if-true non-empty-string $this->getRelativePath()
281277
*/
282278
#[Serializer\Ignore()]
283279
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): static;
14+
public function setDocument(DocumentInterface $document): self;
1515

1616
public function getImageCropAlignment(): ?string;
1717

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

2323
public function getHotspot(): ?array;
2424

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

src/Models/ContextualizedDocumentTrait.php

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

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

@@ -62,10 +59,7 @@ public function getImageCropAlignment(): ?string
6259
return $this->imageCropAlignment;
6360
}
6461

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

@@ -77,10 +71,7 @@ public function getHotspot(): ?array
7771
return $this->hotspot;
7872
}
7973

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

0 commit comments

Comments
 (0)