Skip to content

Commit 482fbf8

Browse files
Fix deprecations
1 parent a3cb5e8 commit 482fbf8

File tree

8 files changed

+17
-13
lines changed

8 files changed

+17
-13
lines changed

src/Backup/Sync/AmazonS3v3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function sync(Target $target, Result $result)
6969
// run remote cleanup
7070
$this->cleanup($target, $result);
7171
} catch (\Exception $e) {
72-
throw new Exception($e->getMessage(), null, $e);
72+
throw new Exception($e->getMessage(), 0, $e);
7373
}
7474
}
7575

@@ -95,7 +95,7 @@ protected function createClient() : S3Client
9595
if ($this->signatureVersion) {
9696
$config['signature_version'] = $this->signatureVersion;
9797
}
98-
98+
9999
return new S3Client($config);
100100
}
101101

src/Backup/Sync/AzureBlob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function sync(Target $target, Result $result)
134134
// run remote cleanup
135135
$this->cleanup($target, $result);
136136
} catch (\Exception $e) {
137-
throw new Exception($e->getMessage(), null, $e);
137+
throw new Exception($e->getMessage(), 0, $e);
138138
}
139139
}
140140

src/Backup/Sync/Dropbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function sync(Target $target, Result $result)
124124
// run remote cleanup
125125
$this->cleanup($target, $result);
126126
} catch (\Exception $e) {
127-
throw new Exception($e->getMessage(), null, $e);
127+
throw new Exception($e->getMessage(), 0, $e);
128128
}
129129
}
130130

src/Backup/Sync/GoogleDrive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function sync(Target $target, Result $result)
143143
$result->debug(sprintf('upload: done: %s', $apiResult->getId()));
144144
$this->cleanup($target, $result);
145145
} catch (\Exception $e) {
146-
throw new Exception($e->getMessage(), null, $e);
146+
throw new Exception($e->getMessage(), 0, $e);
147147
}
148148
}
149149

src/Backup/Sync/YandexDisk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function sync(Target $target, Result $result): void
112112
}
113113
$this->cleanup($target, $result);
114114
} catch (\Exception $e) {
115-
throw new Exception($e->getMessage(), null, $e);
115+
throw new Exception($e->getMessage(), 0, $e);
116116
}
117117
}
118118

src/Util/Cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static function detectCmdLocationWithWhich(string $cmd) : string
139139
$bin = '';
140140
// on nx systems use 'which' command.
141141
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
142-
$command = trim(`which $cmd`);
142+
$command = trim((string) `which $cmd`);
143143
$bin = self::isExecutable($command);
144144
}
145145
return $bin;

src/Util/Str.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public static function toBoolean($value, $default) : bool
2828
if (is_bool($value)) {
2929
return $value;
3030
}
31-
if (strtolower($value) == 'false') {
31+
if (strtolower((string)$value) == 'false') {
3232
return false;
33-
} elseif (strtolower($value) == 'true') {
33+
} elseif (strtolower((string)$value) == 'true') {
3434
return true;
3535
}
3636
return $default;

tests/phpbu/Log/ResultFormatter/FormDataTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22
namespace phpbu\App\Log\ResultFormatter;
33

4+
use Exception;
5+
use phpbu\App\Result;
6+
use phpbu\App\Result\Backup;
47
use function GuzzleHttp\Psr7\parse_query;
58
use PHPUnit\Framework\TestCase;
69

@@ -25,7 +28,8 @@ public function testFormat()
2528
$result = $this->getResultMock();
2629
$formatter = new FormData();
2730
$queryString = $formatter->format($result);
28-
$rawData = parse_query($queryString);
31+
$rawData = [];
32+
parse_str($queryString, $rawData);
2933

3034
$this->assertNotEmpty($queryString);
3135
$this->assertEquals(0, $rawData['status']);
@@ -39,12 +43,12 @@ public function testFormat()
3943
*/
4044
protected function getResultMock()
4145
{
42-
$result = $this->createMock(\phpbu\App\Result::class);
46+
$result = $this->createMock(Result::class);
4347
$result->expects($this->once())->method('started')->willReturn(microtime(true));
4448
$result->expects($this->once())->method('allOk')->willReturn(true);
4549
$result->expects($this->once())->method('backupsFailedCount')->willReturn(0);
4650
$result->expects($this->once())->method('errorCount')->willReturn(1);
47-
$result->expects($this->once())->method('getErrors')->willReturn([new \Exception('foo bar')]);
51+
$result->expects($this->once())->method('getErrors')->willReturn([new Exception('foo bar')]);
4852
$result->expects($this->once())->method('getBackups')->willReturn([$this->getBackupResultMock()]);
4953

5054
return $result;
@@ -57,7 +61,7 @@ protected function getResultMock()
5761
*/
5862
protected function getBackupResultMock()
5963
{
60-
$backup = $this->createMock(\phpbu\App\Result\Backup::class);
64+
$backup = $this->createMock(Backup::class);
6165
$backup->method('getName')->willReturn('foo');
6266
$backup->method('allOk')->willReturn(true);
6367
$backup->method('checkCount')->willReturn(0);

0 commit comments

Comments
 (0)