diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c4c7a553..c67f2795 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ -github: # waiting to get approved to the beta -custom: https://www.paypal.me/kackb00n +github: sebastianfeldmann diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 0569db7d..6b9d8754 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -15,6 +15,11 @@ build: coverage: file: clover.xml format: php-clover + nodes: + analysis: + tests: + override: + - php-scrutinizer-run coding_style: php: spaces: diff --git a/phpbu.xsd b/phpbu.xsd index 450732f3..4ea9a814 100644 --- a/phpbu.xsd +++ b/phpbu.xsd @@ -73,6 +73,7 @@ + diff --git a/phpstan.neon b/phpstan.neon index 0246f42e..1582ad63 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 2 + level: 3 paths: - %currentWorkingDirectory%/src/ ignoreErrors: diff --git a/src/Backup/Cleaner/Capacity.php b/src/Backup/Cleaner/Capacity.php index 226a9c5d..b8798e28 100644 --- a/src/Backup/Cleaner/Capacity.php +++ b/src/Backup/Cleaner/Capacity.php @@ -64,7 +64,7 @@ public function setup(array $options) * * @param \phpbu\App\Backup\Target $target * @param \phpbu\App\Backup\Collector $collector - * @return \phpbu\App\Backup\File\Local[] + * @return \phpbu\App\Backup\File[] * @throws \phpbu\App\Exception */ protected function getFilesToDelete(Target $target, Collector $collector) @@ -76,7 +76,7 @@ protected function getFilesToDelete(Target $target, Collector $collector) // sum up the size of all backups - /** @var \phpbu\App\Backup\File\Local $file */ + /** @var \phpbu\App\Backup\File $file */ foreach ($files as $file) { $size += $file->getSize(); } @@ -89,6 +89,9 @@ protected function getFilesToDelete(Target $target, Collector $collector) while ($this->isCapacityExceeded($size) && count($files) > 0) { // get oldest backup from list, move it to delete list $file = array_shift($files); + if ($file === null) { + break; + } $size -= $file->getSize(); $delete[] = $file; } diff --git a/src/Backup/Cleaner/Quantity.php b/src/Backup/Cleaner/Quantity.php index c8c15d4b..2c795943 100644 --- a/src/Backup/Cleaner/Quantity.php +++ b/src/Backup/Cleaner/Quantity.php @@ -53,7 +53,7 @@ public function setup(array $options) * * @param \phpbu\App\Backup\Target $target * @param \phpbu\App\Backup\Collector $collector - * @return \phpbu\App\Backup\File\Local[] + * @return \phpbu\App\Backup\File[] */ protected function getFilesToDelete(Target $target, Collector $collector) { @@ -66,6 +66,9 @@ protected function getFilesToDelete(Target $target, Collector $collector) while ($this->isCapacityExceeded($files)) { $file = array_shift($files); + if ($file === null) { + break; + } $delete[] = $file; } } diff --git a/src/Backup/Cleaner/Stepwise.php b/src/Backup/Cleaner/Stepwise.php index d5647d61..8b3212bc 100644 --- a/src/Backup/Cleaner/Stepwise.php +++ b/src/Backup/Cleaner/Stepwise.php @@ -139,7 +139,7 @@ protected function setupRanges() * * @param \phpbu\App\Backup\Target $target * @param \phpbu\App\Backup\Collector $collector - * @return \phpbu\App\Backup\File\Local[] + * @return \phpbu\App\Backup\File[] * @throws \phpbu\App\Exception */ protected function getFilesToDelete(Target $target, Collector $collector) diff --git a/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php b/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php index e821c25e..db2ed962 100644 --- a/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php +++ b/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php @@ -27,7 +27,7 @@ class OnePerGroup implements Keeper /** * List of groups containing the files. * - * @var \phpbu\App\Backup\File\Local[] + * @var \phpbu\App\Backup\File\Local[][] */ private $groups = []; diff --git a/src/Backup/Collector/Abstraction.php b/src/Backup/Collector/Abstraction.php index 3ec9ac8c..63756f6a 100644 --- a/src/Backup/Collector/Abstraction.php +++ b/src/Backup/Collector/Abstraction.php @@ -36,7 +36,7 @@ abstract class Abstraction /** * Collection cache * - * @var \phpbu\App\Backup\File\Local[] + * @var \phpbu\App\Backup\File[] */ protected $files; @@ -67,7 +67,7 @@ public function setSimulation(bool $isSimulation) /** * Get all created backups. * - * @return \phpbu\App\Backup\File\Local[] + * @return \phpbu\App\Backup\File[] */ public function getBackupFiles() : array { diff --git a/src/Configuration/Loader/File.php b/src/Configuration/Loader/File.php index 1bfa70e1..7748a4b5 100644 --- a/src/Configuration/Loader/File.php +++ b/src/Configuration/Loader/File.php @@ -209,7 +209,7 @@ protected function getAdapterizedValue($value) * * @param string $filename * @throws \phpbu\App\Exception - * @return \stdClass + * @return string */ protected function loadFile($filename) {