Skip to content

Commit 1c55bf5

Browse files
Merge pull request #222 from marcelthole
Update PHPStan to level 3 and fix wrong typehints
2 parents a233e04 + 589852d commit 1c55bf5

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 2
2+
level: 3
33
paths:
44
- %currentWorkingDirectory%/src/
55
ignoreErrors:

src/Backup/Cleaner/Capacity.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function setup(array $options)
6464
*
6565
* @param \phpbu\App\Backup\Target $target
6666
* @param \phpbu\App\Backup\Collector $collector
67-
* @return \phpbu\App\Backup\File\Local[]
67+
* @return \phpbu\App\Backup\File[]
6868
* @throws \phpbu\App\Exception
6969
*/
7070
protected function getFilesToDelete(Target $target, Collector $collector)
@@ -76,7 +76,7 @@ protected function getFilesToDelete(Target $target, Collector $collector)
7676

7777

7878
// sum up the size of all backups
79-
/** @var \phpbu\App\Backup\File\Local $file */
79+
/** @var \phpbu\App\Backup\File $file */
8080
foreach ($files as $file) {
8181
$size += $file->getSize();
8282
}
@@ -89,6 +89,9 @@ protected function getFilesToDelete(Target $target, Collector $collector)
8989
while ($this->isCapacityExceeded($size) && count($files) > 0) {
9090
// get oldest backup from list, move it to delete list
9191
$file = array_shift($files);
92+
if ($file === null) {
93+
break;
94+
}
9295
$size -= $file->getSize();
9396
$delete[] = $file;
9497
}

src/Backup/Cleaner/Quantity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function setup(array $options)
5353
*
5454
* @param \phpbu\App\Backup\Target $target
5555
* @param \phpbu\App\Backup\Collector $collector
56-
* @return \phpbu\App\Backup\File\Local[]
56+
* @return \phpbu\App\Backup\File[]
5757
*/
5858
protected function getFilesToDelete(Target $target, Collector $collector)
5959
{
@@ -66,6 +66,9 @@ protected function getFilesToDelete(Target $target, Collector $collector)
6666

6767
while ($this->isCapacityExceeded($files)) {
6868
$file = array_shift($files);
69+
if ($file === null) {
70+
break;
71+
}
6972
$delete[] = $file;
7073
}
7174
}

src/Backup/Cleaner/Stepwise.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function setupRanges()
139139
*
140140
* @param \phpbu\App\Backup\Target $target
141141
* @param \phpbu\App\Backup\Collector $collector
142-
* @return \phpbu\App\Backup\File\Local[]
142+
* @return \phpbu\App\Backup\File[]
143143
* @throws \phpbu\App\Exception
144144
*/
145145
protected function getFilesToDelete(Target $target, Collector $collector)

src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class OnePerGroup implements Keeper
2727
/**
2828
* List of groups containing the files.
2929
*
30-
* @var \phpbu\App\Backup\File\Local[]
30+
* @var \phpbu\App\Backup\File\Local[][]
3131
*/
3232
private $groups = [];
3333

src/Backup/Collector/Abstraction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract class Abstraction
3636
/**
3737
* Collection cache
3838
*
39-
* @var \phpbu\App\Backup\File\Local[]
39+
* @var \phpbu\App\Backup\File[]
4040
*/
4141
protected $files;
4242

@@ -67,7 +67,7 @@ public function setSimulation(bool $isSimulation)
6767
/**
6868
* Get all created backups.
6969
*
70-
* @return \phpbu\App\Backup\File\Local[]
70+
* @return \phpbu\App\Backup\File[]
7171
*/
7272
public function getBackupFiles() : array
7373
{

src/Configuration/Loader/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected function getAdapterizedValue($value)
209209
*
210210
* @param string $filename
211211
* @throws \phpbu\App\Exception
212-
* @return \stdClass
212+
* @return string
213213
*/
214214
protected function loadFile($filename)
215215
{

0 commit comments

Comments
 (0)