Skip to content

Commit a087f6b

Browse files
committed
some fixes. Ready for php 8.0. Some useless @uses tags have been removed
1 parent f929c9a commit a087f6b

File tree

15 files changed

+18
-77
lines changed

15 files changed

+18
-77
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ php:
44
- 7.2
55
- 7.3
66
- 7.4
7+
- 8.0
78

89
matrix:
910
fast_finish: true
@@ -15,6 +16,8 @@ matrix:
1516
env: dependencies=lowest
1617
- php: 7.4
1718
env: dependencies=lowest
19+
- php: 8.0
20+
env: dependencies=lowest
1821
- php: 7.2
1922
env: PHPCS=1
2023
- php: 7.2

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 2.x branch
22
## 2.8 branch
33
### 2.8.5
4+
* ready for php `8.0`;
45
* extensive improvement of function descriptions and tags.
56

67
### 2.8.4

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mirko-pagliai/php-tools": "^1.4.7"
1717
},
1818
"require-dev": {
19-
"cakephp/cakephp-codesniffer": "^4.0",
19+
"cakephp/cakephp-codesniffer": "^4.4",
2020
"mirko-pagliai/me-tools": "^2.19",
2121
"phpunit/phpunit": "^8.0|^9.0"
2222
},
@@ -52,7 +52,7 @@
5252
"@phpstan",
5353
"@psalm"
5454
],
55-
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 psalm/phar:^3.18 && mv composer.backup composer.json",
55+
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 psalm/phar:\"^3.18|^4\" && mv composer.backup composer.json",
5656
"update-lowest": "@composer update --prefer-lowest"
5757
}
5858
}

