Skip to content

Commit 10b04a5

Browse files
committed
Align with changes in dependencies.
1 parent 2846f2e commit 10b04a5

File tree

13 files changed

+77
-42
lines changed

13 files changed

+77
-42
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
/bin/phpunit
1313
/bin/yaml-lint
1414
/composer.lock
15-
/custom.task.properties
16-
/custom.type.properties
1715
/docs/_build/
1816
/test/MySql/AlterAuditTableCommand/config/alter.sql
1917
/test/MySql/AuditCommand/AddAuditColumn/config/audit.json

composer.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@
1313
"setbased/error-handler": "^1.3.0",
1414
"setbased/exception": "^2.3.0",
1515
"setbased/helper-code-store-mysql": "^2.2.0",
16-
"setbased/php-stratum-middle": "^5.11.0",
17-
"setbased/php-stratum-mysql": "^6.6.0",
16+
"setbased/php-stratum-middle": "^5.12.0",
17+
"setbased/php-stratum-mysql": "^7.0.0",
1818
"setbased/typed-config": "^2.0.0",
19-
"symfony/console": "^6.2.5"
19+
"symfony/console": "^6.4.12"
2020
},
21-
"minimum-stability": "dev",
22-
"prefer-stable": true,
2321
"require-dev": {
2422
"ext-pcntl": "*",
2523
"ext-posix": "*",
26-
"phing/phing": "^3.0.0-RC4",
27-
"phpunit/phpunit": "^9.5.28",
24+
"phing/phing": "^3.0.0",
25+
"phpunit/phpunit": "^10.5.35",
2826
"setbased/phing-extensions": "^3.1.0"
2927
},
3028
"autoload": {

src/Audit/AlterAuditTable.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ private function compareTable(string $tableName): void
8282
$auditTable = $this->getTableMetadata($this->config->getManString('database.audit_schema'), $tableName);
8383

8484
// In the audit schema columns corresponding with the columns from the data table are always nullable.
85-
$dataTable->getColumns()->makeNullable();
86-
$dataTable->getColumns()->prependTableColumns($this->additionalAuditColumns);
85+
$dataTable->getColumns()
86+
->makeNullable();
87+
$dataTable->getColumns()
88+
->prependTableColumns($this->additionalAuditColumns);
8789

8890
$this->compareTableOptions($dataTable, $auditTable);
8991
$this->compareTableColumns($dataTable, $auditTable);

src/Audit/Audit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ public function unknownTables(): void
131131
{
132132
if ($this->config->getOptString('tables.'.$table['table_name'].'.alias')===null)
133133
{
134-
$this->config->getConfig()->set('tables.'.$table['table_name'].'.alias', AuditTable::getRandomAlias());
134+
$this->config->getConfig()
135+
->set('tables.'.$table['table_name'].'.alias', AuditTable::getRandomAlias());
135136
}
136137
}
137138
}

