Skip to content

Commit 6ef1e67

Browse files
committed
Fixed PHPStan on 7.4
1 parent fca1340 commit 6ef1e67

File tree

4 files changed

+55
-164
lines changed

4 files changed

+55
-164
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -8436,12 +8436,6 @@ parameters:
84368436
count: 1
84378437
path: src/contracts/Repository/Values/Content/Query/Criterion/FullText.php
84388438

8439-
-
8440-
message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\IsFieldEmpty\:\:__construct\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
8441-
identifier: throws.unusedType
8442-
count: 1
8443-
path: src/contracts/Repository/Values/Content/Query/Criterion/IsFieldEmpty.php
8444-
84458439
-
84468440
message: '#^Call to function is_bool\(\) with bool will always evaluate to true\.$#'
84478441
identifier: function.alreadyNarrowedType
@@ -8496,12 +8490,6 @@ parameters:
84968490
count: 1
84978491
path: src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php
84988492

8499-
-
8500-
message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\LogicalNot\:\:__construct\(\) has InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
8501-
identifier: throws.unusedType
8502-
count: 1
8503-
path: src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php
8504-
85058493
-
85068494
message: '#^PHPDoc tag @param references unknown parameter\: \$criteria$#'
85078495
identifier: parameter.notFound
@@ -8874,12 +8862,6 @@ parameters:
88748862
count: 1
88758863
path: src/contracts/Repository/Values/ObjectState/ObjectStateCreateStruct.php
88768864

8877-
-
8878-
message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\URL\\Query\\Criterion\\LogicalNot\:\:__construct\(\) has InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
8879-
identifier: throws.unusedType
8880-
count: 1
8881-
path: src/contracts/Repository/Values/URL/Query/Criterion/LogicalNot.php
8882-
88838865
-
88848866
message: '#^Class Ibexa\\Contracts\\Core\\Repository\\Values\\URL\\SearchResult implements generic interface IteratorAggregate but does not specify its types\: TKey, TValue$#'
88858867
identifier: missingType.generics
@@ -10956,12 +10938,6 @@ parameters:
1095610938
count: 1
1095710939
path: src/lib/FieldType/FieldType.php
1095810940

10959-
-
10960-
message: '#^Method Ibexa\\Core\\FieldType\\FieldType\:\:validate\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
10961-
identifier: throws.unusedType
10962-
count: 1
10963-
path: src/lib/FieldType/FieldType.php
10964-
1096510941
-
1096610942
message: '#^Method Ibexa\\Core\\FieldType\\FieldType\:\:validatorConfigurationFromHash\(\) has parameter \$validatorConfigurationHash with no value type specified in iterable type array\.$#'
1096710943
identifier: missingType.iterableValue
@@ -11910,12 +11886,6 @@ parameters:
1191011886
count: 1
1191111887
path: src/lib/FieldType/Null/Type.php
1191211888

11913-
-
11914-
message: '#^Method Ibexa\\Core\\FieldType\\Null\\Type\:\:checkValueStructure\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
11915-
identifier: throws.unusedType
11916-
count: 1
11917-
path: src/lib/FieldType/Null/Type.php
11918-
1191911889
-
1192011890
message: '#^Method Ibexa\\Core\\FieldType\\Null\\Type\:\:checkValueStructure\(\) has no return type specified\.$#'
1192111891
identifier: missingType.return
@@ -12348,12 +12318,6 @@ parameters:
1234812318
count: 1
1234912319
path: src/lib/FieldType/User/Type.php
1235012320

12351-
-
12352-
message: '#^Method Ibexa\\Core\\FieldType\\User\\Type\:\:checkValueStructure\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
12353-
identifier: throws.unusedType
12354-
count: 1
12355-
path: src/lib/FieldType/User/Type.php
12356-
1235712321
-
1235812322
message: '#^Method Ibexa\\Core\\FieldType\\User\\Type\:\:checkValueStructure\(\) has no return type specified\.$#'
1235912323
identifier: missingType.return
@@ -13296,12 +13260,6 @@ parameters:
1329613260
count: 1
1329713261
path: src/lib/Limitation/BlockingLimitationType.php
1329813262

