Skip to content

Commit 0bc1f24

Browse files
committed
Minimum PHP 8.2 refactoring
1 parent 6faf120 commit 0bc1f24

File tree

7 files changed

+79
-82
lines changed

7 files changed

+79
-82
lines changed

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
php: [8.4, 8.3, 8.2, 8.1]
19+
php: [8.5, 8.4, 8.3, 8.2]
2020
# prefer-lowest is causing unit tests to fail when php 7.2 is run against PHPunit 7.x,
2121
# PHPUnit 8.x is the latest stable release that supports PHP 7.2 and that runs fine
2222
# dependency-version: [prefer-lowest, prefer-stable]
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout code
42-
uses: actions/checkout@v4
42+
uses: actions/checkout@v6
4343

4444
- name: Setup PHP
4545
uses: shivammathur/setup-php@v2

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,32 @@
1919

2020
## Installation Requirements
2121

22+
PHP 8.2+ for version 6.x.
23+
2224
PHP 8.1+ for versions 4.x & 5.x.
2325

2426
PHP 7.4+ for versions 2.x & 3.x
2527

2628
[Composer](https://getcomposer.org/)
2729

28-
Versions 2.x & 3.x of this package have been rigorously tested against sqlite 3.7.11+, MySQL 8.0.29+ & Postgresql 15.1+.
30+
Versions 2.x & 3.x of this package have been rigorously tested against sqlite 3.7.11+, MySQL 8.0.29+ & PostgreSQL 15.1+.
2931

3032
Version 4.x & 5.x have been rigorously tested against:
3133
- Sqlite 3.34.1+
3234
- MariaDB 10.4.33+, 10.5.24+, 10.6.17+, 10.11.7+, 11.0.5+, 11.1.4+, 11.2.3+ & 11.4.2+
33-
- MySql 5.6.51, 5.7.44, 8.0.36+, 8.1.0, 8.2.0, 8.3.0+ & 8.4+
35+
- MySQL 5.6.51, 5.7.44, 8.0.36+, 8.1.0, 8.2.0, 8.3.0+ & 8.4+
3436
- PostgreSQL 12.18+, 13.14+, 14.11+, 15.6+ & 16.2+
3537
- See [run-tests-against-multiple-db-versions.php](./run-tests-against-multiple-db-versions.php)
3638

39+
Version 6.x has been rigorously tested against:
40+
- Sqlite 3.45.1
41+
- MariaDB 10.4.34, 10.5.29, 10.6.24, 10.11.15, 11.4.9, 11.8.5 & 12.1.2
42+
- MySQL 5.6.51, 5.7.44, 8.0.45 & 8.4.8
43+
- PostgreSQL 12.22, 13.23, 14.20, 15.15, 16.11, 17.7 & 18.1
44+
- See [run-tests-against-multiple-db-versions.php](./run-tests-against-multiple-db-versions.php)
45+
3746
MS SQL Server, is theoretically supported but hasn't been tested.
38-
Will provide more updates on MS SQL Server support once testing
39-
on that DB engine has been done.
47+
Will provide more updates on MS SQL Server support once testing on that DB engine has been done.
4048

4149
If you are using Sqlite, version sqlite 3.7.11 or higher is required.
4250

@@ -111,7 +119,9 @@ Documentation for version 4.0.x+ can be found [here](https://github.com/rotexsof
111119

112120
Documentation for version 4.1.x+ can be found [here](https://github.com/rotexsoft/leanorm/blob/4.1.x/docs/index.md).
113121

114-
Documentation for version 5.x+ can be found [here](https://github.com/rotexsoft/leanorm/blob/master/docs/index.md).
122+
Documentation for version 5.x+ can be found [here](https://github.com/rotexsoft/leanorm/blob/5.x/docs/index.md).
123+
124+
Documentation for version 6.x+ can be found [here](https://github.com/rotexsoft/leanorm/blob/master/docs/index.md).
115125

116126
Please submit an issue (preferably with a pull request) to address mistakes or omissions in the documentation or to propose improvements to the documentation.
117127

@@ -129,7 +139,8 @@ New Test files must be manually added to the phpunit.xml.dist file in order for
129139

130140
These are the branches in this repository:
131141

132-
- **master:** contains code for the latest major version (5.x) of this package.
142+
- **master:** contains code for the latest major version (6.x) of this package.
143+
- **5.x:** contains code for the 5.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
133144
- **4.1.x:** contains code for the 4.1.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
134145
- **4.0.x:** contains code for the 4.0.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
135146
- **3.x:** contains code for the 3.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.

composer.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,34 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=8.1",
18-
"rotexsoft/gdao": "^3.0.1",
17+
"php": ">=8.2",
18+
"rotexsoft/gdao": "^4.0.1",
1919
"aura/sqlquery": "^3.0.0",
20-
"rotexsoft/sqlschema": "^3.1.1",
21-
"psr/log": "^2.0.0 || ^3.0.0"
20+
"rotexsoft/sqlschema": "^4.0.0",
21+
"psr/log": "^3.0.0"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^10.5",
24+
"phpunit/phpunit": "^12.0 || ^11.0",
2525
"php-coveralls/php-coveralls": "^2.7",
26-
"vimeo/psalm": "^5.25.0 || ^6.0",
26+
"vimeo/psalm": "^6.0",
2727
"rector/rector": "^2.2.8",
28-
"symfony/polyfill-php82": "^1.30",
2928
"atlas/pdo": "^2.0.0",
30-
"rotexsoft/versatile-collections": "^6.0"
29+
"rotexsoft/versatile-collections": "^7.0"
3130
},
3231
"autoload": {
3332
"classmap": ["src/"]
3433
},
3534
"autoload-dev": {
3635
"classmap": ["src/", "demo/", "tests/"]
3736
},
37+
"config": {
38+
"process-timeout": 3600
39+
},
3840
"scripts": {
3941
"test": [
4042
"Composer\\Config::disableProcessTimeout",
41-
"vendor/bin/phpunit --coverage-text"
43+
"vendor/bin/phpunit --coverage-text --display-all-issues"
4244
],
43-
"rector-clear": "vendor/bin/rector --clear-cache",
4445
"rector": "vendor/bin/rector process src --dry-run",
4546
"psalm-clear-cache": "vendor/bin/psalm --clear-global-cache && vendor/bin/psalm --clear-cache",
4647
"psalm": "composer psalm-clear-cache && vendor/bin/psalm --threads=1",

rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
$rectorConfigurator->import(SetList::PHP_74);
2626
$rectorConfigurator->import(SetList::PHP_80);
2727
$rectorConfigurator->import(SetList::PHP_81);
28+
$rectorConfigurator->import(SetList::PHP_82);
2829
$rectorConfigurator->import(SetList::CODE_QUALITY);
2930
$rectorConfigurator->import(SetList::CODING_STYLE);
3031
$rectorConfigurator->import(SetList::DEAD_CODE);

run-tests-against-multiple-db-versions.php

Lines changed: 41 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ function readableElapsedTime($microtime, $format = null, $round = 3) {
9191
],
9292
],
9393
[
94-
'postgres:12.19' => [
95-
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:12.19",
94+
'postgres:12.22' => [
95+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:12.22",
9696
'dsn' => $pgsql_dsn,
9797
'username' => $pgsql_user,
9898
'password' => $pgsql_pass,
@@ -107,72 +107,64 @@ function readableElapsedTime($microtime, $format = null, $round = 3) {
107107
],
108108
],
109109
[
110-
'postgres:13.15' => [
111-
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:13.15",
110+
'postgres:13.23' => [
111+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:13.23",
112112
'dsn' => $pgsql_dsn,
113113
'username' => $pgsql_user,
114114
'password' => $pgsql_pass,
115115
],
116116
],
117117
[
118-
'mysql:8.0.38' => [
119-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.0.38",
118+
'mysql:8.0.45' => [
119+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.0.45",
120120
'dsn' => $mysql_maria_db_sql_dsn,
121121
'username' => $mysql_user,
122122
'password' => $mysql_root_psw,
123123
],
124124
],
125125
[
126-
'postgres:14.12' => [
127-
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:14.12",
126+
'postgres:14.20' => [
127+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:14.20",
128128
'dsn' => $pgsql_dsn,
129129
'username' => $pgsql_user,
130130
'password' => $pgsql_pass,
131131
],
132132
],
133133
[
134-
'mysql:8.1.0' => [
135-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.1.0",
134+
'mysql:8.4.8' => [
135+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.4.8",
136136
'dsn' => $mysql_maria_db_sql_dsn,
137137
'username' => $mysql_user,
138138
'password' => $mysql_root_psw,
139139
],
140140
],
141141
[
142-
'mysql:8.2.0' => [
143-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.2.0",
144-
'dsn' => $mysql_maria_db_sql_dsn,
145-
'username' => $mysql_user,
146-
'password' => $mysql_root_psw,
147-
],
148-
],
149-
[
150-
'mysql:8.3.0' => [
151-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.3.0",
152-
'dsn' => $mysql_maria_db_sql_dsn,
153-
'username' => $mysql_user,
154-
'password' => $mysql_root_psw,
155-
],
156-
],
157-
[
158-
'mysql:8.4.1' => [
159-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mysql:8.4.1",
160-
'dsn' => $mysql_maria_db_sql_dsn,
161-
'username' => $mysql_user,
162-
'password' => $mysql_root_psw,
163-
],
164-
],
142+
'postgres:15.15' => [
143+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:15.15",
144+
'dsn' => $pgsql_dsn,
145+
'username' => $pgsql_user,
146+
'password' => $pgsql_pass,
147+
],
148+
],
165149
[
166-
'postgres:15.7' => [
167-
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:15.7",
150+
'postgres:16.11' => [
151+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:16.11",
168152
'dsn' => $pgsql_dsn,
169153
'username' => $pgsql_user,
170154
'password' => $pgsql_pass,
171155
],
172156
],
173157
[
174-
'postgres:16.3' => [
175-
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:16.3",
158+
'postgres:17.7' => [
159+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:17.7",
160+
'dsn' => $pgsql_dsn,
161+
'username' => $pgsql_user,
162+
'password' => $pgsql_pass,
163+
],
164+
],
165+
[
166+
'postgres:18.1' => [
167+
'run_container' => "podman run -dt -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=blog docker.io/library/postgres:18.1",
176168
'dsn' => $pgsql_dsn,
177169
'username' => $pgsql_user,
178170
'password' => $pgsql_pass,
@@ -187,56 +179,48 @@ function readableElapsedTime($microtime, $format = null, $round = 3) {
187179
],
188180
],
189181
[
190-
'mariadb:10.5.25' => [
191-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:10.5.25",
182+
'mariadb:10.5.29' => [
183+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:10.5.29",
192184
'dsn' => $mysql_maria_db_sql_dsn,
193185
'username' => $mysql_user,
194186
'password' => $mysql_root_psw,
195187
],
196188
],
197189
[
198-
'mariadb:10.6.18' => [
199-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:10.6.18",
190+
'mariadb:10.6.24' => [
191+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:10.6.24",
200192
'dsn' => $mysql_maria_db_sql_dsn,
201193
'username' => $mysql_user,
202194
'password' => $mysql_root_psw,
203195
],
204196
],
205197
[
206-
'mariadb:10.11.8' => [
207-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:10.11.8",
198+
'mariadb:10.11.15' => [
199+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:10.11.15",
208200
'dsn' => $mysql_maria_db_sql_dsn,
209201
'username' => $mysql_user,
210202
'password' => $mysql_root_psw,
211203
],
212204
],
213205
[
214-
'mariadb:11.0.6' => [
215-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:11.0.6",
206+
'mariadb:11.4.9' => [
207+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:11.4.9",
216208
'dsn' => $mysql_maria_db_sql_dsn,
217209
'username' => $mysql_user,
218210
'password' => $mysql_root_psw,
219211
],
220212
],
221213
[
222-
'mariadb:11.1.5' => [
223-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:11.1.5",
214+
'mariadb:11.8.5' => [
215+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:11.8.5",
224216
'dsn' => $mysql_maria_db_sql_dsn,
225217
'username' => $mysql_user,
226218
'password' => $mysql_root_psw,
227219
],
228220
],
229221
[
230-
'mariadb:11.2.4' => [
231-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:11.2.4",
232-
'dsn' => $mysql_maria_db_sql_dsn,
233-
'username' => $mysql_user,
234-
'password' => $mysql_root_psw,
235-
],
236-
],
237-
[
238-
'mariadb:11.4.2' => [
239-
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:11.4.2",
222+
'mariadb:12.1.2' => [
223+
'run_container' => "podman run -dt -p 3306:3306 -e MYSQL_ROOT_PASSWORD={$mysql_root_psw} docker.io/library/mariadb:12.1.2",
240224
'dsn' => $mysql_maria_db_sql_dsn,
241225
'username' => $mysql_user,
242226
'password' => $mysql_root_psw,

src/LeanOrm/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getLogger(): ?LoggerInterface { return $this->logger; }
9797
public function __construct(
9898
string $dsn = '',
9999
string $username = '',
100-
string $passwd = '',
100+
#[\SensitiveParameter] string $passwd = '',
101101
array $pdo_driver_opts = [],
102102
string $primary_col_name='',
103103
string $table_name=''

tests/ModelTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,20 +2924,20 @@ public function testThatFetchRowsIntoArrayWorksAsExpected() {
29242924
// post's comments
29252925
self::assertIsArray($postRecord['comments']);
29262926
self::assertCount(1, $postRecord['comments']);
2927-
self::assertContainsOnly('array', $postRecord['comments']);
2927+
self::assertContainsOnlyArray($postRecord['comments']);
29282928

29292929
// summary of the post
29302930
self::assertIsArray($postRecord['summary']);
29312931

29322932
// post's posts_tags
29332933
self::assertIsArray($postRecord['posts_tags']);
29342934
self::assertCount(1, $postRecord['posts_tags']);
2935-
self::assertContainsOnly('array', $postRecord['posts_tags']);
2935+
self::assertContainsOnlyArray($postRecord['posts_tags']);
29362936

29372937
// post's tags
29382938
self::assertIsArray($postRecord['tags']);
29392939
self::assertCount(1, $postRecord['tags']);
2940-
self::assertContainsOnly('array', $postRecord['tags']);
2940+
self::assertContainsOnlyArray($postRecord['tags']);
29412941

29422942
} // foreach($allPostsWithAllRelateds as $postRecord)
29432943
unset($allPostsWithAllRelateds);
@@ -3053,20 +3053,20 @@ public function testThatFetchRowsIntoArrayKeyedOnPkValWorksAsExpected() {
30533053
// post's comments
30543054
self::assertIsArray($postRecord['comments']);
30553055
self::assertCount(1, $postRecord['comments']);
3056-
self::assertContainsOnly('array', $postRecord['comments']);
3056+
self::assertContainsOnlyArray($postRecord['comments']);
30573057

30583058
// summary of the post
30593059
self::assertIsArray($postRecord['summary']);
30603060

30613061
// post's posts_tags
30623062
self::assertIsArray($postRecord['posts_tags']);
30633063
self::assertCount(1, $postRecord['posts_tags']);
3064-
self::assertContainsOnly('array', $postRecord['posts_tags']);
3064+
self::assertContainsOnlyArray($postRecord['posts_tags']);
30653065

30663066
// post's tags
30673067
self::assertIsArray($postRecord['tags']);
30683068
self::assertCount(1, $postRecord['tags']);
3069-
self::assertContainsOnly('array', $postRecord['tags']);
3069+
self::assertContainsOnlyArray($postRecord['tags']);
30703070

30713071
} // foreach($allPostsWithAllRelateds as $postRecord)
30723072
unset($allPostsWithAllRelateds);

0 commit comments

Comments
 (0)