Skip to content

Commit 706eaf4

Browse files
committed
Merge branch '4.x' into 4.next
2 parents 19144eb + f68024a commit 706eaf4

18 files changed

+189
-58
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125
126126
- name: Code Coverage Report
127127
if: success() && matrix.php-version == '8.1' && matrix.db-type == 'mysql'
128-
uses: codecov/codecov-action@v4
128+
uses: codecov/codecov-action@v5
129129

130130
testsuite-windows:
131131
runs-on: windows-2022
@@ -195,7 +195,7 @@ jobs:
195195
vendor/bin/phpunit --coverage-clover=coverage.xml
196196
197197
- name: Submit code coverage
198-
uses: codecov/codecov-action@v4
198+
uses: codecov/codecov-action@v5
199199

200200
cs-stan:
201201
uses: cakephp/.github/.github/workflows/[email protected]

.phive/phars.xml

Lines changed: 2 additions & 2 deletions
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.9" installed="1.11.9" location="./tools/phpstan" copy="false"/>
4-
<phar name="psalm" version="5.25.0" installed="5.25.0" location="./tools/psalm" copy="false"/>
3+
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
55
</phive>

.stickler.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ bin/cake plugin load Migrations
2929
```
3030

3131
Or you can manually add the loading statement in the **src/Application.php** file of your application:
32+
3233
```php
3334
public function bootstrap(): void
3435
{
@@ -37,7 +38,20 @@ public function bootstrap(): void
3738
}
3839
```
3940

40-
Additionally, you will need to configure the ``default`` database configuration in your **config/app.php** file.
41+
### Enabling the builtin backend
42+
43+
In a future release, migrations will be switching to a new backend based on the CakePHP ORM. We're aiming
44+
to be compatible with as many existing migrations as possible, and could use your feedback. Enable the
45+
new backend with:
46+
47+
```php
48+
// in app/config/app_local.php
49+
$config = [
50+
// Other configuration
51+
'Migrations' => ['backend' => 'builtin'],
52+
];
53+
54+
```
4155

4256
## Documentation
4357

docs/en/upgrading-to-builtin-backend.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ Upgrading to the builtin backend
22
################################
33

44
As of migrations 4.3 there is a new migrations backend that uses CakePHP's
5-
database abstractions and ORM. Longer term this will allow for phinx to be
5+
database abstractions and ORM. In 4.4, the ``builtin`` backend became the
6+
default backend. Longer term this will allow for phinx to be
67
removed as a dependency. This greatly reduces the dependency footprint of
78
migrations.
89

@@ -42,16 +43,16 @@ Similar changes are for fetching a single row::
4243
$stmt = $this->getAdapter()->query('SELECT * FROM articles');
4344
$rows = $stmt->fetch('assoc');
4445

45-
Enabling the new backend
46-
========================
46+
Problems with the new backend?
47+
==============================
4748

48-
The new backend can be enabled through application configuration. Add the
49+
The new backend is enabled by default. If your migrations contain errors when
50+
run with the builtin backend, please open `an issue
51+
<https://github.com/cakephp/migrations/issues/new>`_. You can also switch back
52+
to the ``phinx`` backend through application configuration. Add the
4953
following to your ``config/app.php``::
5054

5155
return [
5256
// Other configuration.
53-
'Migrations' => ['backend' => 'builtin'],
57+
'Migrations' => ['backend' => 'phinx'],
5458
];
55-
56-
If your migrations have problems running with the builtin backend, removing this
57-
configuration option will revert to using phinx.

phpstan-baseline.neon

Lines changed: 119 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,169 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Call to an undefined method object\\:\\:loadHelper\\(\\)\\.$#"
4+
message: '#^Call to an undefined method object\:\:loadHelper\(\)\.$#'
5+
identifier: method.notFound
56
count: 1
67
path: src/Command/BakeMigrationCommand.php
78

