Skip to content

Commit a05c066

Browse files
committed
Merge branch 'new' into 3.2.x
2 parents 2802987 + e3577cd commit a05c066

39 files changed

+185
-177
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ indent_style = space
88
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

11-
[*.{md, rst}]
11+
[*.{md,rst}]
1212
trim_trailing_whitespace = false
1313

1414
[*.yml]

.github/workflows/tests.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: PHPUnit
6464
env:
6565
DB_HOST: 127.0.0.1
66-
run: vendor/bin/phpunit --verbose
66+
run: vendor/bin/phpunit
6767

6868
- name: Upload coverage results to Coveralls
6969
env:
@@ -74,7 +74,7 @@ jobs:
7474
composer global require php-coveralls/php-coveralls
7575
php-coveralls --coverage_clover=build/logs/clover.xml -v
7676
77-
mariadb-last:
77+
mariadb-latest:
7878
runs-on: ubuntu-22.04
7979
timeout-minutes: 10
8080

@@ -93,7 +93,7 @@ jobs:
9393
- 3306:3306
9494
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
9595

96-
name: PHP 8.2 - MariaDB - Last
96+
name: PHP Latest - MariaDB
9797

9898
steps:
9999
- name: Checkout
@@ -102,7 +102,7 @@ jobs:
102102
- name: Setup PHP
103103
uses: shivammathur/setup-php@v2
104104
with:
105-
php-version: 8.2
105+
php-version: latest
106106
ini-values: mysqli.allow_local_infile=On
107107
tools: composer
108108
coverage: xdebug
@@ -114,7 +114,7 @@ jobs:
114114
- name: PHPUnit
115115
env:
116116
DB_HOST: 127.0.0.1
117-
run: vendor/bin/phpunit --verbose
117+
run: vendor/bin/phpunit
118118

119119
mysql:
120120
runs-on: ubuntu-20.04
@@ -155,9 +155,9 @@ jobs:
155155
env:
156156
DB_HOST: 127.0.0.1
157157
DB_IMAGE: mysql
158-
run: vendor/bin/phpunit --verbose
158+
run: vendor/bin/phpunit
159159

160-
mysql-last:
160+
mysql-latest:
161161
runs-on: ubuntu-20.04
162162
timeout-minutes: 10
163163

@@ -174,7 +174,7 @@ jobs:
174174
- 3306:3306
175175
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
176176

177-
name: PHP 8.2 - MySQL - Last
177+
name: PHP Latest - MySQL
178178

179179
steps:
180180
- name: Checkout
@@ -183,7 +183,7 @@ jobs:
183183
- name: Setup PHP
184184
uses: shivammathur/setup-php@v2
185185
with:
186-
php-version: 8.2
186+
php-version: latest
187187
ini-values: mysqli.allow_local_infile=On
188188
tools: composer
189189
coverage: xdebug
@@ -196,4 +196,4 @@ jobs:
196196
env:
197197
DB_HOST: 127.0.0.1
198198
DB_IMAGE: mysql
199-
run: vendor/bin/phpunit --verbose
199+
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ build/
44
raw-tests/
55
vendor/
66
.php-cs-fixer.cache
7+
.phpunit.cache
78
.phpunit.result.cache
89
composer.lock
910
composer.phar

.gitlab-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ test:php:
3636
- build/docs/
3737
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
3838

39-
test:php-last:
40-
image: registry.gitlab.com/aplus-framework/images/base:3
39+
test:php-latest:
40+
image: registry.gitlab.com/aplus-framework/images/base:latest
4141
stage: test
4242
timeout: 10 minutes
4343
cache:
@@ -80,8 +80,8 @@ test:php:mysql:
8080
- vendor/bin/phpunit --colors=never
8181
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
8282

83-
test:php:mysql-last:
84-
image: registry.gitlab.com/aplus-framework/images/base:3
83+
test:php:mysql-latest:
84+
image: registry.gitlab.com/aplus-framework/images/base:latest
8585
stage: test
8686
timeout: 10 minutes
8787
cache:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
},
4141
"require-dev": {
4242
"ext-xdebug": "*",
43-
"aplus/coding-standard": "^1.14",
43+
"aplus/coding-standard": "^2.1",
4444
"ergebnis/composer-normalize": "^2.25",
4545
"jetbrains/phpstorm-attributes": "^1.0",
4646
"phpmd/phpmd": "^2.13",
4747
"phpstan/phpstan": "^1.9",
48-
"phpunit/phpunit": "^9.5"
48+
"phpunit/phpunit": "^10.5"
4949
},
5050
"minimum-stability": "dev",
5151
"prefer-stable": true,

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ services:
1010
- mariadb
1111
- mysql
1212
tty: true
13-
package-last:
14-
image: registry.gitlab.com/aplus-framework/images/package:3
15-
container_name: package-database-last
13+
package-latest:
14+
image: registry.gitlab.com/aplus-framework/images/package:latest
15+
container_name: package-database-latest
1616
working_dir: /package
1717
volumes:
1818
- .:/package