13299-
-
13300-
message: '#^Method Ibexa\\Core\\Limitation\\BlockingLimitationType\:\:evaluate\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\BadStateException in PHPDoc @throws tag but it''s not thrown\.$#'
13301-
identifier: throws.unusedType
13302-
count: 1
13303-
path: src/lib/Limitation/BlockingLimitationType.php
13304-
1330513263
-
1330613264
message: '#^Return type \(void\) of method Ibexa\\Core\\Limitation\\ChangeOwnerLimitationType\:\:valueSchema\(\) should be compatible with return type \(array\<mixed\>\|int\) of method Ibexa\\Contracts\\Core\\Limitation\\Type\:\:valueSchema\(\)$#'
1330713265
identifier: method.childReturnType
@@ -13404,12 +13362,6 @@ parameters:
1340413362
count: 1
1340513363
path: src/lib/Limitation/NewSectionLimitationType.php
1340613364

13407-
-
13408-
message: '#^Method Ibexa\\Core\\Limitation\\NewSectionLimitationType\:\:evaluate\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\BadStateException in PHPDoc @throws tag but it''s not thrown\.$#'
13409-
identifier: throws.unusedType
13410-
count: 1
13411-
path: src/lib/Limitation/NewSectionLimitationType.php
13412-
1341313365
-
1341413366
message: '#^Method Ibexa\\Core\\Limitation\\NewSectionLimitationType\:\:getCriterionByTarget\(\) has parameter \$targets with no value type specified in iterable type array\.$#'
1341513367
identifier: missingType.iterableValue
@@ -15252,12 +15204,6 @@ parameters:
1525215204
count: 1
1525315205
path: src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php
1525415206

15255-
-
15256-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Matcher\\URIElement\:\:getURIElements\(\) has LogicException in PHPDoc @throws tag but it''s not thrown\.$#'
15257-
identifier: throws.unusedType
15258-
count: 1
15259-
path: src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php
15260-
1526115207
-
1526215208
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Matcher\\URIElement\:\:getURIElements\(\) return type has no value type specified in iterable type array\.$#'
1526315209
identifier: missingType.iterableValue
@@ -15384,12 +15330,6 @@ parameters:
1538415330
count: 1
1538515331
path: src/lib/MVC/Symfony/SiteAccess/Router.php
1538615332

15387-
-
15388-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Router\:\:match\(\) has Ibexa\\Core\\MVC\\Exception\\InvalidSiteAccessException in PHPDoc @throws tag but it''s not thrown\.$#'
15389-
identifier: throws.unusedType
15390-
count: 1
15391-
path: src/lib/MVC/Symfony/SiteAccess/Router.php
15392-
1539315333
-
1539415334
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Router\:\:matchByName\(\) should return Ibexa\\Core\\MVC\\Symfony\\SiteAccess\|null but returns object\.$#'
1539515335
identifier: return.type
@@ -19170,12 +19110,6 @@ parameters:
1917019110
count: 1
1917119111
path: src/lib/Persistence/Legacy/Content/Gateway.php
1917219112

19173-
-
19174-
message: '#^Argument of an invalid type DOMNodeList\<DOMNode\>\|false supplied for foreach, only iterables are supported\.$#'
19175-
identifier: foreach.nonIterable
19176-
count: 1
19177-
path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php
19178-
1917919113
-
1918019114
message: '#^Cannot call method fetch\(\) on Doctrine\\DBAL\\ForwardCompatibility\\Result\|int\|string\.$#'
1918119115
identifier: method.nonObject
@@ -19188,12 +19122,6 @@ parameters:
1918819122
count: 16
1918919123
path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php
1919019124

19191-
-
19192-
message: '#^Cannot call method removeChild\(\) on DOMNode\|null\.$#'
19193-
identifier: method.nonObject
19194-
count: 1
19195-
path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php
19196-
1919719125
-
1919819126
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Gateway\\DoctrineDatabase\:\:deleteTranslationFromContentNames\(\) has no return type specified\.$#'
1919919127
identifier: missingType.return
@@ -20898,12 +20826,6 @@ parameters:
2089820826
count: 1
2089920827
path: src/lib/Persistence/Legacy/Content/Type/Handler.php
2090020828

20901-
-
20902-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Handler\:\:link\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\BadStateException in PHPDoc @throws tag but it''s not thrown\.$#'
20903-
identifier: throws.unusedType
20904-
count: 1
20905-
path: src/lib/Persistence/Legacy/Content/Type/Handler.php
20906-
2090720829
-
2090820830
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Handler\:\:link\(\) has no return type specified\.$#'
2090920831
identifier: missingType.return
@@ -61908,12 +61830,6 @@ parameters:
6190861830
count: 1
6190961831
path: tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php
6191061832