89
-
9-
message: "#^Call to an undefined method object\\:\\:loadHelper\\(\\)\\.$#"
10+
message: '#^Parameter \#1 \$arguments of method Migrations\\Util\\ColumnParser\:\:parseFields\(\) expects array\<string\>, array\<int\<min, \-1\>\|int\<1, max\>, list\<string\>\|string\> given\.$#'
11+
identifier: argument.type
12+
count: 1
13+
path: src/Command/BakeMigrationCommand.php
14+
15+
-
16+
message: '#^Parameter \#1 \$arguments of method Migrations\\Util\\ColumnParser\:\:parseIndexes\(\) expects array\<string\>, array\<int\<min, \-1\>\|int\<1, max\>, list\<string\>\|string\> given\.$#'
17+
identifier: argument.type
18+
count: 1
19+
path: src/Command/BakeMigrationCommand.php
20+
21+
-
22+
message: '#^Parameter \#1 \$arguments of method Migrations\\Util\\ColumnParser\:\:parsePrimaryKey\(\) expects array\<string\>, array\<int\<min, \-1\>\|int\<1, max\>, list\<string\>\|string\> given\.$#'
23+
identifier: argument.type
24+
count: 1
25+
path: src/Command/BakeMigrationCommand.php
26+
27+
-
28+
message: '#^Call to an undefined method object\:\:loadHelper\(\)\.$#'
29+
identifier: method.notFound
1030
count: 1
1131
path: src/Command/BakeMigrationDiffCommand.php
1232

1333
-
14-
message: "#^Call to an undefined method object\\:\\:loadHelper\\(\\)\\.$#"
34+
message: '#^Call to an undefined method object\:\:loadHelper\(\)\.$#'
35+
identifier: method.notFound
1536
count: 1
1637
path: src/Command/BakeMigrationSnapshotCommand.php
1738

1839
-
19-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
40+
message: '#^PHPDoc tag @var with type string is not subtype of native type non\-falsy\-string\|true\.$#'
41+
identifier: varTag.nativeType
42+
count: 1
43+
path: src/Command/BakeSeedCommand.php
44+
45+
-
46+
message: '#^Strict comparison using \!\=\= between string and false will always evaluate to true\.$#'
47+
identifier: notIdentical.alwaysTrue
48+
count: 1
49+
path: src/Command/BakeSeedCommand.php
50+
51+
-
52+
message: '#^Call to an undefined method Cake\\Datasource\\ConnectionInterface\:\:cacheMetadata\(\)\.$#'
53+
identifier: method.notFound
54+
count: 1
55+
path: src/Command/Phinx/CacheBuild.php
56+
57+
-
58+
message: '#^Call to an undefined method Cake\\Datasource\\ConnectionInterface\:\:cacheMetadata\(\)\.$#'
59+
identifier: method.notFound
60+
count: 1
61+
path: src/Command/Phinx/CacheClear.php
62+
63+
-
64+
message: '#^Unsafe usage of new static\(\)\.$#'
65+
identifier: new.static
2066
count: 1
2167
path: src/Db/Adapter/AdapterFactory.php
2268

2369
-
24-
message: "#^Offset 'id' on non\\-empty\\-array\\<string, mixed\\> in isset\\(\\) always exists and is not nullable\\.$#"
70+
message: '#^Offset ''id'' on non\-empty\-array\<string, mixed\> in isset\(\) always exists and is not nullable\.$#'
71+
identifier: isset.offset
2572
count: 2
2673
path: src/Db/Adapter/MysqlAdapter.php
2774

2875
-
29-
message: "#^Right side of && is always true\\.$#"
76+
message: '#^Offset 3 might not exist on array\{0\: string, 1\: non\-empty\-string, 2\?\: string, 3\?\: ''''\|numeric\-string, 4\?\: string, 5\?\: ''''\|numeric\-string, 6\?\: non\-empty\-string\}\.$#'
77+
identifier: offsetAccess.notFound
3078
count: 1
3179
path: src/Db/Adapter/MysqlAdapter.php
3280

3381
-
34-
message: "#^Access to an undefined property Cake\\\\Database\\\\Connection\\:\\:\\$connection\\.$#"
82+
message: '#^Offset 5 might not exist on array\{0\: string, 1\: non\-empty\-string, 2\?\: string, 3\?\: ''''\|numeric\-string, 4\?\: string, 5\?\: ''''\|numeric\-string, 6\?\: non\-empty\-string\}\.$#'
83+
identifier: offsetAccess.notFound
3584
count: 1
36-
path: src/Db/Adapter/PdoAdapter.php
85+
path: src/Db/Adapter/MysqlAdapter.php
3786

