Skip to content

Commit 4f2dc18

Browse files
committed
storage: update IStorage#file_put_contents docs to match usage
The current phpdoc of IStorage#file_put_contents doesnt corresponds to it's actual usage in code, e.g. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
1 parent f3513f3 commit 4f2dc18

File tree

10 files changed

+23
-19
lines changed

10 files changed

+23
-19
lines changed

lib/private/Files/ObjectStore/ObjectStoreStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ public function needsPartFile() {
439439

440440
public function file_put_contents($path, $data) {
441441
$handle = $this->fopen($path, 'w+');
442-
fwrite($handle, $data);
442+
$result = fwrite($handle, $data);
443443
fclose($handle);
444-
return true;
444+
return $result;
445445
}
446446

447447
public function writeStream(string $path, $stream, int $size = null): int {

lib/private/Files/Storage/DAV.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ public function touch($path, $mtime = null) {
486486

487487
/**
488488
* @param string $path
489-
* @param string $data
490-
* @return int
489+
* @param mixed $data
490+
* @return int|false
491491
*/
492492
public function file_put_contents($path, $data) {
493493
$path = $this->cleanPath($path);

lib/private/Files/Storage/Flysystem.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public function file_get_contents($path) {
7373
* {@inheritdoc}
7474
*/
7575
public function file_put_contents($path, $data) {
76-
return $this->flysystem->put($this->buildPath($path), $data);
76+
$result = $this->flysystem->put($this->buildPath($path), $data);
77+
if ($result === true) {
78+
return strlen($data);
79+
}
80+
return $result;
7781
}
7882

7983
/**

lib/private/Files/Storage/Wrapper/Encoding.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ public function file_get_contents($path) {
309309
* see http://php.net/manual/en/function.file_put_contents.php
310310
*
311311
* @param string $path
312-
* @param string $data
313-
* @return bool
312+
* @param mixed $data
313+
* @return int|false
314314
*/
315315
public function file_put_contents($path, $data) {
316316
return $this->storage->file_put_contents($this->findPathToUse($path), $data);

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ public function file_get_contents($path) {
234234
* see http://php.net/manual/en/function.file_put_contents.php
235235
*
236236
* @param string $path
237-
* @param string $data
238-
* @return bool
237+
* @param mixed $data
238+
* @return int|false
239239
*/
240240
public function file_put_contents($path, $data) {
241241
// file put content will always be translated to a stream write

lib/private/Files/Storage/Wrapper/Jail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public function file_get_contents($path) {
259259
* see http://php.net/manual/en/function.file_put_contents.php
260260
*
261261
* @param string $path
262-
* @param string $data
263-
* @return bool
262+
* @param mixed $data
263+
* @return int|false
264264
*/
265265
public function file_put_contents($path, $data) {
266266
return $this->getWrapperStorage()->file_put_contents($this->getUnjailedPath($path), $data);

lib/private/Files/Storage/Wrapper/Quota.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ public function free_space($path) {
121121
* see http://php.net/manual/en/function.file_put_contents.php
122122
*
123123
* @param string $path
124-
* @param string $data
125-
* @return bool
124+
* @param mixed $data
125+
* @return int|false
126126
*/
127127
public function file_put_contents($path, $data) {
128128
$free = $this->free_space($path);

lib/private/Files/Storage/Wrapper/Wrapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ public function file_get_contents($path) {
250250
* see http://php.net/manual/en/function.file_put_contents.php
251251
*
252252
* @param string $path
253-
* @param string $data
254-
* @return bool
253+
* @param mixed $data
254+
* @return int|false
255255
*/
256256
public function file_put_contents($path, $data) {
257257
return $this->getWrapperStorage()->file_put_contents($path, $data);

lib/public/Files/Storage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ public function file_get_contents($path);
230230
* see http://php.net/manual/en/function.file_put_contents.php
231231
*
232232
* @param string $path
233-
* @param string $data
234-
* @return bool
233+
* @param mixed $data
234+
* @return int|false
235235
* @since 6.0.0
236236
*/
237237
public function file_put_contents($path, $data);

lib/public/Files/Storage/IStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ public function file_get_contents($path);
226226
* see http://php.net/manual/en/function.file_put_contents.php
227227
*
228228
* @param string $path
229-
* @param string $data
230-
* @return bool
229+
* @param mixed $data
230+
* @return int|false
231231
* @since 9.0.0
232232
*/
233233
public function file_put_contents($path, $data);

0 commit comments

Comments
 (0)