Skip to content

Commit 4df3ef9

Browse files
committed
Fix up migration to php-collective
1 parent aae4a4a commit 4df3ef9

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
"ext-fileinfo": "*",
2020
"ext-json": "*",
2121
"ext-mbstring": "*",
22-
"php-collective/file-storage-factories": "^1.0",
22+
"php-collective/file-storage-factories": "dev-master as 1.0",
2323
"psr/http-message": "^1.0"
2424
},
2525
"require-dev": {
26+
"phpstan/phpstan": "^1.10",
2627
"phpunit/phpunit": "^10.3",
2728
"php-collective/code-sniffer": "^0.2.1",
28-
"php-collective/file-storage-image-processor": "^1.0"
29+
"php-collective/file-storage-image-processor": "dev-master as 1.0"
2930
},
3031
"suggest": {
3132
"php-collective/file-storage-image-processor": "For image processing"

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 6
2+
level: 8
33
paths:
44
- src/
55
checkMissingIterableValueType: false

src/File.php

+3
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ public function resource()
204204
public function withFile(string $file): FileInterface
205205
{
206206
$resource = fopen($file, 'rb');
207+
if ($resource === false) {
208+
throw new RuntimeException('Cannot open file `' . $file . '`');
209+
}
207210

208211
return $this->withResource($resource);
209212
}

src/FileFactory.php

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public static function fromDisk(string $path, string $storage): FileInterface
7070
);
7171

7272
$resource = fopen($path, 'rb');
73+
if ($resource === false) {
74+
throw new RuntimeException('Cannot open file `' . $path . '`');
75+
}
7376

7477
return $file->withResource($resource);
7578
}

0 commit comments

Comments
 (0)