src/BackupTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ public static function getAbsolutePath(string $path): string
4848
/**
4949
* Returns the compression type from a filename
5050
* @param string $filename Filename
51-
* @return string|null Compression type as string or `null`
52-
* @uses getExtension()
53-
* @uses getValidCompressions()
51+
* @return string|null Compression type or `null`
5452
*/
5553
public static function getCompression(string $filename): ?string
5654
{

src/Command/IndexCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function execute(Arguments $args, ConsoleIo $io): void
6464
__d('database_backup', 'Size'),
6565
__d('database_backup', 'Datetime'),
6666
];
67-
$cells = $backups->map(function (Entity $backup) {
67+
$cells = $backups->map(function (Entity $backup): array {
6868
return $backup->set('compression', $backup->get('compression') ?: '')
6969
->set('datetime', $backup->get('datetime')->nice())
7070
->set('size', Number::toReadableSize($backup->get('size')))

src/Driver/Driver.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ abstract class Driver implements EventListenerInterface
3939
/**
4040
* Construct
4141
* @param \Cake\Datasource\ConnectionInterface $connection A connection object
42-
* @uses $connection
4342
*/
4443
public function __construct($connection)
4544
{
@@ -122,8 +121,6 @@ public function beforeImport(): bool
122121
* Gets the executable command to export the database, with compression
123122
* @param string $filename Filename where you want to export the database
124123
* @return string
125-
* @uses _exportExecutable()
126-
* @uses getBinary()
127124
*/
128125
protected function _exportExecutableWithCompression(string $filename): string
129126
{
@@ -146,8 +143,6 @@ protected function _exportExecutableWithCompression(string $filename): string
146143
* Gets the executable command to import the database, with compression
147144
* @param string $filename Filename from which you want to import the database
148145
* @return string
149-
* @uses _importExecutable()
150-
* @uses getBinary()
151146
*/
152147
protected function _importExecutableWithCompression(string $filename): string
153148
{
@@ -174,9 +169,8 @@ protected function _importExecutableWithCompression(string $filename): string
174169
* - Backup.beforeExport: will be triggered before export
175170
* - Backup.afterExport: will be triggered after export
176171
* @param string $filename Filename where you want to export the database
177-
* @return bool true on success
172+
* @return bool `true` on success
178173
* @throws \Exception
179-
* @uses _exportExecutableWithCompression()
180174
*/
181175
final public function export(string $filename): bool
182176
{
@@ -212,7 +206,6 @@ public function getBinary(string $name): string
212206
* @return mixed Config value, `null` if the key doesn't exist
213207
* or all config values if no key was specified
214208
* @since 2.3.0
215-
* @uses $connection
216209
*/
217210
final public function getConfig(?string $key = null)
218211
{
@@ -231,7 +224,6 @@ final public function getConfig(?string $key = null)
231224
* @param string $filename Filename from which you want to import the database
232225
* @return bool true on success
233226
* @throws \Exception
234-
* @uses _importExecutableWithCompression()
235227
*/
236228
final public function import(string $filename): bool
237229
{

src/Driver/Mysql.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ class Mysql extends Driver
3333
/**
3434
* Gets the executable command to export the database
3535
* @return string
36-
* @uses getBinary()
37-
* @uses getConfig()
38-
* @uses $auth
3936
*/
4037
protected function _exportExecutable(): string
4138
{
@@ -50,9 +47,6 @@ protected function _exportExecutable(): string
5047
/**
5148
* Gets the executable command to import the database
5249
* @return string
53-
* @uses getBinary()
54-
* @uses getConfig()
55-
* @uses $auth
5650
*/
5751
protected function _importExecutable(): string
5852
{
@@ -69,8 +63,6 @@ protected function _importExecutable(): string
6963
* @param string $content Content
7064
* @return bool
7165
* @since 2.3.0
72-
* @uses getConfig()
73-
* @uses $auth
7466
*/
7567
protected function writeAuthFile(string $content): bool
7668
{
@@ -89,7 +81,6 @@ protected function writeAuthFile(string $content): bool
8981
* Called after export
9082
* @return void
9183
* @since 2.1.0
92-
* @uses deleteAuthFile()
9384
*/
9485
public function afterExport(): void
9586
{
@@ -100,7 +91,6 @@ public function afterExport(): void
10091
* Called after import
10192
* @return void
10293
* @since 2.1.0
103-
* @uses deleteAuthFile()
10494
*/
10595
public function afterImport(): void
10696
{
@@ -119,7 +109,6 @@ public function afterImport(): void
119109
* So it creates a temporary file to store the configuration options
120110
* @return bool
121111
* @since 2.1.0
122-
* @uses writeAuthFile()
123112
*/
124113
public function beforeExport(): bool
125114
{
@@ -141,7 +130,6 @@ public function beforeExport(): bool
141130
* So it creates a temporary file to store the configuration options
142131
* @return bool
143132
* @since 2.1.0
144-
* @uses writeAuthFile()
145133
*/
146134
public function beforeImport(): bool
147135
{
@@ -155,7 +143,6 @@ public function beforeImport(): bool
155143
* Deletes the temporary file with the database authentication data
156144
* @return bool `true` on success
157145
* @since 2.1.0
158-
* @uses $auth
159146
*/
160147
protected function deleteAuthFile(): bool
161148
{

src/Driver/Postgres.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class Postgres extends Driver
3232
* postgresql://postgres@localhost/travis_ci_test
3333
* </code>
3434
* @return string
35-
* @uses getConfig()
3635
*/
3736
protected function getDbnameAsString(): string
3837
{
@@ -48,8 +47,6 @@ protected function getDbnameAsString(): string
4847
/**
4948
* Gets the executable command to export the database
5049
* @return string
51-
* @uses getBinary()
52-
* @uses getDbnameAsString()
5350
*/
5451
protected function _exportExecutable(): string
5552
{
@@ -59,8 +56,6 @@ protected function _exportExecutable(): string
5956
/**
6057
* Gets the executable command to import the database
6158
* @return string
62-
* @uses getBinary()
63-
* @uses getDbnameAsString()
6459
*/
6560
protected function _importExecutable(): string
6661
{

src/Driver/Sqlite.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class Sqlite extends Driver
2525
/**
2626
* Gets the executable command to export the database
2727
* @return string
28-
* @uses getBinary()
29-
* @uses getConfig()
3028
*/
3129
protected function _exportExecutable(): string
3230
{
@@ -36,8 +34,6 @@ protected function _exportExecutable(): string
3634
/**
3735
* Gets the executable command to import the database
3836
* @return string
39-
* @uses getBinary()
40-
* @uses getConfig()
4137
*/
4238
protected function _importExecutable(): string
4339
{
@@ -48,7 +44,6 @@ protected function _importExecutable(): string
4844
* Called before import
4945
* @return bool
5046
* @since 2.1.0
51-
* @uses $connection
5247
*/
5348
public function beforeImport(): bool
5449
{

src/TestSuite/TestCase.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ abstract class TestCase extends BaseTestCase
4141
*/
4242
public function setUp(): void
4343
{
44-
parent::setUp();
44+
@parent::setUp();
4545

46-
$this->BackupExport = $this->BackupExport ?? new BackupExport();
46+
$this->BackupExport = $this->BackupExport ?: new BackupExport();
4747
}
4848

4949
/**
@@ -71,7 +71,6 @@ protected function createBackup(string $filename = 'backup.sql'): string
7171
/**
7272
* Internal method to creates some backup files
7373
* @return array
74-
* @uses createBackup()
7574
*/
7675
protected function createSomeBackups(): array
7776
{
@@ -94,7 +93,7 @@ protected function createSomeBackups(): array
9493
*/
9594
protected function getMockForDriver(string $className, ?array $methods = []): object
9695
{
97-
return $this->getMockBuilder($className)
96+
return @$this->getMockBuilder($className)
9897
->setMethods($methods)
9998
->setConstructorArgs([$this->getConnection('test')])
10099
->getMock();

0 commit comments

Comments
 (0)