3887
-
39-
message: "#^Offset 'id' on array\\<string, mixed\\> in isset\\(\\) always exists and is not nullable\\.$#"
40-
count: 2
41-
path: src/Db/Adapter/PostgresAdapter.php
88+
message: '#^Offset 6 might not exist on array\{0\: string, 1\: non\-empty\-string, 2\?\: string, 3\?\: ''''\|numeric\-string, 4\?\: string, 5\?\: ''''\|numeric\-string, 6\?\: non\-empty\-string\}\.$#'
89+
identifier: offsetAccess.notFound
90+
count: 1
91+
path: src/Db/Adapter/MysqlAdapter.php
4292

4393
-
44-
message: "#^Offset 'id' on array\\<string, mixed\\> in isset\\(\\) always exists and is not nullable\\.$#"
45-
count: 2
46-
path: src/Db/Adapter/SqliteAdapter.php
94+
message: '#^Right side of && is always true\.$#'
95+
identifier: booleanAnd.rightAlwaysTrue
96+
count: 1
97+
path: src/Db/Adapter/MysqlAdapter.php
4798

4899
-
49-
message: "#^Offset 'id' on array\\<string, mixed\\> in isset\\(\\) always exists and is not nullable\\.$#"
50-
count: 2
51-
path: src/Db/Adapter/SqlserverAdapter.php
100+
message: '#^Right side of && is always true\.$#'
101+
identifier: booleanAnd.rightAlwaysTrue
102+
count: 1
103+
path: src/Db/Adapter/SqliteAdapter.php
52104

53105
-
54-
message: "#^PHPDoc tag @return with type Phinx\\\\Db\\\\Adapter\\\\AdapterInterface is not subtype of native type Migrations\\\\Db\\\\Adapter\\\\AdapterInterface\\.$#"
106+
message: '#^PHPDoc tag @return with type Phinx\\Db\\Adapter\\AdapterInterface is not subtype of native type Migrations\\Db\\Adapter\\AdapterInterface\.$#'
107+
identifier: return.phpDocType
55108
count: 1
56109
path: src/Db/Adapter/SqlserverAdapter.php
57110

58111
-
59-
message: "#^Ternary operator condition is always true\\.$#"
112+
message: '#^Ternary operator condition is always true\.$#'
113+
identifier: ternary.alwaysTrue
60114
count: 2
61115
path: src/Db/Adapter/SqlserverAdapter.php
62116

63117
-
64-
message: "#^Method Migrations\\\\Shim\\\\OutputAdapter\\:\\:getVerbosity\\(\\) should return 16\\|32\\|64\\|128\\|256 but returns int\\.$#"
118+
message: '#^Parameter \#1 \$message of method Cake\\Console\\ConsoleIo\:\:verbose\(\) expects list\<string\>\|string, array\<non\-falsy\-string\> given\.$#'
119+
identifier: argument.type
120+
count: 1
121+
path: src/Migration/Manager.php
122+
123+
-
124+
message: '#^Parameter \#1 \.\.\.\$arg1 of function max expects non\-empty\-array, array given\.$#'
125+
identifier: argument.type
126+
count: 1
127+
path: src/Migration/Manager.php
128+
129+
-
130+
message: '#^PHPDoc tag @var with type array\<string, string\> is not subtype of native type mixed\.$#'
131+
identifier: varTag.nativeType
132+
count: 1
133+
path: src/Migration/ManagerFactory.php
134+
135+
-
136+
message: '#^Method Migrations\\Shim\\OutputAdapter\:\:getVerbosity\(\) should return 16\|32\|64\|128\|256 but returns int\.$#'
137+
identifier: return.type
65138
count: 1
66139
path: src/Shim/OutputAdapter.php
67140

