Skip to content

Commit 513f269

Browse files
committed
PHPLIB-1218 Remove GridFS fields contentType and aliases
1 parent 0fe0d1f commit 513f269

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

src/GridFS/WritableStream.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626

2727
use function array_intersect_key;
2828
use function is_integer;
29-
use function is_string;
3029
use function MongoDB\is_document;
31-
use function MongoDB\is_string_array;
3230
use function sprintf;
3331
use function strlen;
3432
use function substr;
@@ -63,16 +61,9 @@ class WritableStream
6361
*
6462
* * _id (mixed): File document identifier. Defaults to a new ObjectId.
6563
*
66-
* * aliases (array of strings): DEPRECATED An array of aliases.
67-
* Applications wishing to store aliases should add an aliases field to
68-
* the metadata document instead.
69-
*
7064
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to
7165
* 261120 (i.e. 255 KiB).
7266
*
73-
* * contentType (string): DEPRECATED content type to be stored with the
74-
* file. This information should now be added to the metadata.
75-
*
7667
* * metadata (document): User data for the "metadata" field of the files
7768
* collection document.
7869
*
@@ -88,10 +79,6 @@ public function __construct(private CollectionWrapper $collectionWrapper, string
8879
'chunkSizeBytes' => self::DEFAULT_CHUNK_SIZE_BYTES,
8980
];
9081

91-
if (isset($options['aliases']) && ! is_string_array($options['aliases'])) {
92-
throw InvalidArgumentException::invalidType('"aliases" option', $options['aliases'], 'array of strings');
93-
}
94-
9582
if (! is_integer($options['chunkSizeBytes'])) {
9683
throw InvalidArgumentException::invalidType('"chunkSizeBytes" option', $options['chunkSizeBytes'], 'integer');
9784
}
@@ -100,10 +87,6 @@ public function __construct(private CollectionWrapper $collectionWrapper, string
10087
throw new InvalidArgumentException(sprintf('Expected "chunkSizeBytes" option to be >= 1, %d given', $options['chunkSizeBytes']));
10188
}
10289

103-
if (isset($options['contentType']) && ! is_string($options['contentType'])) {
104-
throw InvalidArgumentException::invalidType('"contentType" option', $options['contentType'], 'string');
105-
}
106-
10790
if (isset($options['metadata']) && ! is_document($options['metadata'])) {
10891
throw InvalidArgumentException::expectedDocumentType('"metadata" option', $options['metadata']);
10992
}
@@ -115,7 +98,7 @@ public function __construct(private CollectionWrapper $collectionWrapper, string
11598
'filename' => $filename,
11699
'length' => null,
117100
'uploadDate' => null,
118-
] + array_intersect_key($options, ['aliases' => 1, 'contentType' => 1, 'metadata' => 1]);
101+
] + array_intersect_key($options, ['metadata' => 1]);
119102
}
120103

121104
/**

tests/UnifiedSpecTests/Util.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ final class Util
134134
'delete' => ['id'],
135135
'downloadByName' => ['filename', 'revision'],
136136
'download' => ['id'],
137-
'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'contentType', 'metadata'],
138-
'upload' => ['filename', 'source', 'chunkSizeBytes', 'contentType', 'metadata'],
137+
'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'metadata'],
138+
'upload' => ['filename', 'source', 'chunkSizeBytes', 'metadata'],
139139
],
140140
];
141141

0 commit comments

Comments
 (0)