61911-
-
61912-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
61913-
identifier: throws.unusedType
61914-
count: 1
61915-
path: tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php
61916-
6191761833
-
6191861834
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Gateway\\DoctrineDatabaseTest\:\:insertRelationFixture\(\) has no return type specified\.$#'
6191961835
identifier: missingType.return
@@ -62298,12 +62214,6 @@ parameters:
6229862214
count: 1
6229962215
path: tests/lib/Persistence/Legacy/Content/Language/CachingLanguageHandlerTest.php
6230062216

62301-
-
62302-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
62303-
identifier: throws.unusedType
62304-
count: 1
62305-
path: tests/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabaseTest.php
62306-
6230762217
-
6230862218
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\Gateway\\DoctrineDatabaseTest\:\:testDeleteLanguage\(\) has no return type specified\.$#'
6230962219
identifier: missingType.return
@@ -63636,12 +63546,6 @@ parameters:
6363663546
count: 1
6363763547
path: tests/lib/Persistence/Legacy/Content/MapperTest.php
6363863548

63639-
-
63640-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\ObjectState\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
63641-
identifier: throws.unusedType
63642-
count: 1
63643-
path: tests/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabaseTest.php
63644-
6364563549
-
6364663550
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\ObjectState\\Gateway\\DoctrineDatabaseTest\:\:testDeleteObjectState\(\) has no return type specified\.$#'
6364763551
identifier: missingType.return
@@ -63978,12 +63882,6 @@ parameters:
6397863882
count: 1
6397963883
path: tests/lib/Persistence/Legacy/Content/ObjectState/ObjectStateHandlerTest.php
6398063884

63981-
-
63982-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Section\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
63983-
identifier: throws.unusedType
63984-
count: 1
63985-
path: tests/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabaseTest.php
63986-
6398763885
-
6398863886
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Section\\Gateway\\DoctrineDatabaseTest\:\:testAssignSectionToContent\(\) has no return type specified\.$#'
6398963887
identifier: missingType.return
@@ -64728,12 +64626,6 @@ parameters:
6472864626
count: 2
6472964627
path: tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php
6473064628

64731-
-
64732-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
64733-
identifier: throws.unusedType
64734-
count: 1
64735-
path: tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php
64736-
6473764629
-
6473864630
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\DoctrineDatabaseTest\:\:getTypeCreationContentClassNameExpectations\(\) should return array\<array\<string\>\> but returns array\<int, list\<list\<int\|string\>\|string\>\>\.$#'
6473964631
identifier: return.type
@@ -65106,12 +64998,6 @@ parameters:
6510664998
count: 1
6510764999
path: tests/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabaseTest.php
6510865000

65109-
-
65110-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
65111-
identifier: throws.unusedType
65112-
count: 1
65113-
path: tests/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabaseTest.php
65114-
6511565001
-
6511665002
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) should return Ibexa\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabase but returns Ibexa\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\.$#'
6511765003
identifier: return.type
@@ -65496,12 +65382,6 @@ parameters:
6549665382
count: 1
6549765383
path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php
6549865384

65499-
-
65500-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\UrlAliasHandlerTest\:\:getLanguageHandler\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
65501-
identifier: throws.unusedType
65502-
count: 1
65503-
path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php
65504-
6550565385
-
6550665386
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\UrlAliasHandlerTest\:\:getPartlyMockedHandler\(\) has parameter \$methods with no value type specified in iterable type array\.$#'
6550765387
identifier: missingType.iterableValue
@@ -66546,12 +66426,6 @@ parameters:
6654666426
count: 1
6654766427
path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasMapperTest.php
6654866428

66549-
-
66550-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
66551-
identifier: throws.unusedType
66552-
count: 1
66553-
path: tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php
66554-
6655566429
-
6655666430
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\Gateway\\DoctrineDatabaseTest\:\:testDeleteUrlWildcard\(\) has no return type specified\.$#'
6655766431
identifier: missingType.return
@@ -66600,12 +66474,6 @@ parameters:
6660066474
count: 1
6660166475
path: tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php
6660266476