src/Audit/Diff.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,23 @@ public function main(): void
8383
{
8484
// Style for column names with miss matched column types.
8585
$style = new OutputFormatterStyle(null, 'red');
86-
$this->output->getFormatter()->setStyle('mm_column', $style);
86+
$this->output->getFormatter()
87+
->setStyle('mm_column', $style);
8788

8889
// Style for column types of columns with miss matched column types.
8990
$style = new OutputFormatterStyle('yellow');
90-
$this->output->getFormatter()->setStyle('mm_type', $style);
91+
$this->output->getFormatter()
92+
->setStyle('mm_type', $style);
9193

9294
// Style for obsolete tables.
9395
$style = new OutputFormatterStyle('yellow');
94-
$this->output->getFormatter()->setStyle('obsolete_table', $style);
96+
$this->output->getFormatter()
97+
->setStyle('obsolete_table', $style);
9598

9699
// Style for missing tables.
97100
$style = new OutputFormatterStyle('red');
98-
$this->output->getFormatter()->setStyle('miss_table', $style);
101+
$this->output->getFormatter()
102+
->setStyle('miss_table', $style);
99103

100104
$lists = $this->getTableLists();
101105

@@ -203,7 +207,10 @@ private function getTableLists(): array
203207
*/
204208
private function missingAuditTables(array $tableNames): void
205209
{
206-
if (empty($tableNames)) return;
210+
if (empty($tableNames))
211+
{
212+
return;
213+
}
207214

208215
$this->io->title('Missing Audit Tables');
209216
$this->io->listing($tableNames);
@@ -217,7 +224,10 @@ private function missingAuditTables(array $tableNames): void
217224
*/
218225
private function obsoleteAuditTables(array $tableNames): void
219226
{
220-
if (empty($tableNames) || !$this->input->getOption('full')) return;
227+
if (empty($tableNames) || !$this->input->getOption('full'))
228+
{
229+
return;
230+
}
221231

222232
$this->io->title('Obsolete Audit Tables');
223233
$this->io->listing($tableNames);

src/AuditTable.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ public function main(array $additionalSql): void
214214
private function addNewColumns(TableColumnsMetadata $columns): void
215215
{
216216
// Return immediately if there are no columns to add.
217-
if ($columns->getNumberOfColumns()===0) return;
217+
if ($columns->getNumberOfColumns()===0)
218+
{
219+
return;
220+
}
218221

219222
$alterColumns = $this->alterNewColumns($columns);
220223

src/Command/BaseCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function connect(): void
103103
$this->config->getManString('database.password'),
104104
$this->config->getManString('database.data_schema'),
105105
$this->config->getManInt('database.port', 3306));
106-
$dl = new AuditDataLayer($connector, $this->io);
106+
$dl = new AuditDataLayer($connector, $this->io);
107107
$dl->connect();
108108
}
109109

@@ -114,7 +114,10 @@ protected function connect(): void
114114
protected function rewriteConfig(): void
115115
{
116116
// Return immediately when the config file must not be rewritten.
117-
if (!$this->rewriteConfigFile) return;
117+
if (!$this->rewriteConfigFile)
118+
{
119+
return;
120+
}
118121

119122
$tables = $this->config->getManArray('tables');
120123
ksort($tables);
@@ -154,7 +157,10 @@ protected function writeTwoPhases(string $filename, string $data): void
154157
if (file_exists($filename))
155158
{
156159
$old_data = file_get_contents($filename);
157-
if ($data===$old_data) $write_flag = false;
160+
if ($data===$old_data)
161+
{
162+
$write_flag = false;
163+
}
158164
}
159165

160166
if ($write_flag)

src/DiffTable.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ private function getRows(bool $full): array
9292
// Add separator between columns and options.
9393
if ($options===false && $row['type']==='option')
9494
{
95-
if (!empty($ret)) $ret[] = new TableSeparator();
95+
if (!empty($ret))
96+
{
97+
$ret[] = new TableSeparator();
98+
}
9699
$options = true;
97100
}
98101

@@ -120,7 +123,10 @@ private function hasDifferences(): bool
120123
{
121124
foreach ($this->rows as $row)
122125
{
123-
if ($row['diff']) return true;
126+
if ($row['diff'])
127+
{
128+
return true;
129+
}
124130
}
125131

126132
return false;
@@ -221,17 +227,21 @@ private function rowsEnhanceWithFormatting(): void
221227
*/
222228
private function rowsEnhanceWithTableColumns(): void
223229
{
224-
$auditColumns = $this->auditTable->getColumns()->getColumnNames();
225-
$dataColumns = $this->dataTable->getColumns()->getColumnNames();
230+
$auditColumns = $this->auditTable->getColumns()
231+
->getColumnNames();
232+
$dataColumns = $this->dataTable->getColumns()
233+
->getColumnNames();
226234

227235
$this->rows = [];
228236
foreach ($dataColumns as $column)
229237
{
230238
if (in_array($column, $auditColumns))
231239
{
232240
$this->rows[] = ['name' => $column,
233-
'audit' => $this->auditTable->getColumns()->getColumn($column),
234-
'data' => $this->dataTable->getColumns()->getColumn($column),
241+
'audit' => $this->auditTable->getColumns()
242+
->getColumn($column),
243+
'data' => $this->dataTable->getColumns()
244+
->getColumn($column),
235245
'type' => 'column',
236246
'new' => false,
237247
'obsolete' => false];
@@ -240,7 +250,8 @@ private function rowsEnhanceWithTableColumns(): void
240250
{
241251
$this->rows[] = ['name' => $column,
242252
'audit' => null,
243-
'data' => $this->dataTable->getColumns()->getColumn($column),
253+
'data' => $this->dataTable->getColumns()
254+
->getColumn($column),
244255
'type' => 'column',
245256
'new' => true,
246257
'obsolete' => false];
@@ -252,7 +263,8 @@ private function rowsEnhanceWithTableColumns(): void
252263
if (!in_array($column, $dataColumns))
253264
{
254265
$this->rows[] = ['name' => $column,
255-
'audit' => $this->auditTable->getColumns()->getColumn($column),
266+
'audit' => $this->auditTable->getColumns()
267+
->getColumn($column),
256268
'data' => null,
257269
'type' => 'column',
258270
'new' => false,

src/MySql/AlterTableCodeStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ protected function indentationMode(string $line): int
2020

2121
$line = trim($line);
2222

23-
if (substr($line, 0, 11)==='alter table' && substr($line, -1)<>';')
23+
if (str_starts_with($line, 'alter table') && !str_ends_with($line, ';'))
2424
{
2525
$mode |= self::C_INDENT_INCREMENT_AFTER;
2626
}
2727

28-
if (substr($line, 0, 1)===';')
28+
if (str_starts_with($line, ';'))
2929
{
3030
$mode |= self::C_INDENT_DECREMENT_BEFORE;
3131
}

src/MySql/AuditDataLayer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ public function getTablesNames(string $schemaName): array
372372
from information_schema.TABLES
373373
where TABLE_SCHEMA = %s
374374
and TABLE_TYPE = 'BASE TABLE'
375-
order by TABLE_NAME", $this->quoteString($schemaName));
375+
order by TABLE_NAME",
376+
$this->quoteString($schemaName));
376377

377378
return $this->executeRows($sql);
378379
}
@@ -473,7 +474,7 @@ private function logQuery(string $query): void
473474
{
474475
$query = trim($query);
475476

476-
if (strpos($query, "\n")!==false)
477+
if (str_contains($query, PHP_EOL))
477478
{
478479
// Query is a multi line query.
479480
$this->io->logVeryVerbose('Executing query:');

0 commit comments

Comments
 (0)