68141
-
69-
message: "#^Possibly invalid array key type Cake\\\\Database\\\\Schema\\\\TableSchemaInterface\\|string\\.$#"
142+
message: '#^Parameter \#1 \$message of method Cake\\Console\\ConsoleIo\:\:out\(\) expects list\<string\>\|string, array\|string given\.$#'
143+
identifier: argument.type
144+
count: 2
145+
path: src/Shim/OutputAdapter.php
146+
147+
-
148+
message: '#^Parameter \#2 \$tables of method Cake\\TestSuite\\ConnectionHelper\:\:dropTables\(\) expects list\<string\>\|null, non\-empty\-array\<string\> given\.$#'
149+
identifier: argument.type
150+
count: 1
151+
path: src/TestSuite/Migrator.php
152+
153+
-
154+
message: '#^Parameter \#2 \$tables of method Cake\\TestSuite\\ConnectionHelper\:\:truncateTables\(\) expects list\<string\>\|null, non\-empty\-array\<string\> given\.$#'
155+
identifier: argument.type
156+
count: 2
157+
path: src/TestSuite/Migrator.php
158+
159+
-
160+
message: '#^Offset 0 on non\-empty\-list\<string\> in isset\(\) always exists and is not nullable\.$#'
161+
identifier: isset.offset
162+
count: 2
163+
path: src/Util/TableFinder.php
164+
165+
-
166+
message: '#^Possibly invalid array key type Cake\\Database\\Schema\\TableSchemaInterface\|string\.$#'
167+
identifier: offsetAccess.invalidOffset
70168
count: 2
71169
path: src/View/Helper/MigrationHelper.php

psalm-baseline.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
<DeprecatedTrait>
6060
<code><![CDATA[ConfigurationTrait]]></code>
6161
</DeprecatedTrait>
62+
<PossiblyNullReference>
63+
<code><![CDATA[getVersionsToMark]]></code>
64+
<code><![CDATA[markVersionsAsMigrated]]></code>
65+
</PossiblyNullReference>
6266
</file>
6367
<file src="src/Command/Phinx/Migrate.php">
6468
<DeprecatedTrait>
@@ -82,6 +86,23 @@
8286
<DeprecatedTrait>
8387
<code><![CDATA[ConfigurationTrait]]></code>
8488
</DeprecatedTrait>
89+
<PossiblyNullArgument>
90+
<code><![CDATA[$maxNameLength]]></code>
91+
</PossiblyNullArgument>
92+
<PossiblyNullPropertyFetch>
93+
<code><![CDATA[$this->getManager()->maxNameLength]]></code>
94+
</PossiblyNullPropertyFetch>
95+
<PossiblyNullReference>
96+
<code><![CDATA[getConfig]]></code>
97+
<code><![CDATA[getOutput]]></code>
98+
<code><![CDATA[getOutput]]></code>
99+
<code><![CDATA[printStatus]]></code>
100+
</PossiblyNullReference>
101+
</file>
102+
<file src="src/Command/SeedCommand.php">
103+
<DeprecatedMethod>
104+
<code><![CDATA[getMultipleOption]]></code>
105+
</DeprecatedMethod>
85106
</file>
86107
<file src="src/Command/SeedCommand.php">
87108
<DeprecatedMethod>
@@ -224,4 +245,9 @@
224245
<code><![CDATA[$this->regexpParseField]]></code>
225246
</ArgumentTypeCoercion>
226247
</file>
248+
<file src="src/Util/SchemaTrait.php">
249+
<PossiblyUndefinedMethod>
250+
<code><![CDATA[cacheMetadata]]></code>
251+
</PossiblyUndefinedMethod>
252+
</file>
227253
</files>

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8-
errorBaseline="./psalm-baseline.xml"
8+
errorBaseline="psalm-baseline.xml"
99
autoloader="tests/bootstrap.php"
1010
findUnusedPsalmSuppress="true"
1111
findUnusedBaselineEntry="true"

src/Command/BakeMigrationDiffCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
/**
3333
* Task class for generating migration diff files.
34-
*
35-
* @property \Bake\Shell\Task\TestTask $Test
3634
*/
3735
class BakeMigrationDiffCommand extends BakeSimpleMigrationCommand
3836
{

src/Command/Phinx/Dump.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8787
$this->output($output);
8888

8989
$path = $this->getOperationsPath($input);
90-
/** @var string $connectionName */
9190
$connectionName = $input->getOption('connection') ?: 'default';
91+
assert(is_string($connectionName), 'Connection name must be a string');
9292
$connection = ConnectionManager::get($connectionName);
9393
assert($connection instanceof Connection);
9494
$collection = $connection->getSchemaCollection();

0 commit comments

Comments
 (0)