66603-
-
66604-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\UrlWildcardHandlerTest\:\:getHandler\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
66605-
identifier: throws.unusedType
66606-
count: 1
66607-
path: tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardHandlerTest.php
66608-
6660966477
-
6661066478
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\UrlWildcardHandlerTest\:\:testCreate\(\) has no return type specified\.$#'
6661166479
identifier: missingType.return
@@ -67218,24 +67086,12 @@ parameters:
6721867086
count: 1
6721967087
path: tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/ValidityTest.php
6722067088

67221-
-
67222-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
67223-
identifier: throws.unusedType
67224-
count: 1
67225-
path: tests/lib/Persistence/Legacy/User/Gateway/DoctrineDatabaseTest.php
67226-
6722767089
-
6722867090
message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Gateway\\DoctrineDatabaseTest\:\:\$databaseGateway \(Ibexa\\Core\\Persistence\\Legacy\\User\\Gateway\\DoctrineDatabase\) in isset\(\) is not nullable\.$#'
6722967091
identifier: isset.property
6723067092
count: 1
6723167093
path: tests/lib/Persistence/Legacy/User/Gateway/DoctrineDatabaseTest.php
6723267094

67233-
-
67234-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Role\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
67235-
identifier: throws.unusedType
67236-
count: 1
67237-
path: tests/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabaseTest.php
67238-
6723967095
-
6724067096
message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Role\\Gateway\\DoctrineDatabaseTest\:\:\$databaseGateway \(Ibexa\\Core\\Persistence\\Legacy\\User\\Role\\Gateway\\DoctrineDatabase\) in isset\(\) is not nullable\.$#'
6724167097
identifier: isset.property
@@ -74892,12 +74748,6 @@ parameters:
7489274748
count: 1
7489374749
path: tests/lib/Search/Legacy/Content/AbstractTestCase.php
7489474750

74895-
-
74896-
message: '#^Method Ibexa\\Tests\\Core\\Search\\Legacy\\Content\\AbstractTestCase\:\:getContentTypeHandler\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#'
74897-
identifier: throws.unusedType
74898-
count: 1
74899-
path: tests/lib/Search/Legacy/Content/AbstractTestCase.php
74900-
7490174751
-
7490274752
message: '#^Method Ibexa\\Tests\\Core\\Search\\Legacy\\Content\\AbstractTestCase\:\:getConverterRegistry\(\) has no return type specified\.$#'
7490374753
identifier: missingType.return

src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,43 @@ public function getPlaceholder(ImageValue $value, array $options = []): string
2424
$options = $this->resolveOptions($options);
2525

2626
$path = $this->getTemporaryPath();
27+
if ($path === '') {
28+
throw new RuntimeException('Temporary file path is empty.');
29+
}
30+
2731
$placeholderUrl = $this->getPlaceholderUrl($options['url_pattern'], $value);
32+
if ($placeholderUrl === '') {
33+
throw new RuntimeException('Placeholder URL must be a non-empty string.');
34+
}
2835

29-
try {
30-
$handler = curl_init();
36+
$fp = fopen($path, 'wb');
37+
if ($fp === false) {
38+
throw new RuntimeException("Unable to open temp file for writing: {$path}");
39+
}
3140

32-
curl_setopt_array($handler, [
33-
CURLOPT_URL => $placeholderUrl,
34-
CURLOPT_FILE => fopen($path, 'wb'),
35-
CURLOPT_TIMEOUT => $options['timeout'],
36-
CURLOPT_FAILONERROR => true,
37-
]);
41+
$handler = \curl_init();
42+
if ($handler === false) {
43+
throw new RuntimeException('Unable to initialize cURL.');
44+
}
45+
46+
$timeout = $options['timeout'];
3847

48+
curl_setopt_array($handler, [
49+
CURLOPT_URL => $placeholderUrl, // non-empty-string
50+
CURLOPT_FILE => $fp, // resource
51+
CURLOPT_TIMEOUT => $timeout, // int
52+
CURLOPT_FAILONERROR => true, // bool
53+
]);
54+
55+
try {
3956
if (curl_exec($handler) === false) {
40-
throw new RuntimeException("Unable to download placeholder for {$value->id} ($placeholderUrl): " . curl_error($handler));
57+
throw new RuntimeException(
58+
"Unable to download placeholder for {$value->id} ({$placeholderUrl}): " . curl_error($handler)
59+
);
4160
}
4261
} finally {
4362
curl_close($handler);
63+
fclose($fp);
4464
}
4565

4666
return $path;

0 commit comments

Comments
 (0)