Skip to content

Commit 0128a04

Browse files
committed
extensive improvement of function descriptions and tags
1 parent 19dd59e commit 0128a04

File tree

9 files changed

+18
-17
lines changed

9 files changed

+18
-17
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 2.x branch
22
## 2.8 branch
3+
### 2.8.5
4+
* extensive improvement of function descriptions and tags.
5+
36
### 2.8.4
47
* `BackupManager::delete()` returns the full path;
58
* all methods provided by `BackupManager` can now be called statically, except

phpstan.neon

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ parameters:
2121
- "#^Constant REDIRECT_TO_DEV_NULL not found\\.$#"
2222
- '#^Parameter \#1 \$callback of function array_map expects \(callable\(\): mixed\)\|null#'
2323
- "#^Static call to instance method Tools\\\\Exceptionist#"
24-
- "#^Parameter \\#2 \\$eventManager of method Cake\\\\TestSuite\\\\TestCase\\:\\:assertEventFired\\(\\) expects Cake\\\\Event\\\\EventManager\\|null, Cake\\\\Event\\\\EventManagerInterface given\\.$#"
25-
- "#^Parameter \\#1 \\$connection of method Cake\\\\Database\\\\Schema\\\\TableSchema\\:\\:dropSql\\(\\) expects Cake\\\\Database\\\\Connection, Cake\\\\Datasource\\\\ConnectionInterface given\\.$#"
26-
27-
-
28-
message: "#^Call to an undefined method Cake\\\\Datasource\\\\ConnectionInterface#"
29-
path: src/Driver/Sqlite.php
24+
- '#^Parameter \#\d \$\w+ of method Cake\\[\w\:\\]+\(\) expects#'
25+
- '#^Call to an undefined method Cake\\#'
3026

3127
-
3228
message: '#^Call to an undefined method [\w\|\\]+MockObject::\w+\(\)\.$#'

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<UndefinedInterfaceMethod>
5656
<errorLevel type="suppress">
5757
<file name="src/Driver/Sqlite.php" />
58+
<file name="src/TestSuite/DriverTestCase.php" />
5859
</errorLevel>
5960
</UndefinedInterfaceMethod>
6061
</issueHandlers>

src/BackupTrait.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Cake\Core\Configure;
1919
use Cake\Datasource\ConnectionInterface;
2020
use Cake\Datasource\ConnectionManager;
21+
use DatabaseBackup\Driver\Driver;
2122
use InvalidArgumentException;
2223
use Tools\Exceptionist;
2324
use Tools\Filesystem;
@@ -30,7 +31,7 @@ trait BackupTrait
3031
/**
3132
* Valid extensions. Names as keys and compressions as values
3233
* @since 2.4.0
33-
* @var array
34+
* @var array<string, string|bool>
3435
*/
3536
protected static $validExtensions = ['sql.bz2' => 'bzip2', 'sql.gz' => 'gzip', 'sql' => false];
3637

@@ -77,7 +78,7 @@ public function getConnection(?string $name = null): ConnectionInterface
7778
* @throws \InvalidArgumentException
7879
* @uses getConnection()
7980
*/
80-
public function getDriver(?ConnectionInterface $connection = null): object
81+
public function getDriver(?ConnectionInterface $connection = null): Driver
8182
{
8283
$connection = $connection ?: $this->getConnection();
8384
$className = get_class_short_name($connection->getDriver());
@@ -103,7 +104,7 @@ public static function getExtension(string $filename): ?string
103104

104105
/**
105106
* Returns all valid compressions
106-
* @return array<string, string>
107+
* @return array
107108
* @since 2.4.0
108109
* @uses $validExtensions
109110
*/

src/Driver/Driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function afterImport(): void
103103
* @return bool Returns `false` to stop the export
104104
* @since 2.1.0
105105
*/
106-
public function beforeExport()
106+
public function beforeExport(): bool
107107
{
108108
return true;
109109
}
@@ -199,7 +199,7 @@ final public function export(string $filename): bool
199199
* @return string
200200
* @throws \ErrorException
201201
*/
202-
public function getBinary($name)
202+
public function getBinary(string $name): string
203203
{
204204
$binary = Configure::read('DatabaseBackup.binaries.' . $name);
205205

src/TestSuite/DriverTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ abstract class DriverTestCase extends TestCase
4747
/**
4848
* Driver class
4949
* @since 2.5.1
50-
* @var string
50+
* @var class-string<\DatabaseBackup\Driver\Driver>
5151
*/
5252
protected $DriverClass;
5353

src/TestSuite/TestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ protected function createSomeBackups(): array
8888

8989
/**
9090
* Internal method to mock a driver
91-
* @param class-string<object> $className Driver class name
92-
* @param array $methods The list of methods to mock
91+
* @param class-string<\DatabaseBackup\Driver\Driver> $className Driver class name
92+
* @param array|null $methods The list of methods to mock
9393
* @return \DatabaseBackup\Driver\Driver|\PHPUnit\Framework\MockObject\MockObject
9494
*/
95-
protected function getMockForDriver(string $className, array $methods)
95+
protected function getMockForDriver(string $className, ?array $methods = []): object
9696
{
9797
return $this->getMockBuilder($className)
9898
->setMethods($methods)

src/Utility/BackupExport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function compression(?string $compression)
116116
$this->extension = $this->defaultExtension;
117117

118118
if ($compression) {
119-
$this->extension = array_search($compression, $this->getValidCompressions()) ?: '';
119+
$this->extension = (string)array_search($compression, $this->getValidCompressions());
120120
Exceptionist::isTrue($this->extension, __d('database_backup', 'Invalid compression type'), InvalidArgumentException::class);
121121
}
122122
$this->compression = $compression;

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.8.4
1+
2.8.5

0 commit comments

Comments
 (0)