Skip to content

Commit ee371ec

Browse files
Merge pull request #52 from mirko-pagliai/cakephp4
Cakephp4
2 parents cb97dd7 + ba9809b commit ee371ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+147
-128
lines changed

.travis.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
6-
- 7.1
74
- 7.2
85
- 7.3
96

107
matrix:
118
fast_finish: true
129

1310
include:
14-
- php: 5.6
15-
env: dependencies=lowest
16-
- php: 7.0
17-
env: dependencies=lowest
18-
- php: 7.1
19-
env: dependencies=lowest
2011
- php: 7.2
2112
env: dependencies=lowest
2213
- php: 7.3

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# 2.x branch
2+
## 2.8 branch
3+
### 2.8.0
4+
* updated for `cakephp` 4 and `phpunit` 8.
5+
26
## 2.7 branch
37
### 2.7.0
48
* `BackupTrait::getBinary()` method has been moved to `Driver` abstract class;

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
"email": "mirko.pagliai@gmail.com"
1010
}],
1111
"require": {
12-
"php": ">=5.5.9",
13-
"cakephp/cakephp": "^3.7",
14-
"mirko-pagliai/php-tools": "~1.2.15"
12+
"php": ">=7.2",
13+
"cakephp/cakephp": "^4.0",
14+
"mirko-pagliai/php-tools": "^1.3"
1515
},
1616
"require-dev": {
17-
"cakephp/cakephp-codesniffer": "^3.0|^4.0",
18-
"mirko-pagliai/me-tools": "~2.18.11",
19-
"phpunit/phpunit": "^5.7.14|^6.0"
17+
"cakephp/cakephp-codesniffer": "^4.0",
18+
"mirko-pagliai/me-tools": "^2.19",
19+
"phpunit/phpunit": "^8.0"
2020
},
2121
"autoload": {
2222
"psr-4": {

phpcs.xml.dist

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@
55

66
<rule ref="./vendor/mirko-pagliai/php-tools/sniffer-ruleset.xml"/>
77

8-
<rule ref="Generic.Files.LineLength.TooLong">
9-
<severity>0</severity>
10-
</rule>
118
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace.UseFromSameNamespace">
129
<severity>0</severity>
1310
</rule>
14-
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing">
15-
<severity>0</severity>
16-
</rule>
17-
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue.NullabilitySymbolRequired">
18-
<severity>0</severity>
19-
</rule>
2011
</ruleset>

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
colors="true"
44
processIsolation="false"
55
stopOnFailure="false"
6-
syntaxCheck="false"
76
bootstrap="./tests/bootstrap.php"
87
>
98

src/BackupTrait.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23
/**
34
* This file is part of cakephp-database-backup.
45
*
@@ -36,7 +37,7 @@ trait BackupTrait
3637
* @param string $path Relative or absolute path
3738
* @return string
3839
*/
39-
public function getAbsolutePath($path)
40+
public function getAbsolutePath(string $path): string
4041
{
4142
if (!(new Filesystem())->isAbsolutePath($path)) {
4243
return add_slash_term(Configure::read('DatabaseBackup.target')) . $path;
@@ -52,7 +53,7 @@ public function getAbsolutePath($path)
5253
* @uses getExtension()
5354
* @uses getValidCompressions()
5455
*/
55-
public function getCompression($filename)
56+
public function getCompression(string $filename): ?string
5657
{
5758
//Gets the extension from the filename
5859
$extension = $this->getExtension($filename);
@@ -66,7 +67,7 @@ public function getCompression($filename)
6667
* @param string|null $name Connection name
6768
* @return \Cake\Datasource\ConnectionInterface A connection object
6869
*/
69-
public function getConnection($name = null)
70+
public function getConnection(?string $name = null): ConnectionInterface
7071
{
7172
return ConnectionManager::get($name ?: Configure::readOrFail('DatabaseBackup.connection'));
7273
}
@@ -80,7 +81,7 @@ public function getConnection($name = null)
8081
* @throws \InvalidArgumentException
8182
* @uses getConnection()
8283
*/
83-
public function getDriver(ConnectionInterface $connection = null)
84+
public function getDriver(?ConnectionInterface $connection = null): object
8485
{
8586
$connection = $connection ?: $this->getConnection();
8687
$className = get_class_short_name($connection->getDriver());
@@ -101,7 +102,7 @@ public function getDriver(ConnectionInterface $connection = null)
101102
* if is an invalid extension
102103
* @uses $validExtensions
103104
*/
104-
public function getExtension($filename)
105+
public function getExtension(string $filename): ?string
105106
{
106107
$extension = get_extension($filename);
107108

@@ -114,7 +115,7 @@ public function getExtension($filename)
114115
* @since 2.4.0
115116
* @uses $validExtensions
116117
*/
117-
public function getValidCompressions()
118+
public function getValidCompressions(): array
118119
{
119120
return array_filter(self::$validExtensions);
120121
}

src/Command/DeleteAllCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23
/**
34
* This file is part of cakephp-database-backup.
45
*
@@ -29,7 +30,7 @@ class DeleteAllCommand extends Command
2930
* @param \Cake\Console\ConsoleOptionParser $parser The parser to be defined
3031
* @return \Cake\Console\ConsoleOptionParser
3132
*/
32-
protected function buildOptionParser(ConsoleOptionParser $parser)
33+
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
3334
{
3435
return $parser->setDescription(__d('database_backup', 'Deletes all database backups'));
3536
}
@@ -42,7 +43,7 @@ protected function buildOptionParser(ConsoleOptionParser $parser)
4243
* @see https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupShell#delete_all
4344
* @uses \DatabaseBackup\Utility\BackupManager::deleteAll()
4445
*/
45-
public function execute(Arguments $args, ConsoleIo $io)
46+
public function execute(Arguments $args, ConsoleIo $io): ?int
4647
{
4748
parent::execute($args, $io);
4849

src/Command/ExportCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23
/**
34
* This file is part of cakephp-database-backup.
45
*
@@ -32,7 +33,7 @@ class ExportCommand extends Command
3233
* @param \Cake\Console\ConsoleOptionParser $parser The parser to be defined
3334
* @return \Cake\Console\ConsoleOptionParser
3435
*/
35-
protected function buildOptionParser(ConsoleOptionParser $parser)
36+
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
3637
{
3738
return $parser->setDescription(__d('database_backup', 'Exports a database backup'))
3839
->addOptions([
@@ -74,7 +75,7 @@ protected function buildOptionParser(ConsoleOptionParser $parser)
7475
* @uses \DatabaseBackup\Utility\BackupExport::export()
7576
* @uses \DatabaseBackup\Utility\BackupExport::filename()
7677
*/
77-
public function execute(Arguments $args, ConsoleIo $io)
78+
public function execute(Arguments $args, ConsoleIo $io): ?int
7879
{
7980
parent::execute($args, $io);
8081

src/Command/ImportCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23
/**
34
* This file is part of cakephp-database-backup.
45
*
@@ -30,7 +31,7 @@ class ImportCommand extends Command
3031
* @param \Cake\Console\ConsoleOptionParser $parser The parser to be defined
3132
* @return \Cake\Console\ConsoleOptionParser
3233
*/
33-
protected function buildOptionParser(ConsoleOptionParser $parser)
34+
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
3435
{
3536
return $parser->setDescription(__d('database_backup', 'Imports a database backup'))
3637
->addArgument('filename', [
@@ -48,7 +49,7 @@ protected function buildOptionParser(ConsoleOptionParser $parser)
4849
* @uses \DatabaseBackup\Utility\BackupImport::filename()
4950
* @uses \DatabaseBackup\Utility\BackupImport::import()
5051
*/
51-
public function execute(Arguments $args, ConsoleIo $io)
52+
public function execute(Arguments $args, ConsoleIo $io): ?int
5253
{
5354
parent::execute($args, $io);
5455

src/Command/IndexCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23
/**
34
* This file is part of cakephp-database-backup.
45
*
@@ -31,7 +32,7 @@ class IndexCommand extends Command
3132
* @param \Cake\Console\ConsoleOptionParser $parser The parser to be defined
3233
* @return \Cake\Console\ConsoleOptionParser
3334
*/
34-
protected function buildOptionParser(ConsoleOptionParser $parser)
35+
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
3536
{
3637
return $parser->setDescription(__d('database_backup', 'Lists database backups'));
3738
}
@@ -44,7 +45,7 @@ protected function buildOptionParser(ConsoleOptionParser $parser)
4445
* @see https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupShell#index
4546
* @uses \DatabaseBackup\Utility\BackupManager::index()
4647
*/
47-
public function execute(Arguments $args, ConsoleIo $io)
48+
public function execute(Arguments $args, ConsoleIo $io): ?int
4849
{
4950
parent::execute($args, $io);
5051

0 commit comments

Comments
 (0)