Skip to content

Commit

Permalink
Merge branch '4.x' into 4.next
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 19, 2024
2 parents 9440f8d + f87dc00 commit c810685
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.10.56" installed="1.10.56" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.20.0" installed="5.20.0" location="./tools/psalm" copy="false"/>
<phar name="phpstan" version="1.11.9" installed="1.11.9" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.25.0" installed="5.25.0" location="./tools/psalm" copy="false"/>
</phive>
2 changes: 1 addition & 1 deletion docs/en/upgrading-to-builtin-backend.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Upgrading to the builtin backend
################################

As of migrations XXX there is a new migrations backend that uses CakePHP's
As of migrations 4.3 there is a new migrations backend that uses CakePHP's
database abstractions and ORM. Longer term this will allow for phinx to be
removed as a dependency. This greatly reduces the dependency footprint of
migrations.
Expand Down
6 changes: 4 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ includes:

parameters:
level: 7
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- src/
bootstrapFiles:
- tests/bootstrap.php
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics

3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,5 @@
<code><![CDATA[$this->regexpParseColumn]]></code>
<code><![CDATA[$this->regexpParseField]]></code>
</ArgumentTypeCoercion>
<TypeDoesNotContainType>
<code>empty($indexes[$indexName])</code>
</TypeDoesNotContainType>
</file>
</files>
3 changes: 2 additions & 1 deletion src/Command/MigrationsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function defaultName(): string
/**
* Array of arguments to run the shell with.
*
* @var array<string>
* @var list<string>
*/
public array $argv = [];

Expand Down Expand Up @@ -198,6 +198,7 @@ public function run(array $argv, ConsoleIo $io): ?int
$name = explode(' ', $name);

array_unshift($argv, ...$name);
/** @var list<string> $argv */
$this->argv = $argv;

return parent::run($argv, $io);
Expand Down
10 changes: 10 additions & 0 deletions src/Db/Adapter/PdoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ public function getConnection(): Connection
return $this->connection;
}

/**
* Backwards compatibility shim for migrations 3.x
*
* @return \Cake\Database\Connection
*/
public function getDecoratedConnection(): Connection
{
return $this->getConnection();
}

/**
* @inheritDoc
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Db/Adapter/SqliteAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,8 @@ protected function calculateNewTableColumns(string $tableName, string|false $col
}
}

$selectColumns = array_filter($selectColumns, 'strlen');
$writeColumns = array_filter($writeColumns, 'strlen');
$selectColumns = array_filter($selectColumns, fn ($value) => $value !== '');
$writeColumns = array_filter($writeColumns, fn ($value) => $value !== '');
$selectColumns = array_map([$this, 'quoteColumnName'], $selectColumns);
$writeColumns = array_map([$this, 'quoteColumnName'], $writeColumns);

Expand Down
6 changes: 4 additions & 2 deletions tests/TestCase/Db/Adapter/SqliteAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ protected function tearDown(): void
unset($this->adapter, $this->out, $this->io);
}

public function testConnection()
public function testGetConnection()
{
$this->assertInstanceOf(Connection::class, $this->adapter->getConnection());
$connection = $this->adapter->getConnection();
$this->assertInstanceOf(Connection::class, $connection);
$this->assertSame($connection, $this->adapter->getDecoratedConnection());
}

public function testBeginTransaction()
Expand Down

0 comments on commit c810685

Please sign in to comment.