Skip to content

Commit 0efcee1

Browse files
committed
Merge branch '2.x' into 2.next
# Conflicts: # .phive/phars.xml
2 parents 56a8b8e + 7d67bb7 commit 0efcee1

File tree

7 files changed

+30
-11
lines changed

7 files changed

+30
-11
lines changed

.phive/phars.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="1.11.11" installed="1.11.11" location="./tools/phpstan" copy="false"/>
3+
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
44
<phar name="psalm" version="5.25.0" installed="5.25.0" location="./tools/psalm" copy="false"/>
55
</phive>

phpstan-baseline.neon

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Property CakeDumpSql\\Error\\VersionMismatchException\:\:\$message has no type specified\.$#'
5+
identifier: missingType.property
6+
count: 1
7+
path: src/Error/VersionMismatchException.php

phpstan.neon

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
25
paths:
36
- src
47
- tests/TestCase
5-
level: 5
8+
level: 8
69
bootstrapFiles:
7-
- tests/bootstrap.php
10+
- tests/bootstrap.php
11+
ignoreErrors:
12+
-
13+
identifier: missingType.iterableValue

psalm-baseline.xml

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="dev-master@">
2+
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
33
<file src="src/Sql/SqlBase.php">
4-
<ForbiddenCode occurrences="1">
5-
<code>shell_exec("$test $command")</code>
4+
<ForbiddenCode>
5+
<code><![CDATA[shell_exec("$test $command")]]></code>
66
</ForbiddenCode>
7-
<PossiblyNullArgument occurrences="1">
8-
<code>shell_exec("$test $command")</code>
9-
</PossiblyNullArgument>
107
</file>
118
</files>

src/Command/DumpSqlCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public function execute(Arguments $args, ConsoleIo $io): int
8989
if ($gzip) {
9090
if (function_exists('gzencode')) {
9191
$result = gzencode($result, 9);
92+
if (!$result) {
93+
$io->err('Failed to gzip the dump!');
94+
95+
return self::CODE_ERROR;
96+
}
9297
} else {
9398
$io->err('Your PHP installation does not have zlib support to create a gzip file!');
9499

src/Sql/SqlBase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ protected function checkBinary(string $command): bool
6666
$windows = str_starts_with(PHP_OS, 'WIN');
6767
$test = $windows ? 'where' : 'command -v';
6868

69-
return is_executable(trim(shell_exec("$test $command")));
69+
return is_executable(trim(shell_exec("$test $command") ?: ''));
7070
}
7171
}

tests/TestCase/Command/DumpSqlCommandTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ public function testCommandGzipped(): void
9292
$postsTable->save($entity);
9393

9494
$this->exec('dump_sql --gzip');
95-
$result = $this->_out->messages();
95+
$result = $this->_out?->messages() ?? [];
9696
$sql = gzdecode($result[0]);
97+
if (!$sql) {
98+
$this->fail('Failed to decode gzipped output');
99+
}
100+
97101
if ($this->isDBType(Sqlite::class)) {
98102
$this->assertStringContainsString('CREATE TABLE IF NOT EXISTS "posts"', $sql);
99103
$this->assertStringContainsString('INSERT INTO posts VALUES(', $sql);

0 commit comments

Comments
 (0)