phpunit.xml.dist

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false"
3-
bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true"
4-
convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false"
3+
bootstrap="vendor/autoload.php" colors="true" stopOnError="false"
54
stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false"
6-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
7-
<coverage processUncoveredFiles="true">
8-
<include>
9-
<directory suffix=".php">src</directory>
10-
</include>
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache">
7+
<coverage>
118
<report>
129
<clover outputFile="build/coverage/clover.xml"/>
1310
<html outputDirectory="build/coverage"/>
@@ -27,4 +24,9 @@
2724
<env name="DB_SCHEMA" value="framework-tests"/>
2825
<env name="XDEBUG_MODE" value="coverage"/>
2926
</php>
27+
<source>
28+
<include>
29+
<directory suffix=".php">src</directory>
30+
</include>
31+
</source>
3032
</phpunit>

src/Database.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ class Database
8585
* @throws mysqli_sql_exception if connections fail
8686
*/
8787
public function __construct(
88-
#[SensitiveParameter] array | string $username,
89-
#[SensitiveParameter] string $password = null,
88+
#[SensitiveParameter]
89+
array | string $username,
90+
#[SensitiveParameter]
91+
string $password = null,
9092
string $schema = null,
9193
string $host = 'localhost',
9294
int $port = 3306,
@@ -175,13 +177,15 @@ protected function makeConfig(array $config) : array
175177
* @return static
176178
*/
177179
protected function connect(
178-
#[SensitiveParameter] array | string $username,
179-
#[SensitiveParameter] string $password = null,
180+
#[SensitiveParameter]
181+
array | string $username,
182+
#[SensitiveParameter]
183+
string $password = null,
180184
string $schema = null,
181185
string $host = 'localhost',
182186
int $port = 3306
183187
) : static {
184-
if ( ! \is_array($username)) {
188+
if (!\is_array($username)) {
185189
$username = [
186190
'host' => $host,
187191
'port' => $port,
@@ -285,7 +289,7 @@ public function isOpen() : bool
285289
*/
286290
public function close() : bool
287291
{
288-
if ( ! $this->isOpen()) {
292+
if (!$this->isOpen()) {
289293
return true;
290294
}
291295
$closed = $this->mysqli->close();
@@ -633,7 +637,8 @@ public function exec(#[Language('SQL')] string $statement) : int | string
633637
* @return Result
634638
*/
635639
public function query(
636-
#[Language('SQL')] string $statement,
640+
#[Language('SQL')]
641+
string $statement,
637642
bool $buffered = true
638643
) : Result {
639644
$this->lastQuery = $statement;

src/Debug/DatabaseCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ public function getActivities() : array
7272
public function getContents() : string
7373
{
7474
\ob_start();
75-
if ( ! isset($this->database)) {
75+
if (!isset($this->database)) {
7676
echo '<p>This collector has not been added to a Database instance.</p>';
7777
return \ob_get_clean(); // @phpstan-ignore-line
7878
}
7979
echo $this->showHeader();
80-
if ( ! $this->hasData()) {
80+
if (!$this->hasData()) {
8181
echo '<p>Did not run statements.</p>';
8282
return \ob_get_clean(); // @phpstan-ignore-line
8383
}

src/Definition/AlterSchema.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function schema(string $schemaName) : static
3434

3535
protected function renderSchema() : ?string
3636
{
37-
if ( ! isset($this->sql['schema'])) {
37+
if (!isset($this->sql['schema'])) {
3838
return null;
3939
}
4040
$schema = $this->sql['schema'];
@@ -57,7 +57,7 @@ public function charset(string $charset) : static
5757

5858
protected function renderCharset() : ?string
5959
{
60-
if ( ! isset($this->sql['charset'])) {
60+
if (!isset($this->sql['charset'])) {
6161
return null;
6262
}
6363
$charset = $this->database->quote($this->sql['charset']);
@@ -77,7 +77,7 @@ public function collate(string $collation) : static
7777

7878
protected function renderCollate() : ?string
7979
{
80-
if ( ! isset($this->sql['collation'])) {
80+
if (!isset($this->sql['collation'])) {
8181
return null;
8282
}
8383
$collation = $this->database->quote($this->sql['collation']);
@@ -95,7 +95,7 @@ public function upgrade() : static
9595

9696
protected function renderUpgrade() : ?string
9797
{
98-
if ( ! isset($this->sql['upgrade'])) {
98+
if (!isset($this->sql['upgrade'])) {
9999
return null;
100100
}
101101
if (isset($this->sql['charset']) || isset($this->sql['collation'])) {
@@ -108,9 +108,9 @@ protected function renderUpgrade() : ?string
108108

109109
protected function checkSpecifications() : void
110110
{
111-
if ( ! isset($this->sql['charset'])
112-
&& ! isset($this->sql['collation'])
113-
&& ! isset($this->sql['upgrade'])
111+
if (!isset($this->sql['charset'])
112+
&& !isset($this->sql['collation'])
113+
&& !isset($this->sql['upgrade'])
114114
) {
115115
throw new LogicException(
116116
'ALTER SCHEMA must have a specification'

0 commit comments

Comments
 (0)